// JavaScript Document
function callajax(url)
{   
  if (window.XMLHttpRequest) {              
    AJAX=new XMLHttpRequest();              
  } else {                                  
    AJAX=new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (AJAX) {
     AJAX.open("GET", url, false);                             
     AJAX.send(null);
	 return AJAX.responseText;                                         
  } else {
     return false;
  }                                             

}
//////////////FUNCTIONs FOR FIXTURES (START)/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function StockistContact(str)
{
var url="contact_stockiest.php"
url=url+"?"+str
url=url+"&sid="+Math.random()
var responseText=callajax(url);
document.getElementById('contact').innerHTML=responseText ;
}
function setvalue(val,val1,id) 
{ 
 document.getElementById(id).value=val1;
 var a=id+'-a';
 document.getElementById(a).innerHTML=val;
}
function checkstep1()
{
/*	if(document.frmstep1.fire.value=='')
	{   
		alert("Please select fires by style");
		return false;
	}
	else
	{*/
		document.frmstep1.submit();
//	}
}
function checkBrand()
{
	/*if(document.frmbrand.brand.value=='')
	{   
		alert("Please Choose brand");
		return false;
	}
	else
	{*/
		document.frmbrand.submit();
	/*}*/
}
function changeImage(filename,id,val,valid,vall,filename1)
{
    document.previewpic.setAttribute('src',filename);
	document.getElementById(id).innerHTML=val;
	document.getElementById(valid).value=vall;
	//alert(document.getElementById(valid).value);
	document.getElementById('removelink').innerHTML="<a href=\"javascript:removeImage('"+filename1+"','"+id+"','"+valid+"')\">Remove</a>"
}
function removeImage(filename,id,valid)
{
    document.previewpic.setAttribute('src',filename);
	document.getElementById(id).innerHTML='';
	document.getElementById(valid).value='';
	document.getElementById('removelink').innerHTML='';
}
function changeStep1Image(filename,id,val,valid,vall,filename1)
{
    document.previewpic.setAttribute('src',filename);
	document.getElementById(id).innerHTML=val;
	document.getElementById(valid).value=vall;
	document.getElementById('removelink').innerHTML="<a href=\"javascript:removeImage('"+filename1+"','"+id+"','"+valid+"');setvalue('Select Style','','firestyle')\">Remove</a>"
}

function changeValue(valid,vall)
{
	document.getElementById(valid).value=vall;
}
function checkstep2()
{
	/*if(document.frmstep2.fueltype.value=='')
	{   
		alert("Please  Choose  Fuel Type");
		return false;
	}
	else
	{*/
		document.frmstep2.submit();
	/*}*/
}
function checkstep3()
{
	/*if(document.frmstep3.surround.value=='')
	{   
		alert("Please  Choose  Surround Material");
		return false;
	}
	else
	{*/
		document.frmstep3.submit();
	/*}*/
}
function checkstep4()
{
	/*if(document.frmstep4.chimney.value=='')
	{   
		alert("Please  Choose  Chimney or Flue Type");
		return false;
	}
	else
	{*/
		document.frmstep4.submit();
	/*}*/
}
/*function Surround()
{
	document.frmsurround.submit();
}*/
function showDetail(url)
{
  document.frm1.action=	url;
  document.frm1.submit();
}

function getPageEventCoords(evt) {
var coords = {left:0, top:0};
if (evt.pageX) {
coords.left = evt.pageX;
coords.top = evt.pageY;
} else if (evt.clientX) {
coords.left =
evt.clientX + document.body.scrollLeft - document.body.clientLeft;
coords.top =
evt.clientY + document.body.scrollTop - document.body.clientTop;
// include html element space, if applicable
if (document.body.parentElement && document.body.parentElement.clientLeft) {
var bodParent = document.body.parentElement;
coords.left += bodParent.scrollLeft - bodParent.clientLeft;
coords.top += bodParent.scrollTop - bodParent.clientTop;
}
}
return coords;
}
/////////////function to fetch product list for brouchers page
function getProductlist(str)
{ 
	var url="fetchproductlist.php"
url=url+"?"+str
url=url+"&sid="+Math.random()
var responseText=callajax(url);
//alert(responseText);
document.getElementById('prdarea').innerHTML=responseText ;
}
/////////////function to fetch product attached style list for brouchers page
function getStylelist(str)
{ 
	var url="fetchstylelist.php"
url=url+"?"+str
url=url+"&sid="+Math.random()
//alert(url);
var responseText=callajax(url);
//alert(responseText);
document.getElementById('stylearea').innerHTML=responseText ;
}
