var xmlHttp

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}


//==============================================================================
function ShowFaq(faqcatid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="Get_Faq.php"
	url=url+"?faqcatid="+faqcatid
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=FaqChange
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function FaqChange() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("show_faq").innerHTML=xmlHttp.responseText 
	} 
}
//==============================================================================
function Show_Bedding_Products(section_id,category_id,start)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="Get_Bedding_Products.php"
	url=url+"?section_id="+section_id
	url=url+"&category_id="+category_id
	url=url+"&start="+start
	url=url+"&ram_id="+Math.random()			
	xmlHttp.onreadystatechange=BidChange
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

}
function BidChange()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("Disp_Box").innerHTML=xmlHttp.responseText 
	} 
}
//==============================================================================
function Show_Cat_Products(section_id,category_id,start)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="Get_Products.php"
	url=url+"?section_id="+section_id
	url=url+"&category_id="+category_id
	url=url+"&start="+start
	url=url+"&ram_id="+Math.random()			
	xmlHttp.onreadystatechange=CatChange
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

}
function CatChange()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("Disp_Box").innerHTML=xmlHttp.responseText 
	} 
}
//==============================================================================
function PriceCalculation(qty,price)
{ 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="Get_Price.php"
	url=url+"?qty="+qty.value
	url=url+"&price="+price
	url=url+"&ram_id="+Math.random()
	xmlHttp.onreadystatechange=Display_CalPrice 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function Display_CalPrice(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("Display_CalPrice").innerHTML=xmlHttp.responseText
	} 
}
//==============================================================================
function ShowRetailers(stateid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="Get_Retailers.php"
	url=url+"?stateid="+stateid
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=RetailersChange
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function RetailersChange() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("show_retailers").innerHTML=xmlHttp.responseText 
	} 
}
//==============================================================================
function Show_Cat_B_Products(section_id,category_id,start)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="Get_Bedding_Product_Detail.php"
	url=url+"?section_id="+section_id
	url=url+"&category_id="+category_id
	url=url+"&start="+start
	url=url+"&ram_id="+Math.random()			
	xmlHttp.onreadystatechange=CatChange
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

}
function CatChange()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("Disp_Box").innerHTML=xmlHttp.responseText 
	} 
}

//==============================================================================
function Pricevalue(price)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var prices = price
	var url="Get_sizePrice.php"
	url=url+"?price="+prices
	url=url+"&ram_id="+Math.random()	
	//url=url+"&price="+prices
	xmlHttp.onreadystatechange=Display_size 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function Display_size(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("Display_size").innerHTML=xmlHttp.responseText
	} 
}


function chk12222(){ 
// alert(document.product.sizecount.value);
var scount
var selstatus
selstatus=0

scount = document.product.sizecount.value;

for(i=0; i<=scount; i++){
	if(document.product.size[i].checked==false){
	selstatus=selstatus+1
	}
}

alert(selstatus);
if(document.product.size[0].checked==false)
	{
	alert("Please Select Size");
	//document.product.size.focus();
	//return false;
	//Show_Cat_B_Products();
	}
}

function chk(){

if(document.product.sizecount.value!=1){

 var return_var = false
myOption = -1;
for (i=0; i<document.product.size.length; i++) {
if (document.product.size[i].checked) {
myOption = i;
//alert("my Option = " + myOption);
}
}
if (myOption == -1) {
alert("You must select a Size.");
return false;
} else {
return_var = true
}
}


if(document.product.colorcount.value!=1){
var return_varc = false
myOptionc = -1;
for (j=0; j<document.product.color.length; j++) {
if (document.product.color[j].checked) {
myOptionc = j;
//alert("my Option = " + MyOptionc);
}
}
if (myOptionc == -1) {
alert("You must select a color.");
return false;
} else {
return_varc = true
document.product.submit();
}

}else{
	
document.product.submit();
	}

}
