PK

ADDRLIN : /home/anibklip/msbhogalnsons.com/cms/
FLL :
Current File : /home/anibklip/msbhogalnsons.com/cms/my_ajax.js

var xmlhttp;
var xmlhttp1;
var responseid;
var responseid1;
//This function Call to the dynamic page	

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	//alert("LEN "+radioLength);
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function senddata(newurl,str,res_id){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	
	var url="ajax_pages/"+newurl+".php?"+str;
	
	/*if(prd_option!=""){
		prd_option=prd_option.value;
		url=url+"&prd_option="+prd_option;
		//prd_option=document.getElementById(prd_option);
		//alert(prd_option +" = " + getCheckedValue(prd_option));
	}*/

	url=url+"&sid="+Math.random();
	responseid=res_id;
	//alert(url+" - " + responseid);
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function stateChanged(){	
	//alert(xmlhttp.responseText);
	if (xmlhttp.readyState==4){	
		document.getElementById(responseid).innerHTML=xmlhttp.responseText;
	}else{
		document.getElementById(responseid).innerHTML="<div align=center><img src='images/loading.gif'/></div>";
	}
}

function check_stock(newurl,str,res_id){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	
	var url="ajax_pages/"+newurl+".php?"+str;
	
	/*if(prd_option!=""){
		prd_option=prd_option.value;
		url=url+"&prd_option="+prd_option;
		//prd_option=document.getElementById(prd_option);
		//alert(prd_option +" = " + getCheckedValue(prd_option));
	}*/

	url=url+"&sid="+Math.random();
	responseid=res_id;
	//alert(url+" - " + responseid);
	xmlhttp.onreadystatechange=StockChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function StockChanged(){	
	//alert(xmlhttp.responseText);
	if (xmlhttp.readyState==4){	
		if(xmlhttp.responseText=="false"){
			document.getElementById(responseid).innerHTML="No Stock Avaliable";
			document.getElementById("cart_btn").disabled=true;
			document.getElementById("cart_btn").style.display="none";
		}else{
			document.getElementById(responseid).innerHTML=xmlhttp.responseText;
			document.getElementById("cart_btn").disabled=false;
			document.getElementById("cart_btn").style.display="";
		}
	}else{
		document.getElementById(responseid).innerHTML="<img src='images/loading.gif'/>";
	}
}

//-----------------------------------------------------------------------	

function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  return new XMLHttpRequest();
	}
	if (window.ActiveXObject){
	  // code for IE6, IE5
	  return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

function profile_rating(str){ 
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
		
	ajaxRequest.open("GET", "profilerate.php?rate="+str, true);
	ajaxRequest.send(null); 

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById("rating").innerHTML = ajaxRequest.responseText;
			document.getElementById("rating_btn").style.display="none";
		}
	}
}


PK 99