function GetXmlHttpObject()
{
	try
	{    // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();  
		return xmlHttp;  
	}
	catch (e)
	{    // Internet Explorer    
		try
		{      
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");  
			return xmlHttp;    
		}
		catch (e)
		{      
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				return xmlHttp;
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!"+e.message);
				return false;
			}
		}
	}
}
function show_state(type,state)
{
	if(state == "US") {
		document.getElementById(type+'uk').style.display = 'none';
		document.getElementById(type+'usa').style.display = 'block';
	} else {
		document.getElementById(type+'uk').style.display = 'block';
		document.getElementById(type+'usa').style.display = 'none';
	}
}
function valid_enquiry_appoint()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = FrmEnq.txt_email.value.match(emailPat);
	if(document.FrmEnq.frm_name.value == "enquiry")
	{
		if(document.FrmEnq.txt_firstname.value == '')
		{
			alert("Please enter the first name.");
			document.FrmEnq.txt_firstname.focus();
			return false;
		}
		
		if(document.FrmEnq.txt_email.value=="")
		{
			alert("Please enter the email address");
			document.FrmEnq.txt_email.focus();
			return false;
		}
		else
		{
			if (matchArray == null)
			{
				alert ("Please enter your valid email address.");
				document.FrmEnq.txt_email.focus();
				return false;
			}
		}
		if(document.FrmEnq.txt_comment.value == '')
		{
			alert("Please enter the comment / enquiry.");
			document.FrmEnq.txt_comment.focus();
			return false;
		}
	}
	else
	{
		if(document.FrmEnq.txt_firstname.value == '')
		{
			alert("Please enter your name.");
			document.FrmEnq.txt_firstname.focus();
			return false;
		}
		if(document.FrmEnq.txt_phone.value == '')
		{
			alert("Please enter contact number.");
			document.FrmEnq.txt_phone.focus();
			return false;
		}
		if(document.FrmEnq.txt_email.value=="")
		{
			alert("Please enter the email address");
			document.FrmEnq.txt_email.focus();
			return false;
		}
		else
		{
			if (matchArray == null)
			{
				alert ("Please enter your valid email address.");
				document.FrmEnq.txt_email.focus();
				return false;
			}
		}
		if(document.FrmEnq.txt_appoint_time.value == '')
		{
			alert("Please enter preferred appointment time.");
			document.FrmEnq.txt_appoint_time.focus();
			return false;
		}
	}
}
/*if (document.layers) { // Netscape
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onmousemove = captureMousePosition;
}*/
// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page

function captureMousePosition(e) {
    if (document.layers) {
        // When the page scrolls in Netscape, the event's mouse position
        // reflects the absolute position on the screen. innerHight/Width
        // is the position from the top/left of the screen that the user is
        // looking at. pageX/YOffset is the amount that the user has 
        // scrolled into the page. So the values will be in relation to
        // each other as the total offsets into the page, no matter if
        // the user has scrolled or not.
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
		
    } else if (document.all) {
        // When the page scrolls in IE, the event's mouse position 
        // reflects the position from the top/left of the screen the 
        // user is looking at. scrollLeft/Top is the amount the user
        // has scrolled into the page. clientWidth/Height is the height/
        // width of the current page the user is looking at. So, to be
        // consistent with Netscape (above), add the scroll offsets to
        // both so we end up with an absolute value on the page, no 
        // matter if the user has scrolled or not.
        xMousePos = window.event.x;//+document.body.scrollLeft;
        yMousePos = window.event.y;//+document.body.scrollTop;
		xMousePos = xMousePos+200;
		yMousePos = yMousePos+200;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
		
    } else if (document.getElementById) {
		
        // Netscape 6 behaves the same as Netscape 4 in this regard 
        xMousePos = e.pageX+100;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
		
    }
}

