var xmlHttp
function showProperties(str,str1)
{	
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 
			var inc = parseInt(document.count.count.value) + 1;
			
			
			document.count.spannumber.value = "txtProp"+str1;
			
			var url="addproperty.php?pid="+str+"&sid="+Math.random()+"&spno="+str1
			xmlHttp.onreadystatechange=stateChanged1
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
}
		
function stateChanged1() 
{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				var div_id = document.count.spannumber.value;
				document.getElementById(div_id).innerHTML=xmlHttp.responseText
			} 
}

function showSubCat(cid)
{	
			
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 
			
			//var url="showSubCat.php?cid="+cid+"&sid="+Math.random()+"&spno="+str1
			var url="showSubCat.php?cid="+cid
			xmlHttp.onreadystatechange=stateChangedSubCat
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
			
}
		
function stateChangedSubCat() 
{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				document.getElementById('subcat').innerHTML=xmlHttp.responseText
			} 
}
function addrow()
{ 
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 
			var inc = parseInt(document.count.count.value) + 1;
			var smid  = document.count.smid.value;
			
			var url="addrow.php?q="+inc+"&sid="+Math.random()+"&smid="+smid;
			xmlHttp.onreadystatechange=stateChanged 
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)
}
		
function stateChanged() 
{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{
				var div_id = "txtHint" + document.count.count.value;
				document.getElementById(div_id).innerHTML=xmlHttp.responseText
				var inc = parseInt(document.count.count.value) + 1;
				document.count.count.value = inc;
			} 
}
		
function GetXmlHttpObject()
{ 
			var objXMLHttp=null
			if (window.XMLHttpRequest)
			{
				objXMLHttp=new XMLHttpRequest()
			}
			else if (window.ActiveXObject)
			{
				objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
			}
			return objXMLHttp
}
		
		


function countprice()
{ 
			
			//var qty = document.getElementsByName('qty()'); 
			//var qty = document.count.elements['qty[0]'].value; 
			
			//alert(count.elements['qty[0]'].value);
			var qty = document.getElementsByName("qty[]");
			var price = document.getElementsByName("price[]");
			var total = document.getElementsByName("total[]");
			for(var i=0;i<qty.length;i++)
			{
					var  totalprice = qty[i].value * price[i].value;
					
					total[i].value = totalprice;
					
			}
			
//			alert(qty);
//			alert(qty[1].value);
			
			
			
}

function printnow(oid) 
{
  window.open('printorder.php?order_id='+oid,'Print Order','width=1024,height=600,scrollbars=yes');
}
	
var xmlHttpAddRow
function AddRow12()
{	
	
	xmlHttpAddRow=GetXmlHttpObject();
	if (xmlHttpAddRow==null){
		alert ("Browser does not support HTTP Request");
		return;
	} 
	var inc = parseInt(document.frmreg.count.value) + 1;
	//alert(inc);
	var url="addrow.php?q="+inc+"&sid="+Math.random();
	document.getElementById('btn').style.visibility='hidden';
	xmlHttpAddRow.onreadystatechange=stateChangedAddRow
	xmlHttpAddRow.open("GET",url,true)
	xmlHttpAddRow.send(null)
}
function stateChangedAddRow(){ 
	if (xmlHttpAddRow.readyState==4 || xmlHttpAddRow.readyState=="complete"){	
		var div_id = "txtHint" + document.frmreg.count.value;
		document.getElementById(div_id).innerHTML=xmlHttpAddRow.responseText
		var inc = parseInt(document.frmreg.count.value) + 1;
		document.frmreg.count.value = inc;
	} 
}	

//================= Function to start add cables in product detail page=========================

function addcable(cid,url, proid)
{	

			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 

			var url= url+"showcable.php?cableid="+cid+"&proid="+proid;

			//var url="showSubCat.php?cid="+cid+"&sid="+Math.random()+"&spno="+str1
//			var url="url/showcable.php?cid="+cid;
			xmlHttp.onreadystatechange=stateChangedSubCatt;
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)			
}
		
function stateChangedSubCatt() 
{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				document.getElementById('jam').innerHTML=xmlHttp.responseText
			} 
}
//======================End Function===============================

//================= Function to start delete cables in product detail page=========================

function delcable(cid,url, proid)
{	
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 
			var flagg="del";
			var url= url+"showcable.php?cableid="+cid+"&proid="+proid+"&flag="+flagg;

			//var url="showSubCat.php?cid="+cid+"&sid="+Math.random()+"&spno="+str1
//			var url="url/showcable.php?cid="+cid;
			xmlHttp.onreadystatechange=stateChangedSubCatt2;
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)			
}
		
function stateChangedSubCatt2() 
{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				document.getElementById('jam').innerHTML=xmlHttp.responseText
			} 
}
//======================End Function===============================

//================= Function to start add cables qty in product detail page=========================

function addcableqty(cid,url, proid)
{	

			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 

			var flagg="addqty";
			var url= url+"showcable.php?cableid="+cid+"&proid="+proid+"&flag="+flagg;

			//var url="showSubCat.php?cid="+cid+"&sid="+Math.random()+"&spno="+str1
//			var url="url/showcable.php?cid="+cid;
			xmlHttp.onreadystatechange=stateChangedSubCattt;
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)			
}
		
function stateChangedSubCattt() 
{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				document.getElementById('jam').innerHTML=xmlHttp.responseText
			} 
}
//======================End Function===============================



//================= Function to remove cables qty in product detail page=========================

function removecableqty(cid,url, proid)
{	

			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			{
				alert ("Browser does not support HTTP Request")
				return
			} 

			var flagg="removeqty";
			var url= url+"showcable.php?cableid="+cid+"&proid="+proid+"&flag="+flagg;

			//var url="showSubCat.php?cid="+cid+"&sid="+Math.random()+"&spno="+str1
//			var url="url/showcable.php?cid="+cid;
			xmlHttp.onreadystatechange=stateChangedSubCatttt;
			xmlHttp.open("GET",url,true)
			xmlHttp.send(null)			
}
		
function stateChangedSubCatttt() 
{ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{	
				document.getElementById('jam').innerHTML=xmlHttp.responseText
			} 
}
//======================End Function===============================

