/*   Code for loading location div contents   */

function changeDivOutlet(){
	var select_cmb = document.getElementById('cmbOutlet').value;
	switch (select_cmb)
	{
		case "1":
			document.getElementById('outletName').innerHTML = 'Bannerghatta Road';
			document.getElementById('outletLoca').innerHTML = 'Opposite to Gopalan Mall';
  			break;
		case "2":
			document.getElementById('outletName').innerHTML = 'Cunningham Road';
			document.getElementById('outletLoca').innerHTML = 'Next to Food World';
  			break;
		case "3":
			document.getElementById('outletName').innerHTML = 'HRBR Layout';
			document.getElementById('outletLoca').innerHTML = 'Horamavu Junction';
 			break;
		case "4":
			document.getElementById('outletName').innerHTML = 'Koramangala';
			document.getElementById('outletLoca').innerHTML = 'Koramangala 7th Block';
 			break;
		case "5":
			document.getElementById('outletName').innerHTML = 'Marathahalli';
			document.getElementById('outletLoca').innerHTML = 'Adjacent to Ezone Club';
 			break;
		case "6":
			document.getElementById('outletName').innerHTML = 'Sarjapur Road';
			document.getElementById('outletLoca').innerHTML = 'Behind Springfield Apartment';
 			break;
 		case "7":
			document.getElementById('outletName').innerHTML = 'R T Nagar';
			document.getElementById('outletLoca').innerHTML = 'Next to Pizza Hut';
 			break;
  		case "8":
            		document.getElementById('outletName').innerHTML = 'Indira Nagar';
            		document.getElementById('outletLoca').innerHTML = 'No 29/1, ground floor, cmh road';
           		break;
        	case "9":
            		document.getElementById('outletName').innerHTML = 'Mathikere';
            		document.getElementById('outletLoca').innerHTML = 'Mathikere main Road, Next to Subbiah Hospital';
            		break;
		default:
			document.getElementById('outletName').innerHTML = 'Bannerghatta Road';
			document.getElementById('outletLoca').innerHTML = 'Opposite to Gopalan Mall';
	}
	/*document.getElementById('climage').src = imgPath;*/
}

/*   Code for loading maps div contents   */
function changeDivMap(mapName,titleTxt)
{
    var div_load = false;
	if (window.XMLHttpRequest) 
		div_load = new XMLHttpRequest();
	else if (window.ActiveXObject)
	{ 
		try 
		{
			div_load = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e)
		{
			try
			{
				div_load = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{}
		}
	}
	else
		return false;
	div_load.onreadystatechange=function()
	{
	    load_map(div_load);
	    document.getElementById('outletsText').innerHTML = titleTxt;
	}
	div_load.open('GET', mapName, true);
	div_load.send(null);
}

function load_map(div_load){
	if (div_load.readyState == 4 && (div_load.status==200 || window.location.href.indexOf("http")==-1))
		document.getElementById('ouletMap').innerHTML=div_load.responseText;
}


function calCharge(item_price,item_no)
{
	var item_cnt = document.getElementById('item'+item_no);
	var total_item = document.getElementById('total_item'+item_no);
	var price = parseFloat(item_cnt.value);
	total_item.value = price*item_price;
	caltotal();		
}

function caltotal()
{
	 var grand_total = document.getElementById('grand_total');
	 var sum = 0;
	 
	 var total_item1 = document.getElementById('total_item1').value - 0;
	 var total_item2 = document.getElementById('total_item2').value - 0;
	 var total_item3 = document.getElementById('total_item3').value - 0;
	 var total_item4 = document.getElementById('total_item4').value - 0;
	 var total_item5 = document.getElementById('total_item5').value - 0;
	 var total_item6 = document.getElementById('total_item6').value - 0;
	 var total_item7 = document.getElementById('total_item7').value - 0;
	 var total_item8 = document.getElementById('total_item8').value - 0;
	 var total_item9 = document.getElementById('total_item9').value - 0;
	 var total_item10 = document.getElementById('total_item10').value - 0;
	 var total_item11 = document.getElementById('total_item11').value - 0;
	 var total_item12 = document.getElementById('total_item12').value - 0;
	 var total_item13 = document.getElementById('total_item13').value - 0;
	 var total_item14 = document.getElementById('total_item14').value - 0;
	 var total_item15 = document.getElementById('total_item15').value - 0;	 
	 var total_item16 = document.getElementById('total_item16').value - 0;
	 var total_item17 = document.getElementById('total_item17').value - 0;
	 var total_item18 = document.getElementById('total_item18').value - 0;
	 var total_item19 = document.getElementById('total_item19').value - 0;
	 var total_item20 = document.getElementById('total_item20').value - 0;
	 var total_item21 = document.getElementById('total_item21').value - 0;
	 var total_item22 = document.getElementById('total_item22').value - 0;
	 var total_item23 = document.getElementById('total_item23').value - 0;
	 var total_item24 = document.getElementById('total_item24').value - 0;
	 var total_item25 = document.getElementById('total_item25').value - 0;
	 var total_item26 = document.getElementById('total_item26').value - 0;
	 var total_item27 = document.getElementById('total_item27').value - 0;
	 var total_item28 = document.getElementById('total_item28').value - 0;
	 var total_item29 = document.getElementById('total_item29').value - 0;
	 var total_item30 = document.getElementById('total_item30').value - 0;
	 var total_item31 = document.getElementById('total_item31').value - 0;
	 sum=total_item1 + total_item2 + total_item3 + total_item4 + total_item5 + total_item6 + total_item7 + total_item8 + total_item9 + total_item10 + total_item11 + total_item12 + total_item13 + total_item14 + total_item15 + total_item16 + total_item17 + total_item18 + total_item19 + total_item20 + total_item21 + total_item22 + total_item23 + total_item24 + total_item25 + total_item26 + total_item27+ total_item28 + total_item29 + total_item30 + total_item31;	 
	 
     grand_total.value = sum;
	 return;
 }
 
 function checkEmail (emailId) 
{
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(emailId))) 
    { 
        alert("Please enter a valid email address \n");
        return false;
    }
    else 
    {
        //test email for illegal characters
        var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
        if (emailId.match(illegalChars)) {
            alert("The email address contains illegal characters \n");
            return false;
        }
       }
    return true;
}

