// JavaScript Document
function add_cart()
{
	theform = document.getElementById("add_to_cart");	
	//alert();
	if (theform.option_id&&theform.option_id.value == 0)
	{
		
		alert("Please select an option");
		return false;							
	}
	if (theform.color_id&&theform.color_id.value == 0)
	{
		
		alert("Please select a color");
		return false;							
	}
	theform.submit();			
}

function check_enquiry()
{
	theform = document.getElementById("conPage");	
	
	if (theform.fname.value.length == 0)
	{
		alert("Please Enter your first name !");
		theform.fname.focus();
		return false;							
	}
	
	if (theform.lname.value.length == 0)
	{
		alert("Please Enter your last name !");
		theform.lname.focus();
		return false;							
	}
	
	if (theform.email.value.length == 0)
	{
		alert("Please Enter your email address !");
		theform.email.focus();
		return false;							
	}
	
	if (theform.enquiry.value.length == 0)
	{
		alert("Please Enter your enquiry !");
		theform.enquiry.focus();
		return false;							
	}
	
	theform.submit();		
}

function keep(){
	theform = document.getElementById("form1");	
	//alert();
	theform.action="index.php";
	theform.submit();
}
function join_newsletter()
{
	theform = document.getElementById("newsletter_signup");	
	//alert();
	//here we should do email validation
	theform.submit();
}
function search_theme_function(){
	theform = document.getElementById("search_theme");
	theform.submit();
}
function select_a_brand()
{
	theform = document.getElementById("select_brand");
	//alert(theform.brand_selection.value);
	if (theform.brand_selection.value>0)
	{
		theform.action="index.php?brand_id="+theform.brand_selection.value;
	}
	else
	{
		theform.action="index.php";		
	}
	//alert(theform.action);
	theform.submit();
}
function cart_recalculate()
{
	theform = document.getElementById("cart_details");
	theform.action="cart_recalculate.php";
	theform.submit();		
}
function confirm_purchase()
{
	theform = document.getElementById("cart_finish");
//	theform.action="checkout_3.php";
	theform.submit();	
}
function back_to_shop()
{
	theform = document.getElementById("cart_details");
	theform.action="index.php";
	theform.submit();			
}
function go_to_checkout1()
{
	theform = document.getElementById("cart_details");
	theform.action="checkout_1.php";
	theform.submit();			
}
function go_to_checkout2()
{
	theform = document.getElementById("cart_details");
	theform.action="checkout_2.php";
	theform.submit();			
}