// JavaScript Document
function GetXmlHttpObject1()
{
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 ajaxshow_download(id)
{
	xmlHttp=GetXmlHttpObject1();
	if (xmlHttp==null)
    {
	  alert ("Your browser does not support AJAX!");
	  return;
    }
	document.getElementById('ajax_loader_id').style.display='block';
	var url="ajax.php?product_id="+id;
	xmlHttp.onreadystatechange=ajaxshowDownload;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ajaxshowDownload()
{
	if(xmlHttp.readyState==4)
	{ 
		document.getElementById('ajax_loader_id').style.display='none';
		document.getElementById('download_id').innerHTML=xmlHttp.responseText;
	}
}

function changeLan(id,flag,lan_code)
{
	xmlHttp=GetXmlHttpObject1();
	if (xmlHttp==null)
    {
	  alert ("Your browser does not support AJAX!");
	  return;
    }
	var url="ajaxChangeLan.php?lan_id="+id+"&flag="+flag+"&lan_code="+lan_code;
	xmlHttp.onreadystatechange=changeLanRes;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function changeLanRes()
{
	if(xmlHttp.readyState==4)
	{ 
		window.location.reload();
	}
}

//Image Library Ajax
function ajax_show_image_by_category(id)
{
	document.getElementById('family_id').value='';
	document.getElementById('product_id').value='';
	document.getElementById('product_model').value='';
	
	xmlHttp=GetXmlHttpObject1();
	if (xmlHttp==null)
    {
	  alert ("Your browser does not support AJAX!");
	  return;
    }
	
	document.getElementById('ajax_loader_id').style.display='block';
	var url="ajax_product.php?category_id="+id+"&from=category";
	xmlHttp.onreadystatechange=ajaxShowImage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function ajax_show_image_by_family(id)
{
	document.getElementById('category_id').value='';
	document.getElementById('product_id').value='';
	document.getElementById('product_model').value='';
	xmlHttp=GetXmlHttpObject1();
	if (xmlHttp==null)
    {
	  alert ("Your browser does not support AJAX!");
	  return;
    }
	
	document.getElementById('ajax_loader_id').style.display='block';
	var url="ajax_product.php?family_id="+id+"&from=family";
	xmlHttp.onreadystatechange=ajaxShowImage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function ajax_show_image_by_product(id)
{
	document.getElementById('category_id').value='';
	document.getElementById('family_id').value='';
	document.getElementById('product_model').value='';
	xmlHttp=GetXmlHttpObject1();
	if (xmlHttp==null)
    {
	  alert ("Your browser does not support AJAX!");
	  return;
    }
	document.getElementById('ajax_loader_id').style.display='block';
	var url="ajax_product.php?product_id="+id+"&from=product";
	xmlHttp.onreadystatechange=ajaxShowImage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function ajax_show_image_by_product_model(id)
{
	document.getElementById('category_id').value='';
	document.getElementById('product_id').value='';
	document.getElementById('family_id').value='';
	
	xmlHttp=GetXmlHttpObject1();
	if (xmlHttp==null)
    {
	  alert ("Your browser does not support AJAX!");
	  return;
    }
	
	document.getElementById('ajax_loader_id').style.display='block';
	var url="ajax_product.php?product_model="+id+"&from=product_model";
	xmlHttp.onreadystatechange=ajaxShowImage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function ajaxShowImage()
{
	if(xmlHttp.readyState==4)
	{ 
		document.getElementById('ajax_loader_id').style.display='none';
		document.getElementById('product_display_id').innerHTML=xmlHttp.responseText;
	}
}



function ajax_show_sub_product_listing(start_limit,category_id,parent_product_id,page)
{
	
	document.getElementById('product_div_id').className='productDivClass';
	
	xmlHttp=GetXmlHttpObject1();
	if (xmlHttp==null)
    {
	  alert ("Your browser does not support AJAX!");
	  return;
    }
	
	document.getElementById('loader_div_id').style.display='block';
	var url="ajax_product.php?start_limit="+start_limit+"&category_id="+category_id+"&parent_product_id="+parent_product_id+"&page="+page+"&from=product_carousal_list";
	//alert(url);
	xmlHttp.onreadystatechange=ajaxShowSubProductListing;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function ajaxShowSubProductListing()
{
	if(xmlHttp.readyState==4)
	{ 
	document.getElementById('product_div_id').className='';
		document.getElementById('loader_div_id').style.display='none';
		document.getElementById('product_div_id').innerHTML=xmlHttp.responseText;
	}
}

