// JavaScript Document
/////////////////////////////////////
function test(){

      $("#windowtable").toggle("slow");  

		}

/////////////////////////////////////
$(document).ready(function(){
	$("#SubmitNames").click(function(){
									 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i ;
	var subnames=document.getElementById('subnames').value;
	var subEmails=document.getElementById('subEmails').value;
	if(subnames ==''){	
	alert('Enter your name');
	document.getElementById('subnames').focus();
	return false;
	}
	if(subEmails ==''){
	alert('Enter your Emailid');
	document.getElementById('subEmails').focus();
	return false;
	}else if(!filter.test(subEmails)){
	alert($('#subEmails').val() + ' is invalid'); 
	$('#subEmails').focus();
	return false;
	}
	$("#SubmitNames").hide();
	document.getElementById('loaders').innerHTML='Loading - Please wait...';
	window.top.emailValue(subnames,subEmails);
	return false;
	});
	$("a.zoom").fancybox({
					'overlayOpacity'	:	0.7,
					'overlayColor'		:	'#FFFFFF',
					'frameWidth'		:	340,
					'frameHeight'		:	180,
					'padding'           :   0,
					'hideOnContentClick':  false
	});
$.ajax({
	type :"POST",
	url:"display.php",
	dataType:"html",
	data:"loadpage=1",
	 success:function(response){
	 var str=response;

	document.getElementById('display').innerHTML=str;
	var tes=document.getElementById('item').value;
if(tes >='1'){
document.getElementById('windowtable').style.display='block';
}
	// window.location.reload(true);
		} 
		});	
	});

//////////////////////////////////////////////////
$(document).ready(function(){

document.getElementById('display').style.visibility='visible';
$("#submitone").click(function(){
var id=document.getElementById('shopone').value;
//alert('test');
$.ajax({
	type :"POST",
	url:"display.php",
	dataType:"html",
	data:"id="+id,
	 success:function(response){
	 var str=response;
	document.getElementById('display').innerHTML=str;
	var tes=document.getElementById('item').value;
if(tes >='1'){
document.getElementById('windowtable').style.display='block';
}
	// window.location.reload(true);
		} 
		});	
	});
	$("#submittwo").click(function(){
var id=document.getElementById('shoptwo').value;

$.ajax({
	type :"POST",
	url:"display.php",
	dataType:"html",
	data:"id="+id,
	 success:function(response){
	 var str=response;
	document.getElementById('display').innerHTML=str;
	var tes=document.getElementById('item').value;
if(tes >='1'){
document.getElementById('windowtable').style.display='block';
}
	// window.location.reload(true);
		} 
		});	
	});
	$("#submitthree").click(function(){
var id=document.getElementById('shopthree').value;
$.ajax({
	type :"POST",
	url:"display.php",
	dataType:"html",
	data:"id="+id,
	 success:function(response){
	 var str=response;
	document.getElementById('display').innerHTML=str;
	var tes=document.getElementById('item').value;
if(tes >='1'){
document.getElementById('windowtable').style.display='block';
}
	// window.location.reload(true);
		} 
		});	
	});
$("#submit").click(function(){
var id=document.getElementById('shop').value;
$.ajax({
	type :"POST",
	url:"display.php",
	dataType:"html",
	data:"id="+id,
	 success:function(response){
	 var str=response;
	document.getElementById('display').innerHTML=str;
	var tes=document.getElementById('item').value;
if(tes >='1'){
document.getElementById('windowtable').style.display='block';
}
	// window.location.reload(true);
		} 
		});	
	});


$("#buyNowone").click(function(){
	var id=document.getElementById('shop').value;
	var message='';
	var total='';
	if(id=="1 Month Supply"){
	message="NEW DIAMOND WHITENING PILL 1 Month Supply - 38.00 GBP";
	total ="38.00";
	}else if(id=="3 Month Supply"){
	message="NEW DIAMOND WHITENING PILL 3 Month Supply - 81.00 GBP";
	total ="81.00";
	}else if(id=="6 Month Supply"){
	message="NEW DIAMOND WHITENING PILL 6 Month Supply - 142.00 GBP";
	total ="142.00";
	}else if(id=="12 Month Supply"){
	message="NEW DIAMOND WHITENING PILL 12 Month Supply - 252.00 GBP";
	total ="252.00";
	}
	$("#orderid").attr("value",message);
	$("#total").attr("value",total);
	$("#checkoutformone").submit();
	});
$("#buyNowtwo").click(function(){
	var id=document.getElementById('shop').value;
	var message='';
	var total='';
	if(id=="1 Month Supply crystal"){
	message="1 Month Supply crystal - 58.00 GBP";
	total ="58.00";
	}else if(id=="2 Month Supply crystal"){
	message="2 Month Supply crystal - 99.00 GBP";
	total ="99.00";
	}else if(id=="3 Month Supply crystal"){
	message="3 Month Supply crystal - 150.00 GBP";
	total ="150.00";
	}else if(id=="6 Month Supply crystal"){
	message="6 Month Supply crystal - 270.00 GBP";
	total ="270.00";
	}
	$("#orderid").attr("value",message);
	$("#total").attr("value",total);
	$("#checkoutformtwo").submit();
	});

	});
	//////////////////////////////////////////////////
	//////////////////////////////////////////////////


