



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 userAgent = navigator.userAgent;


var bName, bVer, pos;
			
if (userAgent.indexOf('Opera')!=-1){
	bName='Opera';}
else if (userAgent=='Mediapartners-Google' || userAgent.indexOf('Mediapartners-Google')!=-1){
	bName='Mediapartners-Google';}
else if (userAgent.indexOf('NextGenSearchBot')!=-1){
	bName='NextGenSearchBot';	}
else if (userAgent.indexOf('Firefox')!=-1){
	bName='Firefox';}
else if (userAgent.indexOf('Firebird\/')!=-1){
	bName='Firebird';}
else if (userAgent.indexOf('SeaMonkey\/')!=-1){
	bName='SeaMonkey';}
else if (userAgent.indexOf('Blackbird\/')!=-1){
	bName='Blackbird';}
else if (userAgent.indexOf('IceWeasel\/')!=-1){
	bName='IceWeasel';}
else if (userAgent.indexOf('Camino\/')!=-1){
	bName='Camino';}
else if (userAgent.indexOf('Epiphany\/')!=-1){
	bName='Epiphany';}
else if (userAgent.indexOf('BonEcho\/')!=-1){
	bName='BonEcho';}
else if (userAgent.indexOf('K-Meleon\/')!=-1){
	bName='K-Meleon';}
else if (userAgent.indexOf('Shiretoko\/')!=-1){
	bName='Shiretoko';}
else if (userAgent.indexOf('Ubuntu\/')!=-1){
	bName='Ubuntu';}
else if (userAgent.indexOf('NextGenSearchBot')!=-1){
	bName='NextGenSearchBot';}
else if (userAgent.indexOf('Novarra-Vision\/')!=-1){
	bName='Novarra-Vision';}
else if (userAgent.indexOf('SPOENB\/')!=-1){
	bName='SPOENB';}
else if (userAgent.indexOf('Viewzi\/')!=-1){
	bName='Viewzi';}
else if (userAgent.indexOf('Nokia')!=-1){
	bName='Nokia';}
else if (userAgent.indexOf('SAMSUNG')!=-1){
	bName='SAMSUNG';}
else if (userAgent.indexOf('BlackBerry')!=-1){
	bName='BlackBerry';}
else if ((navigator.appName).indexOf('Microsoft')!=-1){
	bName='IE';}
else if (userAgent.indexOf('Chrome\/') != -1 || (navigator.vendor == 'Google Inc.')){
	bName='Chrome';}
else if (userAgent.indexOf('Safari') != -1 || navigator.vendor == 'Apple Computer, Inc.'){
	bName='Safari';}
else if (userAgent.indexOf('Mac_PowerPC\/')!=-1){
	bName='Mac_PowerPC';}
else if (navigator.appName=='Netscape'){
	bName='Netscape';}
else if (userAgent.indexOf('Mozilla')!=-1){
	bName='Mozilla';}
			
bName=Trim(bName);

			
pos = userAgent.indexOf('MSIE');
if (pos!=-1){
	bName='IE';
	bVer = userAgent.substring(pos + 5);
	pos = bVer.indexOf(';');
	bVer = bVer.substring(0,pos);
}

if (bName=='Opera'){
	pos = userAgent.indexOf('Opera');
	bVer = userAgent.substring(pos + 6);
	pos = bVer.indexOf(' ');
	bVer = bVer.substring(0, 1);
}

if (bName=='Firefox'){
	pos = userAgent.indexOf('Firefox\/');
	bVer = userAgent.substring(pos+8, pos+11);
}

if (bName=='Camino'){
	pos = userAgent.indexOf('Camino\/');
	bVer = userAgent.substring(pos+7, pos+10);
}

if (bName == 'Netscape' || bName=='Mozilla'){
	bVer = userAgent.substring(8);
	pos = bVer.indexOf(' ');
	bVer = bVer.substring(0, pos);
}

if (bName=='Chrome'){
	pos = userAgent.indexOf('Chrome\/');
	bVer = userAgent.substring(pos+7, pos+10);
}

if (bName=='Safari'){
	bVer=navigator.appVersion;
	pos = bVer.indexOf('Version/');
	bVer = bVer.substring(pos+8, pos+11);
}

if (bName == 'Netscape' && parseInt(navigator.appVersion) >= 5){
	pos = userAgent.lastIndexOf('/');
	bVer = userAgent.substring(pos + 1);
}

bVer=Trim(bVer);

if (bVer==null){
	bVer='';
}

if (bVer=='' || isNaN(bVer)==true){
	bVer=100;
}

var rotateBanners = false;



var bVerEscaped=bVer;

if (bVerEscaped!=null){
	if (bVerEscaped!=''){
		bVerEscaped=escURL(bVerEscaped);}
	}
else{
	bVerEscaped='';}

if (bName=='Netscape' && bVer<7){
	document.close();
	document.location.href = '/tiptop/invalid_browser.asp?TTJREDIRECT=1&BR=Netsape&VN=' + bVerEscaped;
}
else if (bName=='IE'){
	
	if (bVer<5){
		if (userAgent.indexOf('Windows CE')==-1){ 
			document.location.href = '/tiptop/invalid_browser.asp?TTJREDIRECT=1&BR=IE&VN=' + bVerEscaped;}
		}
	else 
		{rotateBanners = true;}
}
