/* browser vars for popups */
var ng = navigator;
var ua = ng.userAgent;
var nav = (ng.appName == 'Netscape');
var saf = (ng.appVersion.indexOf('Safari') != -1);
var ie = (ng.appVersion.indexOf('MSIE') != -1);
var mac = (ua.indexOf('Mac') != -1);
var aol = (ua.indexOf('AOL') != -1);

window.name = 'amex';

function popWithSize(openURL, winName, w, h){
    w = browserWidth(w);
	h = browserHeight(h);
    // position //x=aol?40:25; //y=aol?12:37;
    otherOptions = 'toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,';//+',screenx='+x+',screeny='+y+',left='+x+',top='+y);
    thisWin = window.open(openURL, winName, otherOptions+'width='+w+',height='+h);
	if ( thisWin.closed ) { return true; }
	if( thisWin.focus ){ thisWin.focus(); }
	var strOut = 'w:' + w + 'px h:' + h + 'px';
//	alert(strOut);
	return false;
}

function popQuery(popURL, w, h){ // for watch the promo links
	// original width=419,height=480
    w = browserWidth(w);
	h = browserHeight(h);
    // position //x=aol?40:25; //y=aol?12:37;
    var otherOptions = 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,';
    Watch_the_Promo = window.open(popURL,'Watch_the_Promo',otherOptions+'width='+w+',height='+h);//+',screenx='+x+',screeny='+y+',left='+x+',top='+y);
//    window.open('promos/pop_query.html?name=Reagan&url=reagan','Watch_the_Promo','');
	if ( !Watch_the_Promo ) { return true; }
	if( Watch_the_Promo.focus ){ Watch_the_Promo.focus(); }
	return false;
}

function browserWidth(w){
	if( mac ){
		if( !nav && ie ){
			w-=16;
		}
		if( nav && saf ){
			w+=2;
		}
		/*if( nav && !ie && !saf ){
			w+=0;
		}*/
	}else{
		if( ie ){
			w+=13;
		}else{
			//w+=1;
		}
	}
	return w;
}

function browserHeight(h){
	if( mac ){
		if( !nav && ie ){
			h-=12;
		}
		if( nav && saf ){
			h+=17;
		}
		if( nav && !ie && !saf ){
			h+=5;
		}
	}else{
		if( ie ){
			//h-=4;
		}else{
			//h-=3;
		}
	}
	return h;
}