function submitme()
{ 
 alert('hai'); 
 document.forms[0].submit();
}
/*
FormatTelNo method takes in the current element of the form and formats the phone number 
in "(123 456-7890" format. This method should be fired on every key entry 
(using onKeyUp method) in the current element of the form. If any key other than 0 to 9 
is entered, it erases that entry rightaway. Maxlength and size of the current
element of the form should be 13.
Eg. <netui:textBox size="13" maxlength="13" onKeyUp="JavaScript:formatTelNo (this);" onBlur="JavaScript:checkTelNo (this);" onKeyDown="JavaScript:formatTelNo (this);"/>    
*/
function formatTelNo (telNo)
{
	//disable phone number formatting in Safari
//	if(navigator.userAgent.indexOf( "Safari" ) < 0)
//	{
	    // If it's blank, save yourself some trouble by doing nothing.
	    if (telNo.value == "") return;
	
	    
	
	    var phone = new String (telNo.value);
	    
	    phone = phone.substring(0,14);
	
	    /*
	    "." means any character. If you try to use "(" and ")", the regular expression becomes 
	    complicated sice both are reserve characters and escaping them sometimes fails. So just 
	    use "." for any character and replace it later.
	    */
	    if (phone.match (".[0-9]{3}.[0-9]{3}-[0-9]{4}") == null)
	    {
	        /*
	        Following "if" is for user making any changes to the formatted tel. no. If you don't put this 
	        "if" condition, the user can not correct a digit by first deleting it and then entering a 
	        correct one, since this will fire two "onkeyup" events : first one on deleting a 
	        character and second one on entering the correct one. The first "onkeyup" event will fire this 
	        function which will reformatt the tel no before the user gets a chace to correct the digit. This 
	        will surely confuse the user. The "if" condition below eliminates that.
	        */
	        if (phone.match (".[0-9]{2}.[0-9]{3}-[0-9]{4}|" + ".[0-9].[0-9]{3}-[0-9]{4}|" +
	            ".[0-9]{3}.[0-9]{2}-[0-9]{4}|" + ".[0-9]{3}.[0-9]-[0-9]{4}") == null)
	        {
	            /*
	            You will reach here only if the user is still typing the number or if he/she has 
	            messed up already formatted number. 
	            */
	            var phoneNumeric = phoneChar = "", i;
	            // Loop thru what user has entered.
	            for (i=0;i<phone.length;i++)
	            {
	                // Go thru what user has entered one character at a time.
	                phoneChar = phone.substr (i,1);
	    
	                // If that character is not a number or is a White space, ignore it. Only if it is a digit, 
	                // concatinate it with a number string.
	                if (!isNaN (phoneChar) && (phoneChar != " ")) phoneNumeric = phoneNumeric + phoneChar;
	            }
	    
	            phone = "";
	            // At this point, you have picked up only digits from what user has entered. Loop thru it.
	            for (i=0;i<phoneNumeric.length;i++)
	            {
	                // If it's the first digit, throw in "(" before that.
	                if (i == 0) phone = phone + "(";
	                // If you are on the 4th digit, put ") " before that.
	                if (i == 3) phone = phone + ") ";
	                // If you are on the 7th digit, insert "-" before that.
	                if (i == 6) phone = phone + "-";
	                // Add the digit to the phone charatcer string you are building.
	                phone = phone + phoneNumeric.substr (i,1)
	            }
	        }
	    }
	    else
	    { 
	        // This means the tel no is in proper format. Make sure by replacing the 0th, 4th and 8th character.
	        phone = "(" + phone.substring (1,4) + ") " + phone.substring (5,8) + "-" + phone.substring(9,13); 
	    }
	    // So far you are working internally. Refresh the screen with the re-formatted value.
	    if (phone != telNo.value) telNo.value = phone;
//	}
}

/*
CheckTelNo method takes in current element of the form as input. This method should be 
fired as the user attempts to leave the current element in the form (by using onBlur method). 
It checks to see if the format of the phone is "(123) 456-7890".
Eg. <netui:textBox size="13" maxlength="13" onBlur="JavaScript:checkTelNo (this);" onKeyUp="JavaScript:formatTelNo (this);" onKeyDown="JavaScript:formatTelNo (this);"/>  
*/      
function checkTelNo (telNo)
{
    if (telNo.value == "") return;
    if (telNo.value.match (".[0-9]{3}.[0-9]{3}-[0-9]{4}") == null)
    {
        if (telNo.value.match ("[0-9]{10}") != null)
            formatTelNo (telNo)              
    }
}

//Enter-listener 
 //if the user presses ENTER KEY submit the Form
 //Added by Guruprasad Thorvey on 03/23/05 to fix issue #21632
