var xmlHttp

function GetXmlHttpObject(){ 
	var objXMLHttp=null
	if (window.XMLHttpRequest){
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

//============== Home Page ================

function Get_Shipping(shipping_detail) { 

var mytool_array=shipping_detail.split(",");
var tot_amount,discount_amount
tot_amount=document.frm_cart.cart_price.value

discount_amount=document.frm_cart.cart_discount.value
	if (discount_amount!="") {
		discount_amount=discount_amount
	} else {
		discount_amount="0.00"
	}

//alert(tot_amount)
//alert(mytool_array[1])
//alert(discount_amount)

//document.getElementById("Get_Ship_Amount").innerHTML="$ " + parseFloat(mytool_array[1])
document.getElementById("Get_Ship_Amount").innerHTML="$ " + mytool_array[1]
document.getElementById("Get_Total_Amount").innerHTML="$ " + (parseFloat(mytool_array[1])+parseFloat(tot_amount)-parseFloat(discount_amount))
document.frm_cart.grand_total.value=(parseInt(mytool_array[1])+parseInt(tot_amount)-parseInt(discount_amount)).toFixed(2);
//document.frm_cart.grand_total.value=(parseFloat(mytool_array[1])+parseFloat(tot_amount)-parseFloat(discount_amount))

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url="Get_Shipping.php"
	url=url+"?shipping_id="+mytool_array[0]
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=Get_Shipping_Change
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function Get_Shipping_Change(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 		
		document.getElementById("Get_Shipping").innerHTML=xmlHttp.responseText 
	} 
}




//============== Home Page ================

function Get_Sub_Categories(category_id,pos_id,mode) { 
//alert(pos_id)
document.frm_search.Set_Count.value=pos_id

		  id = 'Display_Sub_Categories' + pos_id;
		  document.getElementById(id).innerHTML="<font color='#FFA303'>&nbsp;Loading ...</font>";		

pluspath="http://server/pharmacy/images/plus_sign_new.gif";
minuspath="http://server/pharmacy/images/minus_sign_new.gif";

if (mode=="normal") {
	pluspath="http://www.pharmacy-network.com/images/plus_sign_new.gif";
	minuspath="http://www.pharmacy-network.com/images/minus_sign_new.gif";
} else {
	pluspath="https://www.pharmacy-network.com/images/plus_sign_new.gif";
	minuspath="https://www.pharmacy-network.com/images/minus_sign_new.gif";
}

//alert(pluspath)
//alert(minuspath)
//alert(pluspath)
//alert(eval("document.pimg"+pos_id+".src"))
if(eval("document.pimg"+pos_id+".src")==pluspath){

eval("document.pimg"+pos_id+".src='images/minus_sign_new.gif'");

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url="Get_Sub_Categories.php"
	url=url+"?category_id="+category_id
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=Get_Sub_Categories_Change
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} else {
	Set_Null(pos_id)	
}
	
} // function close

function Get_Sub_Categories_Change(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		
		var pos_id=document.frm_search.Set_Count.value
		id = 'Display_Sub_Categories' + pos_id;
		document.getElementById(id).innerHTML=xmlHttp.responseText		
	} 
}

//============== Home Page ================

function Set_Null(pos_id){
		  eval("document.pimg"+pos_id+".src='images/plus_sign_new.gif'");		
		  id = 'Display_Sub_Categories' + pos_id;
		  document.getElementById(id).innerHTML="";		
}

//============== Home Page ================

function Check_Ga_Status(id){
		if (id=="1") {
			document.getElementById("Get_Ga_Content").style.display='block'
		} else {
			document.getElementById("Get_Ga_Content").style.display='none'
		}
}