function show_big_image(img_name,img_path,img_id)
{
	var div_left;
	var screenwidth			= window.screen.width;
	var screenheight		= window.screen.height;
	
	var half_screenwidth	= screenwidth/2;
	screenwidth				= half_screenwidth-275;
	screenwidth				= screenwidth+"px";
	document.getElementById('big_img_row').style.left=screenwidth;
	document.getElementById('big_img_row').style.top='200px';
	document.getElementById('big_img_row').style.display='block';
	document.getElementById('big_img').innerHTML="<img src='"+img_path+img_name+"' width='550' height='550' border=0>";
}
function hide_big_image(img_name,img_id)
{
	var div_left;
	document.getElementById('big_img_row').style.left=1;
	document.getElementById('big_img_row').style.top=1;
	document.getElementById('big_img_row').style.display='none';
}
function new_old_cust(value)
{
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="customer-type.php?type="+value;
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState == "complete")
		{
			return false;
		}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function prog_add_to_basket(frm_id,prod_status,tot_option)
{
	var prod_id,prod_code,qty,prod_price,vat_included,info;
	/*prod_id		= document.getElementById('prod_id').value;
	prod_code		= document.getElementById('prod_code').value;
	prod_size		= document.getElementById('sz').value;
	qty			= document.getElementById('qty').value;
	prod_price	= document.getElementById('prod_price').value;
	info			= document.getElementById('info').value;*/	
	prod_id		= eval("document.prod"+frm_id+".prod_id.value");
	prod_code		= eval("document.prod"+frm_id+".prod_code.value");
	prod_size		= eval("document.prod"+frm_id+".sz.value");
	qty			= eval("document.prod"+frm_id+".qty.value");
	prod_price	= eval("document.prod"+frm_id+".prod_price.value");
	info			= eval("document.prod"+frm_id+".info.value");
	
	if(tot_option == 0) {
		color_opt		= '';
	} else if (tot_option == 1) {
		color_opt		= document.getElementById('option0').value;
	} else {
		color_opt		= '';
		for(i=0;i<tot_option;i++) {
			if(document.getElementById('option'+i).checked == true) {
			color_opt	= document.getElementById('option'+i).value;
			}
		}
	}
	if(color_opt == '' && tot_option != 0) {
		alert("Please select the option");	return false;
	}
	/*
	prod_id		= eval("document.prod"+frm_id+".prod_id.value");
	prod_code	= eval("document.prod"+frm_id+".prod_code.value");
	prod_size	= eval("document.prod"+frm_id+".prod_size.value");
	qty			= eval("document.prod"+frm_id+".qty.value");
	prod_price	= eval("document.prod"+frm_id+".prod_price.value");*/
	//vat_included= eval("document.prod"+frm_id+".vat_included.value");
	if(IsNumeric_Qty(qty)==false || qty == '')
	{
		alert("Please enter the numeric quantity");
		return false;
	}
	
	if(IsNumeric(prod_id)==false)
	{
		//alert(prod_id);
		return false;
	}
	
	if(IsNumeric(prod_price)==false)
	{
		//alert(prod_price);
		return false;
	}
	
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="add_to_basket.php?prod_id="+prod_id+"&prod_code="+prod_code+"&prod_size="+prod_size+"&qty="+qty+"&prod_price="+prod_price+"&color_opt="+color_opt+"&prod_status="+prod_status+"&vat="+vat_included+"&action="+info;
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState == "complete")
		{
			if(xmlHttp.responseText == "err")
			{
				alert("You have entered the invalid input");
			}
			else
			{
				//document.getElementById('item').innerHTML = xmlHttp.responseText;
				if(info == "edit") {
					alert("Item(s) has been updated successfully...");
					//if(typeof Modalbox != 'undefined') {
						window.location.href='view-cart.php';
						//Modalbox.close();
					//}
				} else {
					alert("Item(s) has been added to your cart successfully...");
					if(typeof Modalbox != 'undefined') {
						//window.location.href='eshop.php';
						Modalbox.close();
					}
				}
			}
			prod_id			= "";
			prod_code		= "";
			qty				= "";
			prod_price		= "";
			
			if(prod_status == "add")
			{
				//eval("document.prod"+frm_id+".qty.value = '';")
			}
			return false;
		}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function add_to_basket(frm_id,prod_status,tot_option)
{
	var prod_id,prod_code,qty,prod_price,vat_included,info;
	prod_id		= document.getElementById('prod_id').value;
	prod_code		= document.getElementById('prod_code').value;
	prod_size		= document.getElementById('sz').value;
	qty			= document.getElementById('qty').value;
	prod_price	= document.getElementById('prod_price').value;
	info			= document.getElementById('info').value;
	if(tot_option == 0) {
		color_opt		= '';
	} else if (tot_option == 1) {
		color_opt		= document.getElementById('option0').value;
	} else {
		color_opt		= '';
		for(i=0;i<tot_option;i++) {
			if(document.getElementById('option'+i).checked == true) {
			color_opt	= document.getElementById('option'+i).value;
			}
		}
	}
	if(color_opt == '' && tot_option != 0) {
		alert("Please select the option");	return false;
	}
	/*
	prod_id		= eval("document.prod"+frm_id+".prod_id.value");
	prod_code	= eval("document.prod"+frm_id+".prod_code.value");
	prod_size	= eval("document.prod"+frm_id+".prod_size.value");
	qty			= eval("document.prod"+frm_id+".qty.value");
	prod_price	= eval("document.prod"+frm_id+".prod_price.value");*/
	//vat_included= eval("document.prod"+frm_id+".vat_included.value");
	if(IsNumeric_Qty(qty)==false || qty == '')
	{
		alert("Please enter the numeric quantity");
		return false;
	}
	
	if(IsNumeric(prod_id)==false)
	{
		//alert(prod_id);
		return false;
	}
	
	if(IsNumeric(prod_price)==false)
	{
		//alert(prod_price);
		return false;
	}
	
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="add_to_basket.php?prod_id="+prod_id+"&prod_code="+prod_code+"&prod_size="+prod_size+"&qty="+qty+"&prod_price="+prod_price+"&color_opt="+color_opt+"&prod_status="+prod_status+"&vat="+vat_included+"&action="+info;
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState == "complete")
		{
			if(xmlHttp.responseText == "err")
			{
				alert("You have entered the invalid input");
			}
			else
			{
				//document.getElementById('item').innerHTML = xmlHttp.responseText;
				if(info == "edit") {
					alert("Item(s) has been updated successfully...");
					//if(typeof Modalbox != 'undefined') {
						window.location.href='view-cart.php';
						//Modalbox.close();
					//}
				} else {
					alert("Item(s) has been added to your cart successfully...");
					if(typeof Modalbox != 'undefined') {
						//window.location.href='eshop.php';
						Modalbox.close();
					}
				}
			}
			prod_id			= "";
			prod_code		= "";
			qty				= "";
			prod_price		= "";
			
			if(prod_status == "add")
			{
				//eval("document.prod"+frm_id+".qty.value = '';")
			}
			return false;
		}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function IsNumeric(sText)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++) 
	{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{
			IsNumber = false;
		}
	}
	return IsNumber;
}
function IsNumeric_Qty(sText)
{
	var ValidChars = "0123456789";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++) 
	{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{
			IsNumber = false;
		}
	}
	return IsNumber;
}
function forgot_popup(URLStr)
{ 
	var left,top,width,height;
	var popUpWin1 = 0;
	left=200;
	top=100;
	width=400;
	height=200;
	popUpWin1 = open(URLStr, 'ForgotPassword', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	//return(popUpWin1);
	return false;
}
function chk_login()
{
	/*
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = login.txt_email.value.match(emailPat);
	if(document.login.txt_email.value=="")
	{
		alert("Please enter the email address");
		document.login.txt_email.focus();
		return false;
	}
	else
	{
		if (matchArray == null)
		{
			alert ("Please enter your valid email address.");
			document.login.txt_email.focus();
			return false;
		}
	}
	*/
	if(document.login.txt_username.value == "")
	{
		alert("Please enter the username");
		document.login.txt_username.focus();
		return false;
	}
	if(document.login.txt_password.value == "")
	{
		alert("Please enter the password");
		document.login.txt_password.focus();
		return false;
	}	
}
function valid_login()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = document.login.txt_email.value.match(emailPat);
	if(document.login.txt_email.value=="")
	{
		alert("Please enter the username");
		document.login.txt_email.focus();
		return false;
	}
	/*else
	{
		if (matchArray == null)
		{
			alert ("Please enter your valid email address.");
			document.login.txt_email.focus();
			return false;
		}
	}*/
	
	if(document.login.txt_password.value == "")
	{
		alert("Please enter the password");
		document.login.txt_password.focus();
		return false;
	}
	var username;
	var password;
	username		= document.login.txt_email.value;
	password		= document.login.txt_password.value;
	promocode		= document.login.txt_promocode.value;
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="login.php?username="+username+"&password="+password+"&promocode="+promocode;
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState == "complete")
		{
			//alert(xmlHttp.responseText);
			if(xmlHttp.responseText == "1")
			{
				window.location ='my_order.php';			
			}
			else
			{
				document.getElementById('loginstatus').innerHTML = "Invalid login detail...";	
				return false;
			}
		}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function order_popup(URLStr)
{ 
	var left,top,width,height;
	var popUpWin1 = 0;
	left=200;
	top=100;
	width=800;
	height=600;
	popUpWin1 = open(URLStr, 'order', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	return(popUpWin1);
}

function registration_valid()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = document.frm.txt_email.value.match(emailPat);
	//var matchArray_ship = frm.txt_s_email.value.match(emailPat);
	//var matchArray_bill = frm.txt_b_email.value.match(emailPat);
	
	if(document.frm.txt_name.value == "")
	{
		alert("Please enter the first name");
		document.frm.txt_name.focus();
		return false;
	}
	if(document.frm.txt_email.value=="")
	{
		alert("Please enter the email address");
		document.frm.txt_email.focus();
		return false;
	}
	else
	{
		if (matchArray == null)
		{
			alert ("Please enter your valid email address.");
			document.frm.txt_email.focus();
			return false;
		}
	}
	if(document.frm.txt_username.value=="")
	{
		alert("Please enter the username");
		document.frm.txt_username.focus();
		return false;
	}
	if(document.frm.txt_password.value=="")
	{
		alert("Please enter the password");
		document.frm.txt_password.focus();
		return false;
	}
		
	if(document.frm.txt_b_fname.value == "")
	{
		alert("Please enter the billing first name");
		document.frm.txt_b_fname.focus();
		return false;
	}
	if(document.frm.txt_b_lname.value == "")
	{
		alert("Please enter the billing last name");
		document.frm.txt_b_lname.focus();
		return false;
	}
	if(document.frm.txt_b_add1.value == "")
	{
		alert("Please enter the billing address1");
		document.frm.txt_b_add1.focus();
		return false;
	}
	/*if(document.frm.txt_b_add2.value == "")
	{
		alert("Please enter the billing address2");
		document.frm.txt_b_add2.focus();
		return false;
	}*/
	if(document.frm.txt_b_city.value == "")
	{
		alert("Please enter the billing city");
		document.frm.txt_b_city.focus();
		return false;
	}
	if(document.frm.txt_b_postcode.value == "")
	{
		alert("Please enter the billing postcode");
		document.frm.txt_b_postcode.focus();
		return false;
	}
	if(document.frm.txt_b_country.value == "")
	{
		alert("Please enter the billing country");
		document.frm.txt_b_country.focus();
		return false;
	}
	if(document.frm.txt_b_country.value == "US") {
	if(document.frm.us_txt_b_state.value == "")
	{
		alert("Please enter the billing state");
		document.frm.us_txt_b_state.focus();
		return false;
	}
}

	if(document.frm.txt_b_phone.value == "")
	{
		alert("Please enter the billing phone");
		document.frm.txt_b_phone.focus();
		return false;
	}
	
	if(document.frm.txt_d_fname.value == "")
	{
		alert("Please enter the delivery first name");
		document.frm.txt_d_fname.focus();
		return false;
	}
	if(document.frm.txt_d_lname.value == "")
	{
		alert("Please enter the delivery last name");
		document.frm.txt_d_lname.focus();
		return false;
	}
	if(document.frm.txt_d_add1.value == "")
	{
		alert("Please enter the delivery address1");
		document.frm.txt_d_add1.focus();
		return false;
	}
	/*if(document.frm.txt_d_add2.value == "")
	{
		alert("Please enter the delivery address2");
		document.frm.txt_d_add2.focus();
		return false;
	}*/
	if(document.frm.txt_d_city.value == "")
	{
		alert("Please enter the delivery city");
		document.frm.txt_d_city.focus();
		return false;
	}
	if(document.frm.txt_d_postcode.value == "")
	{
		alert("Please enter the delivery postcode");
		document.frm.txt_d_postcode.focus();
		return false;
	}
	if(document.frm.txt_d_country.value == "")
	{
		alert("Please enter the delivery country");
		document.frm.txt_d_country.focus();
		return false;
	}
	if(document.frm.txt_d_country.value == "US") {
	if(document.frm.us_txt_d_state.value == "")
	{
		alert("Please enter the delivery state");
		document.frm.us_txt_d_state.focus();
		return false;
	}
}
	if(document.frm.txt_d_phone.value == "")
	{
		alert("Please enter the delivery phone");
		document.frm.txt_d_phone.focus();
		return false;
	}
}

