function popup()
{
	window.open ("customers.php", "pop", "HEIGHT=450, WIDTH=550, screenX=20, screenY=5, status=yes, scrollbars=yes, toolbar=no, directories=no, menubar=no, location=no");
}
function checkselect(theform)
{
	//alert(theform);
	if (theform.pidxx.selectedIndex<=0)
	{
		alert ("Please choose the size!");
		return false;
	}
	return true;
}

function bigMeasure()
{
	window.open("bigmeasure.php","big","toolbar=no, menubar=no, resize=true, width=490, height=605, scrollbars=yes");
}

function contactUsRect()
{
	window.open("rectangular_trampoline_pad.php", "big", "toolbar=no, menubar=no, resize=true, width=420, height=400, scrollbars=yes");
}

function contactUsOct()
{
	window.open("Popup.php?pad=octa", "big", "toolbar=no, menubar=no, resize=true, width=423, height=400, scrollbars=yes");
}
function comparisonPopUp()
{
    window.open("pad_comparison_chart.php", "big", "toolbar=no, menubar=no, width=793, height=615, status=no, scrollbars=yes", false)
}

function backorder_PopUp(name)
{
	// start change by minhaj regarding bacorder alert window 8/13/2009 
	
	if(name=="master")
	{
	    window.open("backorder_responds.php?name=master","big","toolbar=no, menubar=no, scrollbars=yes, width=615, height=480, status=no", false)
	}
	else if(name=="standard")
	{
	    window.open("backorder_responds.php?name=standard","big","toolbar=no, menubar=no, scrollbars=yes, width=615, height=480, status=no",false)
	}
	else if(name=="budget")
	{
	    window.open("backorder_responds.php?name=budget","big","toolbar=no, menubar=no, scrollbars=yes, width=615, height=480, status=no",false)
	}

	// end change by minhaj regarding bacorder alert window 8/13/2009 
}

function getpid(formName,allow,cartQty,btnval)
{
	var frmObj  =  eval( "document." + formName );
	frmObj.btn.value = btnval.value;
    if(btnval.value=="View Cart")
	{
		if(cartQty==0)
		{
			alert("Your shopping cart is currently empty");
			return false;
		}
		else
		{
			window.open("shopping_cart.php", "_self");
			return true;
		}
	}

	if(frmObj.pidxx.type=="select-one")
	{
		pidxxval=frmObj.pidxx.value;
	}
	else
	{
		//oObj= frmObj.all("pidxx");
		oObj= frmObj.pidxx;
		if(oObj!=null)
		{
			pidxxval=0
			for (i=0;i<oObj.length;i++ )
			{
				if(frmObj.pidxx[i].checked==true)
				{
					pidxxval=frmObj.pidxx[i].value
					break;
				}
			}
		}
	}
	if ((pidxxval) <= 0)
	{
		alert ("Please choose pad!");
		return false;
	}


	if (frmObj.pquantity.value=="" || frmObj.pquantity.value==0)
	{
		alert ("Please enter the quantity!");
		frmObj.pquantity.value ='';
		frmObj.pquantity.focus();
		return false;
	}
	if (frmObj.pquantity.value.indexOf('.') >= 1)
	{
		alert ("Please enter the Whole Number for quantity!");
		frmObj.pquantity.value ='';
		frmObj.pquantity.focus();
		return false;
	}
	if (!(frmObj.pquantity.value <= 99999 && frmObj.pquantity.value >= 0))
	{
		alert("Please enter a numeric value for quantity");
		frmObj.pquantity.value ='';
		frmObj.pquantity.focus();
		return false;
	}
	
	return true;
}

function allowInteger(e)
{ 
	var unicode=e.charCode? e.charCode : e.keyCode;	 	
	if (unicode!=8)
	{ //if the key isn't the backspace key (which we should allow)
		if (unicode<48 || unicode>57) //if not a number
		{			
			return false; //disable key press
		}
	}
}

function getpadSize(pid, pad_size, pid_name)
{
//	var frmObj  =  getElementByName(pid_name+"_pid");
	var obj=eval("document."+pid_name+"."+pid_name+"_pid");
	obj.value=pid;
	var whereToWrite = pad_size;   
	//var whereToWrite2 = 'bottompad_size';   
	var strVariables = 'action=PadSize_price&pid='+pid;
//		alert(strVariables);
	makeRequest('ajax_function.php?'+strVariables, whereToWrite);
	qty = document.getElementById(pid_name+"pquantity");
	qty.value = "1";
	document.getElementById(pid_name+"_total").innerHTML="loading...";
	setTimeout("getPadTotal('"+pid_name+"');", 1000);
//	var Obj=eval("document."+divName+"."+divName+"_pid");
}


function getPadTotal(divName)
{
	//alert('here--->'+divName);
	var pidObj=eval("document."+divName+"."+divName+"_pid");
	pid = pidObj.value;
	if(pid ==''){
		alert('please select product of any size.');
		return false;
	}

	//alert("test--->"+pid);
	if(typeof eval("document."+divName+"."+divName+"_pid.value")=="undefined")
	{
	//alert('here--->');
	}else{
	qty = document.getElementById(divName+"pquantity").value;
	var whereToWrite = divName+"_total";   
	//var whereToWrite2 = 'bottompad_size';   
	var strVariables = 'action=PadPriceDetail&pid='+pid+'&qty='+qty;
//	alert(strVariables);
	makeRequest('ajax_function.php?'+strVariables, whereToWrite);
}}