function checkEnterForFindListing(e){ 
    var characterCode;
    
    if(e && e.which){ 
        e = e;
        characterCode = e.which ;
    }
    else{
        e = event;
        characterCode = e.keyCode; 
    }
    
    if(characterCode == 13){ //13 = the code for pressing ENTER 				
        document.forms[getNetuiTagName("findListingForm")].submit();
        return false; 
    }
    else{
        return true ;
    }

}

    function SetFromTo(val,fromval){
        if ((val.value=='Closed') || (val.value=='Open24hrs')){
            var from =document.forms[0]['ctl00_mainContent_'+fromval];
            var fromtxt = from.options[val.selectedIndex].text;
            from.options[val.selectedIndex].selected=true;
            fromtxt=val.value;
			
        }
    }
//repeat hours from Monday to rest of the days
function repeatHours()
{
//To enable all dropdowns value copy

//document.forms[0].elements["ctl00_mainContent_CopyMonToFriCheck"].checked = true;

//To enable all dropdowns value copy
    if(document.forms[0].elements["ctl00$mainContent$HoursOfOperationType"][2].checked == false)
    {
        alert("Select the \"Select hours from the drop down menu\" option first.");
    }
    else
    {
        var toAr = new Array('tueClosed','wedClosed','thrClosed','friClosed');  
        openHour = document.forms[0].elements["ctl00_mainContent_MondayOpen"];
        closeHour = document.forms[0].elements["ctl00_mainContent_MondayTo"];
         
        var fromtxt = openHour.options[openHour.selectedIndex].text;
        var totxt   = closeHour.options[closeHour.selectedIndex].text;

        if (fromtxt=='Opening time:'){
            alert('please enter a valid from Date for monday');
            return false;
        }    
        else if (totxt=='Closing time:'){
            alert('please enter a valid to Date for monday');
            return false;
        }                     
      
        document.forms[0].elements["ctl00_mainContent_TuesdayOpen"].selectedIndex=openHour.selectedIndex;	
        document.forms[0].elements["ctl00_mainContent_TuesdayTo"].selectedIndex=closeHour.selectedIndex;
        document.forms[0].elements["ctl00_mainContent_WednesdayOpen"].selectedIndex=openHour.selectedIndex;
        document.forms[0].elements["ctl00_mainContent_WednesdayTo"].selectedIndex=closeHour.selectedIndex;
        document.forms[0].elements["ctl00_mainContent_ThursdayOpen"].selectedIndex=openHour.selectedIndex;
        document.forms[0].elements["ctl00_mainContent_ThursdayTo"].selectedIndex=closeHour.selectedIndex;
        document.forms[0].elements["ctl00_mainContent_FridayOpen"].selectedIndex=openHour.selectedIndex;
        document.forms[0].elements["ctl00_mainContent_FridayTo"].selectedIndex=closeHour.selectedIndex;   
        if(document.forms[0].elements["ctl00_mainContent_MondayApptOnly"].checked == true)
        {
        //	document.forms[0].elements["ctl00_mainContent_MondayApptOnly"].checked = true;
	        document.forms[0].elements["ctl00_mainContent_TuesdayApptOnly"].checked = true;
	        document.forms[0].elements["ctl00_mainContent_WednesdayApptOnly"].checked = true;
	        document.forms[0].elements["ctl00_mainContent_ThursdayApptOnly"].checked = true;
	        document.forms[0].elements["ctl00_mainContent_FridayApptOnly"].checked = true;
        //	document.forms[0].elements["ctl00_mainContent_SaturdayApptOnly"].checked = true;
        //	document.forms[0].elements["ctl00_mainContent_SundayApptOnly"].checked = true;
        }
        else if(document.forms[0].elements["ctl00_mainContent_MondayApptOnly"].checked == false)
        {
	        document.forms[0].elements["ctl00_mainContent_TuesdayApptOnly"].checked = false;
	        document.forms[0].elements["ctl00_mainContent_WednesdayApptOnly"].checked = false;
	        document.forms[0].elements["ctl00_mainContent_ThursdayApptOnly"].checked = false;
	        document.forms[0].elements["ctl00_mainContent_FridayApptOnly"].checked = false;

        }	
        //alert(openHour.selectedIndex);     
        //alert(document.forms[0].elements["ctl00_mainContent_TuesdayOpen"].selectedIndex);
   } 
}

