
/* popup functions: show/hide popup layer */
function popOpen(id, topAdjustment) {
	if (id == 'termsandconditions') {
		// reroute to terms and services popup
		var ourURL = window.location.href;
		if(ourURL.indexOf('storeId=10151', ourURL) != -1)
		{
			displayTermsCondPopup('10151');
		}
		else
		{
			displayTermsCondPopup('10152');
		}
	} else if ($(id)){
	  	setSize();
		var overShade = document.getElementById(id);
		// position popup 170px from top of browser
		var topPad =  pos+70;
		if (topAdjustment) topPad = topAdjustment;
		// height-padding = div height
		overShade.style.height = ph-topPad + 'px';
		overShade.style.paddingTop = topPad + 'px';
		overShade.style.display = 'block';	
		
		if (isIE6()) {
			hideSelects();
		}

	}
}
function popClose(id) {
	var popShade = document.getElementById(id);
	popShade.style.display = "";
	
	if(isIE6()) showSelects();
}

function setSize() { /* sets size of shade */
	if (window.pageYOffset != null) { /* moz and safari */
		pos = window.pageYOffset;
		ph = document.documentElement.scrollHeight;
		pw = document.documentElement.scrollWidth;
		if (document.body.scrollHeight > document.documentElement.scrollHeight) {
			ph = document.body.scrollHeight;
			pw = document.body.scrollWidth;
		}
	} else if (document.documentElement.scrollTop > document.body.scrollTop) { /* ie, catch if Standards compliance mode */
		pos = document.documentElement.scrollTop;
		ph = document.documentElement.scrollHeight;
		pw = document.documentElement.scrollWidth;
		if (document.documentElement.clientHeight > document.documentElement.scrollHeight) {
			ph = document.documentElement.clientHeight;					
		}
	} else if (document.body != null) {
		pos = document.body.scrollTop;
		ph = document.body.scrollHeight;
		pw = document.body.scrollWidth;
		if (document.documentElement.scrollHeight > document.body.scrollHeight) {
			ph = document.documentElement.scrollHeight;
		}			
	}
}	