window.onload = function () {

	$('quick_enquiry_form').onsubmit = function () {
		quick_enquiry();
		return false;	
	}
}


/*function quick_enquiry() {
	new Ajax.Updater ('quick_enquiry_div', $F('base_url')+'quick-enquiry.html', {method:'post', postBody:'name='+$F('name')+'&phone='+$F('phone')+'&email='+$F('email')+'&enquiry_msg='+$F('enquiry_msg')+'&qAnswer='+$F('qAnswer')+'&qNumber='+$F('qNumber')});
	new Effect.Appear('quick_enquiry_div');

}*/

function quick_enquiry() {
	new Ajax.Updater ('quick_enquiry_div', $F('base_url')+'quick-enquiry.html', {method:'post', postBody:'name='+$F('name')+'&phone='+$F('phone')+'&email='+$F('email')+'&enquiry_msg='+$F('enquiry_msg')});
	new Effect.Appear('quick_enquiry_div');

}

function display_product_details(url) {
	
	document.getElementById('inclusions').style.display = 'none';
	document.getElementById('optional_extras').style.display = 'none';
	document.getElementById('photo_gallery').style.display = 'none';
	
	new Ajax.Updater ('product_details_div', url);
	new Effect.Appear('product_details_div');

}

function show_product_details(id)
{		
	document.getElementById('product_details_div').style.display = 'none';
	document.getElementById(id).style.display = 'block';	
	
	if (id != 'inclusions')
	{
		document.getElementById('inclusions').style.display = 'none';
	}
	if (id != 'optional_extras')
	{
		document.getElementById('optional_extras').style.display = 'none';
	}
	if (id != 'photo_gallery')
	{
		document.getElementById('photo_gallery').style.display = 'none';
	}
}

var loadstatustext="<img src='loading.gif' />"
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 product_details(str)
{	
	xmlHttp = GetXmlHttpObject();
	document.getElementById("product_details_div").innerHTML = loadstatustext;
	if (xmlHttp == null)
	  {
		  alert ("Browser does not support HTTP Request");
		  return;
	  }    
	var url = str;
	
	document.getElementById('inclusions').style.display = 'none';
	document.getElementById('optional_extras').style.display = 'none';
	document.getElementById('photo_gallery').style.display = 'none';
	
//alert(url);
	xmlHttp.onreadystatechange = stateChanged ;	
	xmlHttp.open("GET",url,true);	
	xmlHttp.send(null);
}

function stateChanged() 
{
	document.getElementById('inclusions').style.display = 'none';
	document.getElementById('optional_extras').style.display = 'none';
	document.getElementById('photo_gallery').style.display = 'none';
	
	if (xmlHttp.readyState == 4)
	 { 
		document.getElementById("product_details_div").innerHTML = xmlHttp.responseText ;	
	 }  
}