function echeck(str) {

  var at="@"
  var dot="."
  var lat=str.indexOf(at)
  var lstr=str.length
  var ldot=str.indexOf(dot)
  if (str.indexOf(at)==-1){
     alert("Invalid E-mail ID")
     return false 
  }

  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Invalid E-mail ID")
     return false
  }

  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Invalid E-mail ID")
      return false
  }

   if (str.indexOf(at,(lat+1))!=-1){
      alert("Invalid E-mail ID")
      return false
   }

   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Invalid E-mail ID")
      return false
   }

   if (str.indexOf(dot,(lat+2))==-1){
      alert("Invalid E-mail ID")
      return false
   }
  
   if (str.indexOf(" ")!=-1){
      alert("Invalid E-mail ID")
      return false 
   }

    return true     
 }

function echecknew(stri) {

  var str=stri.value;
  var at="@";
  var dot=".";
  var lat=str.indexOf(at);
  var lstr=str.length;
  var ldot=str.indexOf(dot);
  if (str.indexOf(at)==-1){
     alert("Invalid E-mail ID");
     document.getElementById(stri.id).focus();
     return false;
  }

  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Invalid E-mail ID");
     document.getElementById(stri.id).focus();
     return false;
  }

  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
      alert("Invalid E-mail ID");
      document.getElementById(stri.id).focus();
      return false;
  }

   if (str.indexOf(at,(lat+1))!=-1){
      alert("Invalid E-mail ID");
      document.getElementById(stri.id).focus();
      return false;
   }

   if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
      alert("Invalid E-mail ID");
      document.getElementById(stri.id).focus();
      return false;
   }

   if (str.indexOf(dot,(lat+2))==-1){
      alert("Invalid E-mail ID");
      document.getElementById(stri.id).focus();
      return false;
   }
  
   if (str.indexOf(" ")!=-1){
      alert("Invalid E-mail ID");
      document.getElementById(stri.id).focus();
      return false;
   }

    return true     
 }

    
function CallMeOnSubmit()
{
    var CallMeName = document.getElementById("ctl00_mainContent_CallMePopUpExtender_CallMeNameTextbox");
    var PhoneNumber = document.getElementById("ctl00_mainContent_CallMePopUpExtender_PhoneNumberTextbox");

    if(CallMeName.value == "")
    {
        alert("Please enter the name");
        CallMeName.focus();
        return false;
    }
    if(PhoneNumber.value == "")
    {
        alert("Please enter the phone number");
        PhoneNumber.focus();
        return false;
    }
} 

function GetQuoteOnSubmit()
{
    var GetQuoteName = document.getElementById("ctl00_mainContent_GetQuotePopUpExtender_GetQuoteNameTextbox");
    var GetQuoteEmail = document.getElementById("ctl00_mainContent_GetQuotePopUpExtender_GetQuoteEmailTextbox");
    var GetQuoteComment = document.getElementById("ctl00_mainContent_GetQuotePopUpExtender_GetQuoteCommentTextbox");
    var PhoneNumber = document.getElementById("ctl00_mainContent_GetQuotePopUpExtender_PhoneNumberTextbox");

    if(GetQuoteName.value == "")
    {
        alert("Please enter the name");
        return false;
    }
    else if(GetQuoteEmail.value == "")
    {
        alert("Please enter the email");
        return false;
    }
    if(PhoneNumber.value == "")
    {
        alert("Please enter the phone number");
        PhoneNumber.focus();
        return false;
    }
    else if(GetQuoteComment.value == "")
    {
        alert("Please enter the comments");
        return false;
    }
}  

function MakeApptOnSubmit()
{
    var MakeApplnName = document.getElementById("ctl00_mainContent_BookMePopUpExtender_MakeApplnNameTextbox");
    var MakeApplnCalender = document.getElementById("ctl00_mainContent_BookMePopUpExtender_MakeApplnCalenderTextBox");
    var PhoneNumber = document.getElementById("ctl00_mainContent_BookMePopUpExtender_PhoneNumberTextbox");

    if(MakeApplnName.value == "")
    {
        alert("Please enter the name");
        return false;
    }
    if(PhoneNumber.value == "")
    {
        alert("Please enter the phone number");
        PhoneNumber.focus();
        return false;
    }

    else if(MakeApplnCalender.value == "")
    {
        alert("Please select the date");
        return false;
    }           
}       

function StopBannerTimer(str)
{
//    ctl00_mainContent_VerticalRandomBanner1_Timer2
//    alert("Hi");

    if(str == "v")
    {
        document.getElementById('ctl00_mainContent_hidBannerTimerValue').value="stop";
    }

}
function StartBannerTimer(rst)
{
//    ctl00_mainContent_VerticalRandomBanner1_Timer2
//    alert("Hi");
    if(rst == "v")
    {
        document.getElementById('ctl00_mainContent_hidBannerTimerValue').value="start";
    }

}


