// JavaScript Document
// Multiple Ajax Call Code For Sub Images 
var xmlHttp
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


function setImage(image_id,cake_id,pre_next,divid)
{	//alert(image_id+' '+cake_id+' '+pre_next+' '+divid);
	// here v1 is extra parameter
	//alert(v1);
	document.getElementById('processing').style.display='block';
	if (image_id!='')
	{ 
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 
		var url="changeImage.php";
		url=url+"?image_id="+image_id+"&cake_id="+cake_id+"&pre_next="+pre_next+"&divid="+divid;
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	
		function stateChanged() 
		{ 
			
			if (xmlHttp.readyState==4)
			{ 
				if (divid=='show_protfolio_top')
				{
					document.getElementById('show_protfolio_top').innerHTML=xmlHttp.responseText;
					//alert(divid);
					//alert(xmlHttp.responseText);
					document.getElementById('processing').style.display='none';
				}
				else
				{
					
					document.getElementById(divid).innerHTML=xmlHttp.responseText;
					//alert(divid);
					//alert(xmlHttp.responseText);
					setImage(document.getElementById('setImage_id').innerHTML,document.getElementById('setCake_id').innerHTML,'','show_protfolio_top'); 
					//alert('End');
					
				}
			}
		}
} // End of function setSize(id)




function setValue(id,divid,v1)
{	//alert(id);
	//alert(divid);
	//alert(vl);
	// here v1 is extra parameter
	//alert(v1);
	document.getElementById('processing').style.display='block';
	if (id!='')
	{ 
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 
		var url="getSubValue.php";
		url=url+"?id="+id+"&divid="+divid+"&v1="+v1;
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	
		function stateChanged() 
		{ 
			if (xmlHttp.readyState==4)
			{ 
				document.getElementById(divid).innerHTML=xmlHttp.responseText;
				document.getElementById('processing').style.display='none';
			}
		}
} // End of function setSize(id)

function getValue(id,divid,v1)
{	//alert(id);
	//alert(divid);
	//alert(vl);
	//alert(vl);
	// here v1 is extra parameter
	//alert(v1);
	//document.getElementById('processing').style.display='block';
	if (id!='')
	{ 
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 
		var url="getSubValue.php";
		url=url+"?id="+id+"&divid="+divid+"&v1="+v1;
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	
} // End of function setSize(id)