function fill_shipping_info()
{
	if(document.frm.ship.checked == true)
	{
		document.frm.txt_s_fname.value		= 	document.frm.txt_fname.value;
		document.frm.txt_s_lname.value		= 	document.frm.txt_lname.value;
		document.frm.txt_s_address.value	= 	document.frm.txt_address1.value;
		document.frm.txt_s_city.value		= 	document.frm.txt_city.value;
		document.frm.txt_s_postcode.value	= 	document.frm.txt_postcode.value;
		document.frm.txt_s_country.value	= 	document.frm.txt_country.value;
		
	}
	else
	{
		document.frm.txt_s_fname.value		= "";
		document.frm.txt_s_lname.value		= "";
		document.frm.txt_s_address.value	= "";
		document.frm.txt_s_city.value		= "";
		document.frm.txt_s_postcode.value	= "";
		document.frm.txt_s_country.value	= "";
	}
}

function fill_billing_info()
{
	if(document.frm.bill.checked == true)
	{
		document.frm.txt_b_fname.value		= 	document.frm.txt_fname.value;
		document.frm.txt_b_lname.value		= 	document.frm.txt_lname.value;
		document.frm.txt_b_address.value	= 	document.frm.txt_address1.value;
		document.frm.txt_b_city.value		= 	document.frm.txt_city.value;
		document.frm.txt_b_postcode.value	= 	document.frm.txt_postcode.value;
		document.frm.txt_b_country.value	= 	document.frm.txt_country.value;
	}
	else
	{
		document.frm.txt_b_fname.value		= "";
		document.frm.txt_b_lname.value		= "";
		document.frm.txt_b_address.value	= "";
		document.frm.txt_b_city.value		= "";
		document.frm.txt_b_postcode.value	= "";
		document.frm.txt_b_country.value	= "";
	}
}

