// JavaScript Document
 //window.moveBy(600,600);
// window.outerHeight = 700;
// window window.outerWidth=600; 
//window.resizeTo(790,600); 
 

ns = (document.layers)?true:false;
ie = (document.all)?true:false;
dom = (document.getElementById)?true:false;
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) { 
		header2_02_over = newImage("images/header2_02-over.gif");
		header2_04_over = newImage("images/header2_04-over.gif");
		header2_06_over = newImage("images/header2_06-over.gif");
		preloadFlag = true;
	}
}
 <!---policy start-->
 function preloadImages() {
	if (document.images) {
		policy_menus_01_over = newImage("images/policy_menus_01-over.gif");
		policy_menus_03_over = newImage("images/policy_menus_03-over.gif");
		policy_menus_05_over = newImage("images/policy_menus_05-over.gif");		
		preloadFlag = true;
	}
}
 <!---policy end-->
 function preloadImages() {
	if (document.images) {
		receipe_menus_01_over = newImage("images/receipe_menus_01-over.gif");
		receipe_menus_03_over = newImage("images/receipe_menus_03-over.gif");
		receipe_menus_05_over = newImage("images/receipe_menus_05-over.gif");
		receipe_menus_07_over = newImage("images/receipe_menus_07-over.gif");
		receipe_menus_09_over = newImage("images/receipe_menus_09-over.gif");
		preloadFlag = true;
	}
}
 
 
function preloadImages() {
	if (document.images) {
		leftmenu_03_over = newImage("images/leftmenu_03-over.gif");
		leftmenu_05_over = newImage("images/leftmenu_05-over.gif");
		leftmenu_07_over = newImage("images/leftmenu_07-over.gif");
		leftmenu_09_over = newImage("images/leftmenu_09-over.gif");
		leftmenu_11_over = newImage("images/leftmenu_11-over.gif");
		leftmenu_13_over = newImage("images/leftmenu_13-over.gif");
		leftmenu_15_over = newImage("images/leftmenu_15-over.gif");
		leftmenu_17_over = newImage("images/leftmenu_17-over.gif");
		leftmenu_19_over = newImage("images/leftmenu_19-over.gif");
		preloadFlag = true;
	}
	function hideLayer(id){
if (dom) {
		// getElementByID supported.
		if (document.getElementById(id) != null)
			document.getElementById(id).style.visibility = 'hidden';
	}else if (ns){
		//Netscape 
		if (document.layers[id] != null)
			document.layers[id].visibility='hidden';
	} else if (ie){
		// Older Internet Explorer
		if (document.all[id] != null)
			document.all[id].style.visibility = 'hidden';
	}
	var obj = document.getElementById(id);
	if (obj != null)
		obj.style.display = "none";
}
function showLayer(id){
	if (dom) {
		// getElementByID supported.
		if (document.getElementById(id) != null)
			document.getElementById(id).style.visibility = 'visible';
	}else if (ns){
		//Netscape 
		if (document.layers[id] != null)
			document.layers[id].visibility='show';
	} else if (ie){
		// Older Internet Explorer
		if (document.all[id] != null)
			document.all[id].style.visibility = 'visible';
	} 
	var obj = document.getElementById(id);
	if (obj != null)
		obj.style.display = "block";
}
}
function hideLayer(id){
if (dom) {
		// getElementByID supported.
		if (document.getElementById(id) != null)
			document.getElementById(id).style.visibility = 'hidden';
	}else if (ns){
		//Netscape 
		if (document.layers[id] != null)
			document.layers[id].visibility='hidden';
	} else if (ie){
		// Older Internet Explorer
		if (document.all[id] != null)
			document.all[id].style.visibility = 'hidden';
	}
	var obj = document.getElementById(id);
	if (obj != null)
		obj.style.display = "none";
}
function showLayer(id){
	if (dom) {
		// getElementByID supported.
		if (document.getElementById(id) != null)
			document.getElementById(id).style.visibility = 'visible';
	}else if (ns){
		//Netscape 
		if (document.layers[id] != null)
			document.layers[id].visibility='show';
	} else if (ie){
		// Older Internet Explorer
		if (document.all[id] != null)
			document.all[id].style.visibility = 'visible';
	} 
	var obj = document.getElementById(id);
	if (obj != null)
		obj.style.display = "block";
}