function checkTxtBox (fieldName,txtField)
{
    var illegalChars = /[^a-zA-Z0-9_" ".]/; // allow letters, numbers, and underscores space
    if (illegalChars.test(txtField))
    {
        fieldName = fieldName.replace('_',' ');
        alert(fieldName + " field contains illegal characters \n Can have letters, numbers, undescores and dot");
        return false;
    } 
    return true;
} 
function checkTxtArea (fieldName,txtField)
{
    var illegalChars = /[^a-zA-Z0-9\;\:\_\-\.\,\'\"\/#(\s)]/; // allow letters, numbers, and underscores space
    if (illegalChars.test(txtField))
    {
        fieldName = fieldName.replace('_',' ');
        alert(fieldName + " field contains illegal characters \n Can have letters, numbers and special characters(#,/,;,:,quotes,dot,underscore,hyphen,commas)");
        return false;
    } 
    return true;
}

function checkMobile (mobno)
{
    var illegalChars = /[^0-9]/; // allow numbers
    if (illegalChars.test(mobno))
    {
        alert("Mobile number contains illegal characters \n Can have numbers only");
        return false;
    } 
    if (!(mobno.length == 10)) 
        {
            alert("Please enter the 10 digit mobile number \n");
            return false;
        }
    return true;
}

function checkLandline (phoneno)
{
    var illegalChars = /[^0-9]/; // allow numbers
    if (illegalChars.test(phoneno))
    {
        alert("Landline number contains illegal characters \n Can have numbers only");
        return false;
    } 
    return true;
}

function checkPincode (pinno)
{
    var illegalChars = /[^0-9]/; // allow numbers
    if (illegalChars.test(pinno))
    {
        alert("Pincode contains illegal characters \n Can have numbers only");
        return false;
    } 
    if (!(pinno.length == 6)) 
        {
            alert("Please enter the 6 digit pin code \n");
            return false;
        }
    return true;
}
function checkLoginName (username) 
{
    var illegalChars = /[^a-zA-Z0-9_" ".]/; // allow letters, numbers, dot and underscores
    if (illegalChars.test(username))
    {
        alert("User Name field contains illegal characters \n Can have letters, numbers, undescores and dot");
        return false;
    } 
    return true;
}
function checkLoginPass (passkey) 
{
    if ((passkey.length < 6)) 
    {
        alert("Minimum 6 required for password \n");
        return false;
    }
    var illegalChars = /[^a-zA-Z0-9_" "!@#$^&*]/; // allow letters, numbers, and underscores space
    if (illegalChars.test(passkey))
    {
        alert("Password field contains illegal characters \n Can have letters, numbers, undescores and special characters(!@#$^&*)");
        return false;
    } 
    return true;
}

function chknuser_entry()
{
    var txtRegName = document.forms['formNewuser'].txtRegName.value;
    var txtRegEmail = document.forms['formNewuser'].txtRegEmail.value;
    var txtRegMob = document.forms['formNewuser'].txtRegMob.value;
    var txtRegPho = document.forms['formNewuser'].txtRegPho.value;
    var txtRegAdd = document.forms['formNewuser'].txtRegAdd.value;
    var ddlRegCity = document.forms['formNewuser'].ddlRegCity.value;
    var ddlRegArea = document.forms['formNewuser'].ddlRegArea.value;
    var txtRegPin = document.forms['formNewuser'].txtRegPin.value;
    var txtRegCLM = document.forms['formNewuser'].txtRegCLM.value;
    var txtRegUName = document.forms['formNewuser'].txtRegUName.value;
    var availStatus = document.forms['formNewuser'].availStatus.value;
    var txtRegPass = document.forms['formNewuser'].txtRegPass.value;
    var txtRegCPass = document.forms['formNewuser'].txtRegCPass.value;
    var i = 1;
    var msgTxt ="The following fields are mandatory \n";
    if (txtRegName == ""  || txtRegName == null || txtRegName.length < 4)
    {
        msgTxt = msgTxt + i + "). Name (minimum 4 characters) \n";
        i = i + 1;
    }
    if (txtRegEmail == ""  || txtRegEmail == null)
    {
        msgTxt = msgTxt + i + "). Email \n";
        i = i + 1;
    }
    if (txtRegMob == ""  || txtRegMob == null)
    {
        msgTxt = msgTxt + i + "). Mobile \n";
        i = i + 1;
        
    }
    if (txtRegAdd == ""  || txtRegAdd == null)
    {
        msgTxt = msgTxt + i + "). Address \n";
        i = i + 1;
        
    }
    if (ddlRegArea == ""  || ddlRegArea == null || ddlRegArea == "0")
    {
        msgTxt = msgTxt + i + "). Area \n";
        i = i + 1;
        
    }
    if (txtRegPin == ""  || txtRegPin == null || txtRegPin.length !=  6)
    {
        msgTxt = msgTxt + i + "). Pin Code \n";
        i = i + 1;
        
    }
    if (txtRegCLM == ""  || txtRegCLM == null)
    {
        msgTxt = msgTxt + i + "). Closest Landmark \n";
        i = i + 1;
        
    }
    if (availStatus == ""  || availStatus == null || availStatus == "0")
    {
        msgTxt = msgTxt + i + "). Available Username \n";
        i = i + 1;
        
    }
    if (txtRegPass == ""  || txtRegPass == null)
    {
        msgTxt = msgTxt + i + "). Password \n";
        i = i + 1;
        
    }
    if (txtRegCPass == ""  || txtRegCPass == null)
    {
        msgTxt = msgTxt + i + "). Re-type password \n";
        i = i + 1;
        
    }
    if (i != 1)
    {
        alert(msgTxt);
        return false;
       
    }
    else
    {
        if (!checkTxtBox('Name',txtRegName))
	    {
	        document.forms['formNewuser'].txtRegName.focus();
            return false;
	    }
	     if(!checkEmail(txtRegEmail))
	    { 
	        document.forms['formNewuser'].txtRegEmail.focus();
            return false;
	    } 
	    if (!checkMobile(txtRegMob))
	    {
	        document.forms['formNewuser'].txtRegMob.focus();
            return false;
	    }
	    if (!checkLandline(txtRegPho))
	    {
	        document.forms['formNewuser'].txtRegPho.focus();
            return false;
	    }
	    if (!checkTxtArea('Address' ,txtRegAdd))
	    {
	        document.forms['formNewuser'].txtRegAdd.focus();
            return false;
	    }
	    if (!checkPincode(txtRegPin))
	    {
	        document.forms['formNewuser'].txtRegPin.focus();
            return false;
	    }
	    if (!checkTxtBox('Closest_Landmark ',txtRegCLM))
	    {
	        document.forms['formNewuser'].txtRegCLM.focus();
            return false;
	    }	    
	    if (!checkLoginName(txtRegUName))
	    {
	        document.forms['formNewuser'].txtRegUName.focus();
            return false;
	    }	
	    if (!checkLoginPass(txtRegPass))
	    {
	        document.forms['formNewuser'].txtRegPass.focus();
            return false;
	    }	  
	    if (!checkLoginPass(txtRegCPass))
	    {
	        document.forms['formNewuser'].txtRegCPass.focus();
            return false;
	    }
	    if (txtRegPass != txtRegCPass)
	    {
	        alert("Password & Re-type password do not match");
	        document.forms['formNewuser'].txtRegPass.focus();
            return false;
	    }	      
    }
    document.forms['formNewuser'].submit();
    return true;
}

function setOpacity(obj,opacity) { //for various browsers
	opacity=(opacity==100)?99.999:opacity;
	obj.style.filter="alpha(opacity:"+opacity+")";
	obj.style.KHTMLOpacity=opacity/100;
	obj.style.MozOpacity=opacity/100;
	obj.style.opacity=opacity/100;
}

function check() {
	if(Win && !Win.closed)
		Win.focus();
	else
		setOpacity( document.getElementById('wrapper') , 100 );
}

function chkonOrd_entry() {
    var txtOnName = document.forms['formOnorder'].txtOnName.value;
    var txtOnEmail = document.forms['formOnorder'].txtOnEmail.value;
    var txtOnMobile = document.forms['formOnorder'].txtOnMobile.value;
    var txtOnPhone = document.forms['formOnorder'].txtOnPhone.value;
    var txtOnAdd = document.forms['formOnorder'].txtOnAdd.value;
    var cmbOnCity = document.forms['formOnorder'].cmbOnCity.value;
    var cmbOnArea = document.getElementById('cmbOnArea').value;
    var areaValue = document.getElementById('areaValue').innerHTML;
    var txtOnPin = document.forms['formOnorder'].txtOnPin.value;
    var txtOnCLM = document.forms['formOnorder'].txtOnCLM.value;
    var grand_total = document.forms['formOnorder'].grand_total.value;
    var txtOnSpIns = document.forms['formOnorder'].txtOnSpIns.value;
    var txtOnDD = document.forms['formOnorder'].txtOnDD.value;
    var cmbTime = document.forms['formOnorder'].cmbTime.value;
    var chkCOD = document.forms['formOnorder'].chkCOD.checked;
    var chkCCM = document.forms['formOnorder'].chkCCM.checked;
    var i = 1;
    var msgTxt ="The following fields are mandatory \n";
    if (txtOnName == ""  || txtOnName == null || txtOnName.length < 4)
    {
        msgTxt = msgTxt + i + "). Name (minimum 4 characters) \n";
        i = i + 1;
    }
    if (txtOnEmail == ""  || txtOnEmail == null)
    {
        msgTxt = msgTxt + i + "). Email \n";
        i = i + 1;
    }
    if (txtOnMobile == ""  || txtOnMobile == null)
    {
        msgTxt = msgTxt + i + "). Mobile \n";
        i = i + 1;        
    }
    if (txtOnAdd == ""  || txtOnAdd == null)
    {
        msgTxt = msgTxt + i + "). Address \n";
        i = i + 1;        
    }
    if (cmbOnArea == ""  || cmbOnArea == null || cmbOnArea == "0")
    {
        msgTxt = msgTxt + i + "). Area \n";
        i = i + 1;        
    }
    if (areaValue == ""  || areaValue == null || areaValue == "0")
    {
        msgTxt = msgTxt + i + "). Re-select Area \n";
        i = i + 1;
        
    }   
    if (txtOnPin == ""  || txtOnPin == null || txtOnPin.length !=  6)
    {
        msgTxt = msgTxt + i + "). Pin Code \n";
        i = i + 1;        
    }
    if (txtOnCLM == ""  || txtOnCLM == null)
    {
        msgTxt = msgTxt + i + "). Closest Landmark \n";
        i = i + 1;        
    }
    if (grand_total == ""  || grand_total == null || grand_total == "0")
    {
        msgTxt = msgTxt + i + "). Your Order \n";
        i = i + 1;        
    }
    if (txtOnDD == ""  || txtOnDD == null)
    {
        msgTxt = msgTxt + i + "). Delivery Date \n";
        i = i + 1;        
    }
    if (cmbTime == ""  || cmbTime == null)
    {
        msgTxt = msgTxt + i + "). Delivery Time \n";
        i = i + 1;        
    }
    if (chkCOD == false  && chkCCM == false)
    {
        msgTxt = msgTxt + i + "). Payment Details \n";
        i = i + 1;        
    }
    if (i != 1)
    {
        alert(msgTxt);
        return false;       
    }
    else
    {
        if (!checkTxtBox('Name',txtOnName))
	    {
	        document.forms['formOnorder'].txtOnName.focus();
            return false;
	    }
	     if(!checkEmail(txtOnEmail))
	    { 
	        document.forms['formOnorder'].txtOnEmail.focus();
            return false;
	    } 
	    if (!checkMobile(txtOnMobile))
	    {
	        document.forms['formOnorder'].txtOnMobile.focus();
            return false;
	    }
	    if (!checkLandline(txtOnPhone))
	    {
	        document.forms['formOnorder'].txtOnPhone.focus();
            return false;
	    }
	    if (!checkTxtArea('Address' ,txtOnAdd))
	    {
	        document.forms['formOnorder'].txtOnAdd.focus();
            return false;
	    }
	    if (!checkPincode(txtOnPin))
	    {
	        document.forms['formOnorder'].txtOnPin.focus();
            return false;
	    }
	    if (!checkTxtBox('Closest_Landmark ',txtOnCLM))
	    {
	        document.forms['formOnorder'].txtOnCLM.focus();
            return false;
	    }	    
        if(grand_total-0 < areaValue-0)
        {
          alert("Order Amount should be greater than minimum free delivery amount");
          return false;
        }
        if (!checkTxtArea('Special_instruction' ,txtOnSpIns))
	    {
	        document.forms['formOnorder'].txtOnSpIns.focus();
            return false;
	    }
    }
    document.forms['formOnorder'].action = "order_processing.aspx";
    document.forms['formOnorder'].submit();
    return true;
}


function chkGift_entry() {
    var txtGiftName = document.forms['formGift'].txtGiftName.value;
    var txtGiftNameG = document.forms['formGift'].txtGiftNameG.value;
    var txtGiftRel = document.forms['formGift'].txtGiftRel.value;
    var txtGiftOcc = document.forms['formGift'].txtGiftOcc.value;
    var txtGiftMsg = document.forms['formGift'].txtGiftMsg.value;        
    var txtGiftEmail = document.forms['formGift'].txtGiftEmail.value;
    var txtGiftMobS = document.forms['formGift'].txtGiftMobS.value;
    var txtGiftMobR = document.forms['formGift'].txtGiftMobR.value;
    var txtGiftDAdd = document.forms['formGift'].txtGiftDAdd.value;
    var cmbGiftCity = document.forms['formGift'].cmbGiftCity.value;
    var cmbGiftArea = document.forms['formGift'].cmbGiftArea.value;
    var txtGiftPin = document.forms['formGift'].txtGiftPin.value;
    var txtGiftCLM = document.forms['formGift'].txtGiftCLM.value;
    var txtGiftDD = document.forms['formGift'].txtGiftDD.value;
    var cmbGiftDT = document.forms['formGift'].cmbGiftDT.value;
    var grand_total = document.forms['formGift'].grand_total.value;
    var areaValue = document.getElementById('areaValue').innerHTML;
    var chkGCOD = document.forms['formGift'].chkGCOD.checked;
    var chkGCCM = document.forms['formGift'].chkGCCM.checked;
    var i = 1;
    var msgTxt ="The following fields are mandatory \n";
    if (txtGiftName == ""  || txtGiftName == null || txtGiftName.length < 4)
    {
        msgTxt = msgTxt + i + "). Gifter's Name (minimum 4 characters) \n";
        i = i + 1;
    }
    if (txtGiftNameG == ""  || txtGiftNameG == null || txtGiftNameG.length < 4)
    {
        msgTxt = msgTxt + i + "). Name of the person you want to gift the biryani to (minimum 4 characters) \n";
        i = i + 1;
    }
    if (txtGiftOcc == ""  || txtGiftOcc == null)
    {
        msgTxt = msgTxt + i + "). Occasion \n";
        i = i + 1;
    }
    if (txtGiftMsg == ""  || txtGiftMsg == null)
    {
        msgTxt = msgTxt + i + "). Message \n";
        i = i + 1;
    }
    if (txtGiftEmail == ""  || txtGiftEmail == null)
    {
        msgTxt = msgTxt + i + "). Email \n";
        i = i + 1;
    }
    if (txtGiftMobS == ""  || txtGiftMobS == null)
    {
        msgTxt = msgTxt + i + "). Mobile number (sender's) \n";
        i = i + 1;
        
    }
    if (txtGiftMobR == ""  || txtGiftMobR == null)
    {
        msgTxt = msgTxt + i + "). Mobile number (receiver's) \n";
        i = i + 1;
        
    }
    if (txtGiftDAdd == ""  || txtGiftDAdd == null)
    {
        msgTxt = msgTxt + i + "). Address \n";
        i = i + 1;
        
    }
    if (cmbGiftArea == ""  || cmbGiftArea == null || cmbGiftArea == "0")
    {
        msgTxt = msgTxt + i + "). Area \n";
        i = i + 1;
        
    }   
    if (areaValue == ""  || areaValue == null || areaValue == "0")
    {
        msgTxt = msgTxt + i + "). Re-select Area \n";
        i = i + 1;
        
    }     
    if (txtGiftPin == ""  || txtGiftPin == null || txtGiftPin.length !=  6)
    {
        msgTxt = msgTxt + i + "). Pin Code \n";
        i = i + 1;
        
    }
    if (txtGiftCLM == ""  || txtGiftCLM == null)
    {
        msgTxt = msgTxt + i + "). Closest Landmark \n";
        i = i + 1;
        
    }
    if (txtGiftDD == ""  || txtGiftDD == null)
    {
        msgTxt = msgTxt + i + "). Delivery Date \n";
        i = i + 1;
        
    }
    if (cmbGiftDT == ""  || cmbGiftDT == null)
    {
        msgTxt = msgTxt + i + "). Delivery Time \n";
        i = i + 1;
        
    }
    if (grand_total == ""  || grand_total == null || grand_total == "0")
    {
        msgTxt = msgTxt + i + "). Your Order \n";
        i = i + 1;
        
    }
    if (chkGCOD == false  && chkGCCM == false)
    {
        msgTxt = msgTxt + i + "). Payment Details \n";
        i = i + 1;
        
    }
    if (i != 1)
    {
        alert(msgTxt);
        return false;       
    }
    else
    {
        if (!checkTxtBox('Gifters_Name',txtGiftName))
        {
	          document.forms['formGift'].txtGiftName.focus();
            return false;
        }
        if (!checkTxtBox('Name_of_person_to_gift',txtGiftNameG))
        {
	          document.forms['formGift'].txtGiftNameG.focus();
            return false;
        }
	      if (!checkTxtBox('Relationship',txtGiftRel))
	      {
	          document.forms['formGift'].txtGiftRel.focus();
            return false;
	      }
	      if (!checkTxtBox('Occasion',txtGiftOcc))
	      {
	          document.forms['formGift'].txtGiftOcc.focus();
            return false;
	      }
	      if (!checkTxtArea('Message' ,txtGiftMsg))
	      {
	          document.forms['formGift'].txtGiftMsg.focus();
            return false;
	      }	    
	      if(!checkEmail(txtGiftEmail))
	      { 
	          document.forms['formGift'].txtGiftEmail.focus();
            return false;
	      } 
	      if (!checkMobile(txtGiftMobS))
	      {
	          document.forms['formGift'].txtGiftMobS.focus();
            return false;
	      }
	      if (!checkMobile(txtGiftMobR))
	      {
	          document.forms['formGift'].txtGiftMobR.focus();
            return false;
        }
        if (!checkTxtArea('Address' ,txtGiftDAdd))
        {
            document.forms['formGift'].txtGiftDAdd.focus();
            return false;
        }
        if (!checkPincode(txtGiftPin))
        {
	        document.forms['formGift'].txtGiftPin.focus();
            return false;
        }
        if (!checkTxtBox('Closest_Landmark ',txtGiftCLM))
        {
	        document.forms['formGift'].txtGiftCLM.focus();
            return false;
        }	    
        if(grand_total-0 < areaValue-0)
        {
            alert("Order Amount should be greater than minimum free delivery amount");
            return false;
        }
    }
    document.forms['formGift'].action = "gift_processing.aspx";
    document.forms['formGift'].submit();
    return true;
}

function preloadImg(images) 
{
    if (document.images) 
    {
        var i = 0;
        var imageArray = new Array();
        imageArray = images.split(',');
        var imageObj = new Image();
        for(i=0; i<=imageArray.length-1; i++) 
        {
            //document.write('<img src="' + imageArray[i] + '" />');// Write to page (uncomment to check images)
            imageObj.src=images[i];
        }
    }
}