function delivery_submit()
{
	if(document.frmdel.uk_del.checked == true)
	{
		document.frmdel.txt_uk_del.value	= "1";
	}
	else
	{
		document.frmdel.txt_uk_del.value	= "0";
	}
	document.frmdel.submit();
}
function wopen(url, name, w, h)
{
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=no');
  win.resizeTo(w, h);
  win.moveTo(wleft, wtop);
  win.focus();
}
function verifydelivery(ship_country)
{
	if(ship_country == '')
	{
		alert("Please select the country");
		return false;
	} 
	
}
function compare_delivery(ship_country,ship_compare)
{
	
	if(ship_compare != ship_country && ship_country !='')
	{
		alert("Selected country and your shipping country is different");
		window.location.href='view-cart.php';
		return false;
	} 
}
function fill_delivery_amount(country,tot_amt,tot_qty,is_exp)
{
	var deli_response_amt;
	var tot_response_amt;
	var tot_response_qty;
	if(country == '')
	{
		alert("Please select the country");
		return false;
	}
	if(document.getElementById('exp_del_type').checked == true)
	{
		is_exp			= "Y";
	}
	else
	{
		is_exp			= "N";
	}
	var response_string = Array();
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="delivery_type.php?country="+country+"&tot_amt="+tot_amt+"&tot_qty="+tot_qty+"&is_exp="+is_exp;
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState == "complete")
		{
			response_string		= xmlHttp.responseText.split("==");
			response_string1	= response_string[0].split("---");
			response_string2	= response_string[1].split("Rahul");
			if(is_exp == 'N')
			{
				document.getElementById('exp_del_type').checked = false;	
			}
			else
			{
				document.getElementById('exp_del_type').checked = true;	
			}
			if(parseFloat(response_string2[1])>0)
			{
				document.getElementById('exp_del_type').value = response_string2[1];
				document.getElementById('div_exp_del_type').style.visibility = 'visible';
			}
			else
			{
				document.getElementById('exp_del_type').value = 0;
				document.getElementById('div_exp_del_type').style.visibility = 'hidden';
			}
			document.getElementById('deli_amt').innerHTML = "&pound;"+response_string1[1];
			document.getElementById('tot_amt').innerHTML = "&pound; "+response_string1[0];
		}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}