function copyDetails()
{
	if(document.orderForm.shipping_billing.checked)
	{
		document.orderForm.shipFirstname.value=document.orderForm.firstName.value;
		document.orderForm.shipLastname.value=document.orderForm.lastName.value;
		document.orderForm.shipAddress.value=document.orderForm.Address.value;
		document.orderForm.shipAddress2.value=document.orderForm.Address2.value;
		document.orderForm.shipState.value=document.orderForm.state.value;
		document.orderForm.shipCity.value=document.orderForm.City.value;
		document.orderForm.shipZipcode.value=document.orderForm.zipCode.value;
		document.orderForm.shipPhone.value=document.orderForm.Phone.value;
        document.orderForm.shipFirstname.readOnly=true;
		document.orderForm.shipLastname.readOnly=true;
		document.orderForm.shipAddress.readOnly=true;
		document.orderForm.shipAddress2.readOnly=true;
		document.orderForm.shipCity.readOnly=true;
		document.orderForm.shipState.readOnly=true;
		document.orderForm.shipZipcode.readOnly=true;
		document.orderForm.shipPhone.readOnly=true;
        
		
	}
	 else{
		document.orderForm.shipFirstname.value="";
		document.orderForm.shipLastname.value= "";
		document.orderForm.shipAddress.value= "";
		document.orderForm.shipAddress2.value= "";
		document.orderForm.shipState.value= "";
		document.orderForm.shipCity.value= "";
		document.orderForm.shipZipcode.value= "";
		document.orderForm.shipPhone.value= "";
        document.orderForm.shipFirstname.readOnly=false;
		document.orderForm.shipLastname.readOnly=false;
		document.orderForm.shipAddress.readOnly=false;
		document.orderForm.shipAddress2.readOnly=false;
		document.orderForm.shipCity.readOnly=false;
		document.orderForm.shipState.readOnly=false;
		document.orderForm.shipZipcode.readOnly=false;
		document.orderForm.shipPhone.readOnly=false;
	 }
	
}
 

function chkitemqty()
		{
			
		 var item1qty = document.orderForm.item1.value;
		 var item2qty = document.orderForm.item2.value;
		 var item3qty = document.orderForm.item3.value;
		 var item4qty = document.orderForm.item4.value;
		 var qty1     = document.orderForm.Qty1.value;
		 var qty2     = document.orderForm.Qty2.value;
		 var qty3     = document.orderForm.Qty3.value;
		 var qty4     = document.orderForm.Qty4.value;
		 var chkbox   = document.orderForm.samplePack.checked;

	if(chkbox==true){
		 
		if (((!(item1qty=="No first item") && !(item1qty=="No first Item")) && (qty1=="")) || ((!(item2qty=="No second item") && !(item2qty=="No second Item")) && (qty2=="")) || ((!(item3qty=="No third item") && !(item3qty=="No third Item")) && (qty3=="")) || ((!(item4qty== "No fourth item") && !(item4qty=="No fourth Item")) && (qty4=="")))
		{
			alert("Enter a value in quantity field");
			return false;
		}
		else if ((((item1qty=="No first item") || (item1qty=="No first Item")) && !(qty1=="")) || (((item2qty=="No second item") || (item2qty=="No second Item")) && !(qty2=="")) || (((item3qty=="No third item") || (item3qty=="No third Item")) && !(qty3=="")) || (((item4qty== "No fourth item") || (item4qty=="No fourth Item")) && !(qty4=="")))
		{
			alert("Kindly select the appropriate value from the list");
			return false;
		}		
	}
	else if(chkbox != true){
		if((((item1qty=="No first item") || (item1qty=="No first Item")) && (qty1=="")) && (((item2qty=="No second item") || (item2qty=="No second Item")) && (qty2=="")) && (((item3qty=="No third item") || (item3qty=="No third Item")) && (qty3=="")) && (((item4qty== "No fourth item") || (item4qty=="No fourth Item")) && (qty4=="")) && (chkbox==false))
		{
			alert("Kindly select normal or the sample pack");
			return false;
		}
		else if (((!(item1qty=="No first item") && !(item1qty=="No first Item")) && (qty1=="")) || ((!(item2qty=="No second item") && !(item2qty=="No second Item")) && (qty2=="")) || ((!(item3qty=="No third item") && !(item3qty=="No third Item")) && (qty3=="")) || ((!(item4qty== "No fourth item") && !(item4qty=="No fourth Item")) && (qty4=="")))
		{
			alert("Enter a value in quantity field");
			return false;
		}
		else if ((((item1qty=="No first item") || (item1qty=="No first Item")) && !(qty1=="")) || (((item2qty=="No second item") || (item2qty=="No second Item")) && !(qty2=="")) || (((item3qty=="No third item") || (item3qty=="No third Item")) && !(qty3=="")) || (((item4qty== "No fourth item") || (item4qty=="No fourth Item")) && !(qty4=="")))
		{
			alert("Kindly select the appropriate value from the list");
			return false;
		}
	}
	
	return true;
}
																					 
																					 
					
			/*else if((((item1qty!="No first item")||(item1qty!="No third Item"))&&(qty1==""))||(((item2qty!=
																								   "No seconditem")||(item2qty!="No third Item"))&&(qty2==""))||(((item3qty!="No third item")||(item3qty!="No third Item"))&&(qty3==""))||(((item4qty!=
																								   
																								   "No fourth item")||(item4qty!="No third Item"))&&(qty4=="")))
			{
				alert("Enter a value in the quantity field");				  
				return false;
			}
		 */
	 
