
function open_newwindow(sURL,winheight,winwidth){
var winleft=(screen.width - winwidth) / 2;
var wintop=(screen.height - winheight) / 2;
var winprops='scrollbars=yes,toolbar=no,status=yes,resizable=yes,height=' + winheight + ',width=' + winwidth + ',top=' + wintop + ',left=' + winleft;
var new_win=window.open(sURL,'new_win',winprops);
if (new_win!=null){
	if (window.focus) {new_win.focus();}
}
else{
	alert('You may have popup blocking enabled,\n please disable it for this site.');
}
return false;
}

function add_bookmark(){
if ((navigator.appVersion.indexOf('MSIE') > 0) && (parseInt(navigator.appVersion) >= 4)){
	window.external.AddFavorite(location.href,document.title);
}
else {
	var msg='For ease don\'t forget to Bookmark us!';
	if(navigator.appName=='Netscape') msg += '  (Use CTRL-D)';
	sendMessage ('Bookmark Us..', msg, 50);
}
}


function findObj(n, d) {
var p,i,x;  

if(!d){d=document;}

if((p=n.indexOf('?'))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all){x=d.all[n];}
				
for (i=0;!x&&i<d.forms.length;i++){x=d.forms[i][n];}
				
for(i=0;!x&&d.layers&&i<d.layers.length;i++){x=findObj(n,d.layers[i].document);}
				
if(!x && document.getElementById){x=document.getElementById(n);}

return x;
}

function Trim(str){
if(str==null){return null;}

var i;

for(i=0;str.charAt(i)==' ';i++);
str.substring(i,str.length);

for(i=str.length-1;str.charAt(i)==' ';i--);
str=str.substring(0,i+1);

return str;
}

function escURL(s){return window.encodeURIComponent?encodeURIComponent(s):escape(s).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27');}
var uA=navigator.userAgent;

var bN, bV, pos;
			
if (uA.indexOf('Opera')!=-1){
	bN='Opera';}
else if (uA=='Mediapartners-Google' || uA.indexOf('Mediapartners-Google')!=-1){
	bN='Mediapartners-Google';}
else if (uA.indexOf('NextGenSearchBot')!=-1){
	bN='NextGenSearchBot';}
else if (uA.indexOf('Firefox')!=-1){
	bN='Firefox';}
else if (uA.indexOf('firefox')!=-1){
	bN='Firefox';}
else if (uA.indexOf('Firebird\/')!=-1){
	bN='Firebird';}
else if (uA.indexOf('Thunderbird\/')!=-1){
	bN='Thunderbird';}
else if (uA.indexOf('SeaMonkey\/')!=-1){
	bN='SeaMonkey';}
else if (uA.indexOf('AdobeAIR\/')!=-1){
	bN='AdobeAIR';}
else if (uA.indexOf('Blackbird\/')!=-1){
	bN='Blackbird';}
else if (uA.indexOf('IceWeasel\/')!=-1){
	bN='IceWeasel';}
else if (uA.indexOf('Camino\/')!=-1){
	bN='Camino';}
else if (uA.indexOf('Epiphany\/')!=-1){
	bN='Epiphany';}
else if (uA.indexOf('BonEcho\/')!=-1){
	bN='BonEcho';}
else if (uA.indexOf('K-Meleon\/')!=-1){
	bN='K-Meleon';}
else if (uA.indexOf('Shiretoko\/')!=-1){
	bN='Shiretoko';}
else if (uA.indexOf('Ubuntu\/')!=-1){
	bN='Ubuntu';}
else if (uA.indexOf('Novarra-Vision\/')!=-1){
	bN='Novarra-Vision';}
else if (uA.indexOf('Namoroka\/')!=-1){
	bN='Namoroka';}
else if (uA.indexOf('SPOENB\/')!=-1){
	bN='SPOENB';}
else if (uA.indexOf('Viewzi\/')!=-1){
	bN='Viewzi';}
else if (uA.indexOf('Nokia')!=-1){
	bN='Nokia';}
else if (uA.indexOf('SAMSUNG')!=-1){
	bN='SAMSUNG';}
else if (uA.indexOf('BlackBerry')!=-1){
	bN='BlackBerry';}
else if (uA.indexOf('Minefield')!=-1){
	bN='Minefield';}
else if ((navigator.appName).indexOf('Microsoft')!=-1){
	bN='IE';}
else if (uA.indexOf('Chrome\/')!=-1 || (navigator.vendor=='Google Inc.')){
	bN='Chrome';}
else if (uA.indexOf('Safari')!=-1 || navigator.vendor=='Apple Computer, Inc.'){
	bN='Safari';}
else if (uA.indexOf('Mac_PowerPC\/')!=-1){
	bN='Mac_PowerPC';}
else if (navigator.appName=='Netscape'){
	bN='Netscape';}
else if (uA.indexOf('Mozilla')!=-1){
	bN='Mozilla';}
			
bN=Trim(bN);

			
pos=uA.indexOf('MSIE');
if (pos!=-1){
	bN='IE';
	bV=uA.substring(pos + 5);
	pos=bV.indexOf(';');
	bV=bV.substring(0,pos);
}

if (bN=='Opera'){
	pos=uA.indexOf('Opera');
	bV=uA.substring(pos + 6);
	pos=bV.indexOf(' ');
	bV=bV.substring(0, 1);
}

if (bN=='Firefox'){
	pos=uA.indexOf('Firefox\/');
	bV=uA.substring(pos+8, pos+11);
}

if (bN=='Camino'){
	pos=uA.indexOf('Camino\/');
	bV=uA.substring(pos+7, pos+10);
}

if (bN=='Netscape' || bN=='Mozilla'){
	bV=uA.substring(8);
	pos=bV.indexOf(' ');
	bV=bV.substring(0, pos);
}

if (bN=='Chrome'){
	pos=uA.indexOf('Chrome\/');
	bV=uA.substring(pos+7, pos+10);
}

if (bN=='Safari'){
	bV=navigator.appVersion;
	pos=bV.indexOf('Version/');
	bV=bV.substring(pos+8, pos+11);
}

if (bN=='Netscape' && parseInt(navigator.appVersion) >= 5){
	pos=uA.lastIndexOf('/');
	bV=uA.substring(pos + 1);
}

bV=Trim(bV);

if (bV==null){bV='';}

if (bV=='' || bV=='.0' || isNaN(bV)==true){bV=100;}

var rotateBanners=false;


var bVEscaped=bV;

if (bVEscaped!=null){
	if (bVEscaped!=''){bVEscaped=escURL(bVEscaped);}
	}
else{bVEscaped='';}

if (bN=='Netscape' && bV<7){
	document.close();
	document.location.href='/tiptop/invalid_browser.asp?TTJREDIRECT=1&BR=Netscape&VN=' + bVEscaped;
}
else if (bN=='IE'){
	
	if (bV<5){
		if (uA.indexOf('Windows CE')==-1){ 
			document.location.href='/tiptop/invalid_browser.asp?TTJREDIRECT=1&BR=IE&VN=' + bVEscaped;}
		}
	else 
		{rotateBanners=true;}
}


var userAgent = uA;
var bName = bN;
var bVer = bV;