function country(){
document.getElementById('display_form').style.display='none';
document.getElementById('moneybookers').style.display='none';
var id=document.getElementById('country').value;
if(id =='select'){
alert('Select Country');
return false;
}
$.ajax({
	type :"POST",
	url:"display.php",
	dataType:"html",
	data:"country="+id,
	 success:function(response){	 
	 var str=response;
	document.getElementById('display').innerHTML=str;
	var tes=document.getElementById('item').value;
if(tes >='1'){
document.getElementById('windowtable').style.display='block';
}
	// window.location.reload(true);
		} 
		});	
		
		}
//////////////////////////////////////////////////
	
function submitform(str){
var id=document.getElementById('country').value;
var ite=document.getElementById('item').value;
if(ite =='0'){
alert('Add Cards Items');
return false;
}
if(id =='select'){
alert('Select Delivery Country');
return false;
}
if(str =='google'){
document.BB_BuyButtonForm.submit();
}else{
	//document.checkout_confirmation.submit();
	}
//$("a.zoom").trigger('click');

return false;
	}
//////////////////////////////////////////////////
//////////////////////////////////////////////////
	
	function removed(str){	
	$.ajax({
	type :"POST",
	url:"display.php",
	dataType:"html",
	data:"s="+str,
	 success:function(response){
	 var str=response;
	document.getElementById('display').innerHTML=str;
	var tes=document.getElementById('item').value;
if(tes >='1'){
document.getElementById('windowtable').style.display='block';
}
	// window.location.reload(true);
		} 
		});	
	}
emailValue =function(names,Emails){
	
document.getElementById('BB_BuyButtonForm').style.display='none';

$.ajax({
	type :"POST",
	url:"Emails.php",
	dataType:"html",
	data:"name="+names+"&Emailids="+Emails,
	 success:function(response){	 
	 var str=response;	
	 if(str=='1'){
	document.BB_BuyButtonForm.submit();
		}else{
			document.getElementById('BB_BuyButtonForm').style.display='block';
			}
		} 
		});	

	}
	function submitforms(Typeform){
		
		var id=document.getElementById('country').value;
var ite=document.getElementById('item').value;
if(ite =='0'){
alert('Add Cards Items');
return false;
}
if(id =='select'){
alert('Select Delivery Country');
return false;
}

							
$.ajax({
	type :"POST",
	url:"Emails.php",
	dataType:"html",
	data:"",
	 success:function(response){	 
	 var str=response;	
	// alert(str);
	 if(str=='1'){
		 //alert(Typeform);
		 if(Typeform =='1'){
	document.BB_BuyButtonForm.submit();
		 }else{
			 document.moneybookersForm.submit();
			 }
		}else{
			document.getElementById('BB_BuyButtonForm').style.display='block';
			document.getElementById('moneybookersForm').style.display='block';
			}
		} 
		});	


		}