/*function disableItems()
{
	if(document.orderForm.samplePack.checked)
	{
		document.orderForm.item1.disabled=true;
		document.orderForm.item2.disabled=true;
		document.orderForm.item3.disabled=true;
		document.orderForm.item4.disabled=true;
		document.orderForm.Qty1.disabled=true;
		document.orderForm.Qty2.disabled=true;
		document.orderForm.Qty3.disabled=true;
		document.orderForm.Qty4.disabled=true;
		
		/* clearing all Quantity values  
		document.orderForm.Qty1.value="";
		document.orderForm.Qty2.value="";
		document.orderForm.Qty3.value="";
		document.orderForm.Qty4.value="";
		
		
	}
	else
	{
	 	document.orderForm.item1.disabled=false;
		document.orderForm.item2.disabled=false;
		document.orderForm.item3.disabled=false;
		document.orderForm.item4.disabled=false;
		document.orderForm.Qty1.disabled=false;
		document.orderForm.Qty2.disabled=false;
		document.orderForm.Qty3.disabled=false;
		document.orderForm.Qty4.disabled=false;
	}
}*/

/* Function to print the page */
function printWindow()
{
  bV = parseInt(navigator.appVersion);
  if (bV >= 4)
  {
    window.print();
  }
}
<!-- flash popup window -->
 function openNew()
      { 
	        window.open('orderdescription.html', 'Orderdescription', 'resizable=no, height=200, width=200');
      }
	  
	  function openwindow()
		{
		window.open("https://www.marylandcrabcakes.net/order_crab_cakes_online.php","WinC", "toolbar=yes,location=yes,directories=no, status=no,menubar=yes,scrollbars=yes,resizable=yes, copyhistory=no,width=700,height=425")
		}


	function chkccnumber()
		{
		   var drp = document.orderForm.ccType.selectedIndex;
		   var numlen = document.orderForm.ccNumber.value.length;
		 
		   if((drp==0)&&(numlen!=16)) 
		   {
				alert("Enter 16 digits for VISA (1234-1234-1234-1234)");
				 
				return false;
		   }
			if((drp==1)&&(numlen!=16)) 
			{
				alert("Enter 16 digits for MC (1234-1234-1234-1234)");
				 
				return false;
			}
			if((drp==2)&&(numlen!=15))
			{
				alert("Enter 15 digits for AMEX (1234-1234-1234-123)");	
				 
				  return false;
			}
			if((drp==3)&&(numlen!=16))
			{
				alert("Enter 16 digits for DISCOVER (1234-1234-1234-1234)");	
				  
				  return false;
			}
			return true;
		}
		
 

