function cart()
{
	document.cartForm.business.value = 'moi90@juno.com';
	document.cartForm.page_style.value = 'Primary';
	document.cartForm.submit();
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=450,height=470');");
}

function addtocart(itemName,itemNumber,itemAmount)
{
	document.itemForm.business.value = 'moi90@juno.com';
	document.itemForm.item_name.value = itemName;
	document.itemForm.item_number.value = itemNumber;
	document.itemForm.amount.value = itemAmount;
	document.itemForm.submit();
}

function addtocart_m(itemName,itemNumber,itemAmount)
{
	document.itemForm.business.value = 'moi90@juno.com';
	document.itemForm.item_name.value = itemName;
	document.itemForm.item_number.value = itemNumber;
	document.itemForm.amount.value = itemAmount;
	
	for(var i=0;i<8;i++){
		box = eval('document.itemForm.'+'c' + i);
		if(box.checked){
			document.itemForm.os0.value += box.value + ', ';
		}
	}
	document.itemForm.submit();
	document.itemForm.os0.value='';
}

function adult(){
	if(confirm("You must be 18 or older to enter this section.")){
		window.location="/shop/adults.html";
	}
}



addEvent(window, 'load', setTopMargin, false);
addEvent(window, 'resize', setTopMargin, false);

function addEvent(elm, evType, fn, useCapture) {
 // cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
 // By Scott Andrew  
 if (elm.addEventListener) {  
   elm.addEventListener(evType, fn, useCapture);  
   return true;  
 } else if (elm.attachEvent) {  
   var r = elm.attachEvent('on' + evType, fn);  
   return r;  
 } else {
   elm['on' + evType] = fn;
 }
}


function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function setTopMargin(){
	
	var contentHeight = 0;
	//check for homepage
	//var hevents = document.getElementById('hevents');
	//if(typeof(hevents.width) == 'number'){
	if(document.getElementById('wrapper')){
		contentHeight = 477;
	}
	else{
		contentHeight = 453;
	}
	
	if(contentHeight > getWindowHeight()){
		return ;
	}
	else{
		var wrapper = document.getElementById('wrapper');
		wrapper.style.marginTop = (getWindowHeight() - contentHeight)/2 +'px';
	}
}