function show_big_image(img_name)
{
	var div_left;
	document.getElementById('big_img').style.left=xMousePos;
	document.getElementById('big_img').style.top=yMousePos;
	document.getElementById('big_img').style.display='block';
	document.getElementById('big_img').innerHTML="<img src='dynamicdata/prod_images/"+img_name+"' width='250' height='250'>";
}
function hide_big_image()
{
	var div_left;
	document.getElementById('big_img').style.left=1;
	document.getElementById('big_img').style.top=1;
	document.getElementById('big_img').style.display='none';
}
function fill_del_info(check_value)
{
	if(check_value == true)
	{
		document.getElementById('txt_d_fname').value = 	document.getElementById('txt_b_fname').value;
		document.getElementById('txt_d_lname').value = 	document.getElementById('txt_b_lname').value;
		document.getElementById('txt_d_add1').value = 	document.getElementById('txt_b_add1').value;
		document.getElementById('txt_d_add2').value = 	document.getElementById('txt_b_add2').value;
		document.getElementById('txt_d_city').value = 	document.getElementById('txt_b_city').value;
		document.getElementById('txt_d_postcode').value = 	document.getElementById('txt_b_postcode').value;
		document.getElementById('txt_d_country').value = 	document.getElementById('txt_b_country').value;
		if(document.getElementById('txt_b_country').value == 'US') {
			document.getElementById('us_txt_d_state').value = 	document.getElementById('us_txt_b_state').value;
			document.getElementById('duk').style.display = 'none';
			document.getElementById('dusa').style.display = 'block';
		} else {
			document.getElementById('txt_d_state').value = 	document.getElementById('txt_b_state').value;
			document.getElementById('duk').style.display = 'block';
			document.getElementById('dusa').style.display = 'none';
		}
		
		document.getElementById('txt_d_phone').value = 	document.getElementById('txt_b_phone').value;
	}
	else
	{
		document.getElementById('txt_d_fname').value = "";
		document.getElementById('txt_d_lname').value = "";
		document.getElementById('txt_d_add1').value = ""
		document.getElementById('txt_d_add2').value = "";
		document.getElementById('txt_d_city').value = "";
		document.getElementById('txt_d_country').value = "";
		document.getElementById('txt_d_state').value = "";
		document.getElementById('us_txt_d_state').value = "";
		document.getElementById('txt_d_postcode').value = "";
		document.getElementById('txt_d_phone').value = "";
	}
}

function que_validation1()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = document.frm.txt_email.value.match(emailPat);
	if(document.frm.txt_fname.value == "")
	{
		alert("Please enter the first name");
		document.frm.txt_fname.focus();
		return false;
	}
	if(document.frm.txt_dt.value == "")
	{
		alert("Please enter the date");
		document.frm.txt_dt.focus();
		return false;
	}
	if(document.frm.txt_address.value == "")
	{
		alert("Please enter the address");
		document.frm.txt_address.focus();
		return false;
	}
	if(document.frm.txt_day_phone.value == "")
	{
		alert("Please enter the daytime tel no.");
		document.frm.txt_day_phone.focus();
		return false;
	}
	if(document.frm.txt_email.value=="")
	{
		alert("Please enter the email address");
		document.frm.txt_email.focus();
		return false;
	}
	else
	{
		if (matchArray == null)
		{
			alert ("Please enter your valid email address.");
			document.frm.txt_email.focus();
			return false;
		}
	}
	if(document.frm.txt_analyse.value == "")
	{
		alert("Please select have you been analysed by us in the past?");
		document.frm.txt_analyse.focus();
		return false;
	}
	
}
