var DEFAULT_POPUP_NAME = 'popup';
var DEFAULT_POPUP_WIDTH = 760;
var DEFAULT_POPUP_HEIGHT = 800;

var width;
var height;

function popup(url)
{
	return popup(url, null, null);
}

function popup(url, width, height)
{
	popup(url, width, height, null);
}

function popup(url, width, height, toolbar)
{
	popup(url, width, height, toolbar, null);
}
function popup(url, width, height, toolbar, resizable)
{
	popup(url, width, height, toolbar, resizable, null);
}
function popup(url, width, height, toolbar, resizable, scrollbar)
{
	popup(url, width, height, toolbar, resizable, scrollbar, null);
}

function popup(url, widht, height, toolbar, resizable, scrollbar, name)
{
	popup(url, width, height, toolbar, resizable, scrollbar, name, null);
}

function popup(url, width, height, toolbar, resizable, scrollbar, name, failure)
{
    resizable = 'yes';

	var browserSize = {width : 1024, height : 768};
	var screenSize = {width : 1024, height : 768};

	var xPopup=600;
	var yPopup=800;
	var toolbarVar=1;
	var resizableVar=1;
	var scrollbarVar=1;
	var nameVar = DEFAULT_POPUP_NAME;

	// Get screen resolution and browser size.
	try {    
		screenSize = Util.getScreenResolution();
		browserSize = Util.getBrowserSize();
    }
    
    catch (e) {
    	// Util probably doesn't exist.
    }
	
	// If width, height are less than 0, then set the width, height to the browser size.
	if (width)
		xPopup = (width < 0) ? browserSize.width : width;
	else
		xPopup = DEFAULT_POPUP_WIDTH;
	
	if (height)	
		yPopup = (height < 0) ? browserSize.height : height;
	else
		yPopup = DEFAULT_POPUP_HEIGHT;

	//if(width != null && width <= xMax) xPopup = width;
	//if(height != null && height <= yMax) yPopup = height;
	if(toolbar != null) toolbarVar = toolbar;
	if(resizable != null) resizableVar = resizable;
	if(scrollbar != null) scrollbarVar = scrollbar;
	if(name != null) nameVar = name;

	var xOffset = (screenSize.width - xPopup) / 2;
	var yOffset = (screenSize.height - yPopup) / 2;
	
	xOffset = (xOffset >= 0) ? xOffset : 0;
	yOffset = (yOffset >= 0) ? yOffset : 0;

	var popup = null;
	var windowFeatures = 'width=' + xPopup + ',height=' + yPopup + ',toolbar=' + toolbarVar + ',scrollBars=' + scrollbarVar + ',status=no,resizable=' + resizableVar + ', screenX=' + xOffset + ',screenY=' + yOffset + ',top=' + yOffset + ',left=' + xOffset;
	popup = window.open(url, nameVar, windowFeatures);

	if (popup) {
	    if (!popup.opener)
	         popup.opener = self;
	    if (popup.focus) popup.focus();
    }
    
    else {
    	if (failure) {
	    	failure.call(this, url);
    	}
    }        
}

function popupCover(url, width, height, name, failure)
{
	popupWidth = (width) ? width : 760;
	popupHeight = (height) ? height : null;
	popupName = (name) ? name : null;
	failureHandler = (failure) ? failure : null;
		
	popup(url, popupWidth, popupHeight, 0, 0, null, popupName, failureHandler);
}

function popupLearnmore(url)
{
	popup(url, 660, 780);
}

function popupReqs(url)
{
	popup(url, 640, 500, 0, 0);
}

function popupTermsPromo(url)
{
	openWindow(url, 450, 200, 0, 0);
}

function popupPolicy(url)
{
	openWindow(url, 600, 600, 0, 0);
}

function popupFlashtour(url)
{
	openWindow(url, 895, 600, 0, 0);
}




function openWindow(url)
{
	openWindow(url, null, null);
}
function openWindow(url, width, height)
{
	openWindow(url, width, height, null);
}
function openWindow(url, width, height, toolbar)
{
	openWindow(url, width, height, toolbar, null);
}
function openWindow(url, width, height, toolbar, resizable)
{
	openWindow(url, width, height, toolbar, resizable, null);
}
function openWindow(url, width, height, toolbar, resizable, scrollbar)
{
    resizable = 'yes';
    var xMax = 1024, yMax=768;
	if (document.all || document.layers)
	{
        var xMax = screen.availWidth, yMax = screen.availHeight;
    }

	var xPopup=600;
	var yPopup=800;
	var toolbarVar=1;
	var resizableVar=1;


	if(width != null && width <= xMax) xPopup = width;
	if(height != null && height <= yMax) yPopup = height;
	if(toolbar != null) toolbarVar = toolbar;
	if(resizable != null) resizableVar = resizable;

	var xOffset = (xMax - xPopup) / 2, yOffset = (yMax - yPopup) / 2;

	var win;
	win = window.open(url,'window','width='+xPopup+',height='+yPopup+',toolbar='+toolbarVar+',location,directories,status,scrollbars,menubar,resizable='+resizableVar+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'')
	if (!win.opener)
         win.opener = self;
    win.focus();
}


function checkCountry(theVal)
{
	document.updateform.cmd.value='none';
	var validateZip = document.updateform.validateZip.value;

	if ((theVal == 'US' || theVal == 'CA' || theVal == 'XXC')
        && (validateZip == 'false' || validateZip != theVal))
	{
		document.updateform.cmd.value='change';
		document.updateform.validateZip.value=theVal;
		document.updateform.submit();
	} else if((theVal != 'US' && theVal != 'XXC') && (	validateZip=='US' ||
														validateZip=='XXC'))
	{
		document.updateform.cmd.value='change';
		document.updateform.validateZip.value='false';
		document.updateform.contacts_state.value='';
		document.updateform.submit();
	}
}

function chase()
{
//var xx = screen.width / 2;
var xx=785;
//var yy = screen.height / 5;
var yy=480;
var newWindow = window.open('http://creditcardsatchase.com/portal/site/marketing/index.jsp?pgTitle=pg_creditcardhome',null, 'left=0,top=0,screenX=0,screenY=0,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+xx+',height='+yy);
newWindow.blur();
}




// JavaScript to interpolate random background images into a page.

 var ic = 2;     // Number of alternative background images

 var bgimg = new Array(ic);  // Array to hold filenames

        

bgimg[0] = "http://imgs.zinio.com/images/search_bkg_1.jpg";

bgimg[1] = "http://imgs.zinio.com/images/search_bkg_2.jpg";

<!---bgimg[2] = "http://imgs.zinio.com/images/search_bkg_3.jpg";--->

 

 

function pickRandom(range) {

if (Math.random)

return Math.round(Math.random() * (range-1));

else {

var now = new Date();

return (now.getTime() / 1000) % range;

}

}

var choice = pickRandom(ic);

document.write('<style type="text/css">');

document.write('.searchBkg {background-image:url('+bgimg[choice]+');}');

document.write('</style>');



function text_button() {

    document.ageVerificationForm.submit();

}

