var xmlHttp
var xmlHttpSecond
var domain="http://www.petel-design.com/";

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 GetSecondXmlHttpObject()
{
var xmlHttpSecond=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttpSecond=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttpSecond=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttpSecond=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttpSecond;
}

function showProDesc(proid)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url=domain+"product-tabs/product-description.php?pro_id="+proid;
	url=url+"&lang="+lang;
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=proStateChanged;
	xmlHttp.send(null);
}
function showProImages(proid)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url=domain+"product-tabs/product-images.php?pro_id="+proid;
	url=url+"&lang="+lang;
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=proStateChanged;
	xmlHttp.send(null);
}
function showProTestimonials(proid)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url=domain+"product-tabs/product-testimonials.php?pro_id="+proid;
	url=url+"&lang="+lang;
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=proStateChanged;
	xmlHttp.send(null);
}
function showProRelated(proid)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url=domain+"product-tabs/product-related.php?pro_id="+proid;
	url=url+"&lang="+lang;
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=proStateChanged;
	xmlHttp.send(null);
}
function proStateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("productTable").innerHTML=xmlHttp.responseText;
	}
}
function showContactUs(product_id)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url=domain+"product-tabs/product-contact.php";
	url=url+"?lang="+lang+"&product_id="+product_id;
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=proContactChanged;
	xmlHttp.send(null);
}
function hideContactUs()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url=domain+"product-tabs/product-contact.php?action=hide";
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=proContactChanged;
	xmlHttp.send(null);
}
function submitContactUs()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	if (xmlHttp.overrideMimeType) {
		// set type accordingly to anticipated content type
		xmlHttp.overrideMimeType('text/html');
	}

	var parameters = "name=" + encodeURI( document.getElementById("name").value ) +
                    "&action=submit" + 
                    "&url=" + 
                    "&email=" + encodeURI( document.getElementById("email").value ) + 
                    "&phone=" + encodeURI( document.getElementById("phone").value ) + 
                    "&subject=" + encodeURI( document.getElementById("subject").value ) + 
                    "&contact_text=" + encodeURI( document.getElementById("contact_text").value );

	var url=domain+"product-tabs/product-contact.php";
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", parameters.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.onreadystatechange=proContactChanged;
	xmlHttp.send(parameters);
}
function proContactChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("contactLayer").innerHTML=xmlHttp.responseText;
	}
}


function showMainImage(product_id,image_name)
{
	xmlHttpSecond=GetSecondXmlHttpObject();
	if (xmlHttpSecond==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url=domain+"product-tabs/product-main-image.php";
	url=url+"?lang="+lang+"&product_id="+product_id+"&image_name="+image_name;
	xmlHttpSecond.open("GET",url,true);
	xmlHttpSecond.onreadystatechange=proMainImageChanged;
	xmlHttpSecond.send(null);
}
function proMainImageChanged() 
{ 
	if (xmlHttpSecond.readyState==4)
	{ 
		document.getElementById("productMainImage").innerHTML=xmlHttpSecond.responseText;
	}
}
/*
function showQuantity(product_id,shop_opt1_option_id, shop_opt2_option_id)
{
	xmlHttpSecond=GetSecondXmlHttpObject();
	if (xmlHttpSecond==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	var url=domain+"product-tabs/product-quantity.php";
	url=url+"?lang="+lang+"&product_id="+product_id+"&shop_opt1_option_id="+shop_opt1_option_id+"&shop_opt2_option_id="+shop_opt2_option_id;
	xmlHttpSecond.open("GET",url,true);
	xmlHttpSecond.onreadystatechange=proQuantityChanged;
	xmlHttpSecond.send(null);
}

function proQuantityChanged() 
{ 
	if (xmlHttpSecond.readyState==4)
	{ 
		document.getElementById("productQuantity").innerHTML=xmlHttpSecond.responseText;
	}
}
*/


function CreateBookmarkLink(url,title) 
{ 
	if (window.sidebar) { 
		// Mozilla Firefox Bookmark		
		window.sidebar.addPanel(title, url,"");
	} 
	else if( window.external ) 
	{ 		// IE Favorite
		window.external.AddFavorite( url, title); 
	}
	else if(window.opera && window.print) 
	{ // Opera Hotlist		
		return true; 
	}
} 