function Validate()
	{
	    name=new Array("firstName","lastName","Address","","City","","zipCode","Phone","Email","","shipFirstname","shipLastname", "shipAddress","","shipCity","","shipZipcode","shipPhone","","","ccNumber","ccExp","ccName")
		/*firstName lastName Address Address2 City zipCode Phone Email shipFirstname shipLastname shipAddress shipAddress2 shipCity
		shipZipcode shipPhone ccNumber ccExp ccName Qty1 Qty2 Qty3 Qty4*/
		
			var n=23;
       //  alert(document.orderForm.elements[0].name);
		 for (var i=0;i<n;i++)
		 {	
			if(i==3){i=4} 
			if (i==5){i=6}
			if (i==9){i=10}
			if (i==13){i=14}
			if (i==15){i=16}
			if (i==18){i=20}
			
			if ((document.orderForm.elements[i].value) == "")
			{
				alert("* All compulsory fields must be entered to get order.");
				document.orderForm.elements[i].focus();
				return false;
			}
		 }
	 
			   if(document.orderForm.firstName)
				 {
					var x=document.orderForm.firstName.value;
				   var filter  = /^([a-zA-Z\s])+$/;
				   if (!(filter.test(x)))
				    {
				      //alert('Enter only Alphabets(a-z A-Z) in '+document.orderForm.firstName.name);
					  alert('Enter only Alphabets(a-z A-Z) in FirstName');
				      return false;
				    }
				  } 
			   if(document.orderForm.lastName)
				 {
					var x=document.orderForm.lastName.value;
				   var filter  = /^([a-zA-Z\s])+$/;
				   if (!(filter.test(x)))
				    {
				     // alert('Enter only Alphabets(a-z A-Z) in '+document.orderForm.lastName.name);
					 alert('Enter only Alphabets(a-z A-Z) in LastName');
				      return false;
				    }
				  } 
			  /* if(document.orderForm.Address)
				 {
					var x=document.orderForm.Address.value;
				   var filter  = /^([a-zA-Z0-9\,\s])+$/;
				   if (!(filter.test(x)))
				    {
				      alert('NO! Incorrect Address'+document.orderForm.Address.name);
				      return false;
				    }
				  } 
			   if(document.orderForm.Address2)
				 {
					var x=document.orderForm.Address2.value;
				   var filter  = /^([a-zA-Z0-9\,\s])+$/;
				   if (!(filter.test(x)))
				    {
				      alert('NO! Incorrect Address1'+document.orderForm.Address2.name);
				      return false;
				    }
				  } */
			  if(document.orderForm.City)
				 {
					var x=document.orderForm.City.value;
				   var filter  = /^([a-zA-Z\s\-\.\'])+$/;
				   if (!(filter.test(x)))
				    {
				     // alert('Enter only Alphabets(a-z A-Z) in '+document.orderForm.city.name);
					 alert('Enter only Alphabets(a-z A-Z) in City');
				      return false;
				    }
				  } 
			 if(document.orderForm.phone)
				 {
				   var x = document.orderForm.phone.value;
				   var filter  = /^([0-9\-])+$/;
				   if (!(filter.test(x)))
				    {
				      //alert('Enter only  Numericals(0-9) in '+document.orderForm.phone.name);
					   alert('Enter only  Numericals(0-9) in Phone');
				      return false;
				    }
				  }
				   if(document.orderForm.zipCode)
				 {
				   var x = document.orderForm.zipCode.value;
				   var filter  = /^([0-9\-])+$/;
				   if (!(filter.test(x)))
				    {
				      alert('Enter only  Numericals(0-9) in Zipcode');
				      return false;
				    }
				  }
			  if(document.orderForm.Email) 
			   {
				 var x= document.orderForm.Email.value;
	 			 var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
				 if (!(filter.test(x)))
				 {
				   alert('NO! Incorrect email address');
				   return false;
				 }
			   }
				  
			   if(document.orderForm.shipFirstname)
				 {
				   var x=document.orderForm.shipFirstname.value;
				   var filter  = /^([a-zA-Z\s])+$/;
				   if (!(filter.test(x)))
				    {
				     // alert('Enter only Alphabets(a-z A-Z) in '+document.orderForm.shipFirstname.name);
					    alert('Enter only Alphabets(a-z A-Z) in Ship FirstName');
				      return false;
				    }
				  } 
			   if(document.orderForm.shipLastname)
				 {
				   var x=document.orderForm.shipLastname.value;
				   var filter  = /^([a-zA-Z\s])+$/;
				   if (!(filter.test(x)))
				    {
				      //alert('Enter only Alphabets(a-z A-Z) in '+document.orderForm.shipLastname.name);
					   alert('Enter only Alphabets(a-z A-Z) in Ship LastName');
				      return false;
				    }
				  } 
			  /*   if(document.orderForm.shipAddress)
				 {
				   var x=document.orderForm.shipAddress.value;
				   var filter  = /^([a-zA-Z0-9\,\s])+$/;
				   if (!(filter.test(x)))
				    {
				      alert('NO! Incorrect Address'+document.orderForm.shipAddress.name);
				      return false;
				    }
				  } 
			if(document.orderForm.shipAddress2)
				 {
				   var x=document.orderForm.shipAddress2.value;
				   var filter  = /^([a-zA-Z0-9\,\s])+$/;
				   if (!(filter.test(x)))
				    {
				      alert('NO! Incorrect Address'+document.orderForm.shipAddress2.name);
				      return false;
				    }
				  } */
			  if(document.orderForm.shipCity)
				 {
				   var x=document.orderForm.shipCity.value;
				   var filter  = /^([a-zA-Z\s\-\.\'])+$/;
				   if (!(filter.test(x)))
				    {
				      alert('Enter only Alphabets(a-z A-Z) in Ship City');
				      return false;
				    }
				  } 
			  if(document.orderForm.shipPhone)
				 {
				   var x = document.orderForm.shipPhone.value;
				   var filter  = /^([0-9\-])+$/;
				   if (!(filter.test(x)))
				    {
				     // alert('Enter only  Numericals(0-9) in '+document.orderForm.shipPhone.name);
					   alert('Enter only  Numericals(0-9) in Ship Phone');
				      return false;
				    }
				  }
				if(document.orderForm.zipcode)
				 {
				   var x = document.orderForm.zipcode.value;
				   var filter  = /^([0-9\-])+$/;
				   if (!(filter.test(x)))
				    {
				      alert('Enter only  Numericals(0-9) in Ship Zipcode');
				      return false;
				    }
				  }
			  if(document.orderForm.ccNumber)
				 {
				   var x = document.orderForm.ccNumber.value;
				   var filter  = /^([0-9])+$/;
				   if (!(filter.test(x)))
				    {
				      //alert('Enter only  Numericals(0-9) in '+document.orderForm.ccNumber.name);
					   alert('Enter only  Numericals(0-9) in CreditCard Number');
				      return false;
				    }
				  }
			var check=chkccnumber();
			if(check == false)
			{
				return false;
			}
			
			if(document.orderForm.ccExp)
				 {
				   var x = document.orderForm.ccExp.value;
				   var filter  = /^([0-9]{2}\/[0-9]{2})+$/;
				   if (!(filter.test(x)))
				    {
				      //alert('Enter in this format(mm/yy) and in '+document.orderForm.ccExp.name);
					   alert('Enter in this format(mm/yy) in CreditCard Expiration Date');
				      return false;
				    }
				  }
			  if(document.orderForm.ccName)
				 {
					var x=document.orderForm.ccName.value;
				   var filter  = /^([a-zA-Z\s])+$/;
				   if (!(filter.test(x)))
				    {
				      //alert('Enter only Alphabets(a-z A-Z) in '+document.orderForm.ccName.name);
					  alert('Enter only Alphabets(a-z A-Z) in CreditCard Name');
				      return false;
				    }
				  } 
				    if(document.orderForm.Qty1)
				   {
				    str = document.orderForm.Qty1.value;
					if (isNaN(str))
					{
					 alert ("Please use only numbers")
					 return false; 
				    }
				   }

				  if(document.orderForm.Qty2)
				   {
				    str = document.orderForm.Qty2.value;
					if (isNaN(str))
					{
					 alert ("Please use only numbers")
					 return false; 
				    }
				   }
					
				  if(document.orderForm.Qty3)
				   {
				    str = document.orderForm.Qty3.value;
					if (isNaN(str))
					{
					 alert ("Please use only numbers")
					 return false; 
				    }
				   }
					
				  if(document.orderForm.Qty4)
				   {
				    str = document.orderForm.Qty4.value;
					if (isNaN(str))
					{
					 alert ("Please use only numbers")
					 return false; 
					}
				   } 
				  
			
           var checkitemqty = chkitemqty();
			if(checkitemqty == false)
			{
				return false;
			}

		return true;		
	}		
 
	