
// This function opens a centered popup window with params we pass it as are described below buddy
// url=location, t=title, h=height, w=width, Loc=status, Re=resize, Tb=toolbar, Mb=show menubar, Sb=scrollbar

function popUp(url,t,h,w,Loc,Re,Tb,Mb,Sb) {
var iMyWidth;
var iMyHeight;

// divide the current screen hright and width in half
var hN = Number(h)/2;
var wN = Number(w)/2;

// gets top and left positions based on user's resolution so hint window is centered.
iMyWidth = (window.screen.width/2) - (wN + 10); //half the screen width minus half the new window width (plus 5 pixel borders).

// check to see if the user wants the status bar to show up and size accordingly
   if (Loc == 'yes') {
		iMyHeight = (window.screen.height/2) - (hN + 25); //half the screen height minus half the new window height (plus title and status bars if necessary).
		} else {
		iMyHeight = (window.screen.height/2) - (hN + 50); //half the screen height minus half the new window height (plus title and status bars if necessary).
	}

// make the new window and give it focus
var win2 = window.open(url,t,"height="+ h +",width="+ w +",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=" 
+ Sb + ",resizable=" + Re + ",menubar=" + Mb + ",dependent,location=" + Loc + ",toolbar=" + Tb + "");
win2.focus();
}

function togglestatedisplay(countryname){
	if (countryname == 'USA') {
		document.getElementById("state_div").className='holdstate_visible';
		document.getElementById("province_div").className='holdstate_hidden';
		document.getElementById("canada_province_div").className='holdstate_hidden';
		document.getElementById("dominicanrepublic_province_div").className='holdstate_hidden';
	} else	{
		
		if (countryname == 'Canada') {
			document.getElementById("state_div").className='holdstate_hidden';
			document.getElementById("canada_province_div").className='holdstate_visible';
			document.getElementById("province_div").className='holdstate_hidden';
			document.getElementById("dominicanrepublic_province_div").className='holdstate_hidden';
		} else	{
			if (countryname == 'Dominican Republic') {
				document.getElementById("state_div").className='holdstate_hidden';
				document.getElementById("canada_province_div").className='holdstate_hidden';
				document.getElementById("province_div").className='holdstate_hidden';
				document.getElementById("dominicanrepublic_province_div").className='holdstate_visible';				
			} else	{
				document.getElementById("state_div").className='holdstate_hidden';
				document.getElementById("province_div").className='holdstate_visible';
				document.getElementById("canada_province_div").className='holdstate_hidden';
				document.getElementById("dominicanrepublic_province_div").className='holdstate_hidden';
			}		

		}		
	}
}

function togglebillingstatedisplay(countryname){
	if (countryname == 'USA') {
		document.getElementById("billing_state_div").className='holdstate_visible';
		document.getElementById("billing_province_div").className='holdstate_hidden';
		document.getElementById("billing_canada_province_div").className='holdstate_hidden';
	} else	{
		
		if (countryname == 'Canada') {
			document.getElementById("billing_state_div").className='holdstate_hidden';
			document.getElementById("billing_province_div").className='holdstate_hidden';
			document.getElementById("billing_canada_province_div").className='holdstate_visible';
		} else	{
			document.getElementById("billing_state_div").className='holdstate_hidden';
			document.getElementById("billing_province_div").className='holdstate_visible';
			document.getElementById("billing_canada_province_div").className='holdstate_hidden';
		}
	}
}
