﻿var clBck = false; 
function ShowHide(valStatus)
{
    var divv = document.getElementById("DivOpt");if(valStatus)
    {
     if(divv.getAttribute("Container") != null ) 
         divv.innerHTML = divv.getAttribute("Container");
    }
     else
    {
         if(divv.getAttribute("Container") == null )
         divv.setAttribute("Container", divv.innerHTML); divv.innerHTML = ""; 
     }
  }
function CheckValueForHD(srcID)
{
    ShowHide(document.getElementById(srcID).options[document.getElementById(srcID).selectedIndex].text == "Dr.");
}

function FormValidation() 
{
    if(document.getElementById("chkTerm").checked == false) { alert("You must accept the Terms & Conditions of service."); return false; }
    CheckValidity('txtMobile','divMobile');
    if(document.getElementById('divMobile').innerHTML != "&nbsp;" ) { return false; }
	var oForm = window.document.forms[0];
	return (ValidateForm(oForm));
}
  
function FormValidation1()
 {
    var oElement = window.document.getElementById("txtLoginId");
    var ni = window.document.getElementById('divUserID');
    ni.innerHTML = "";
    if(IsEmpty(Trim(oElement.value))){ ni.innerHTML = "<img src='http://image.gobananas.in/images/error_red.gif' />You forgot to fill in the 'Login ID' field.\nPlease fill in to check for 'Avaibality'."; }
    else if( Validate("LOGIN",oElement,"The Login Id choosen by you contains special characters.\nHint: Only dot(.) and underscore(_) are accepted.#divUserID") )
    {
        ni.innerHTML = "<img src='http://image.gobananas.in/images/check_availability.gif' alt='Please wait!' />";
        if( !clBck ) { clBck = true; UseCallback(oElement.value + "#1#divUserID"); }
        else { setTimeout("FormValidation1()", 1000); }
    }
     return false;
 }	

function FormValidation2()
 {
    var oElement = window.document.getElementById("txtEmailId");
    var ni = window.document.getElementById('divEmailId');
    ni.innerHTML = "";
    if(IsEmpty(Trim(oElement.value))){ ni.innerHTML = "<img src='http://image.gobananas.in/images/error_red.gif' />You forgot to fill in the 'Login ID' field.\nPlease fill in to check for 'Avaibality'."; }
    else if( Validate("EMAIL",oElement,"The e-mail Id choosen by you isn't a valid e-mail id!#divEmailId") )
    {
        ni.innerHTML = "<img src='http://image.gobananas.in/images/check_availability.gif' alt='Please wait!' />";
        if( !clBck ) { clBck = true; UseCallback(oElement.value + "#2#divEmailId"); }
        else { setTimeout("FormValidation2()", 1000); }
    }
     return false;
 }	
 
function ReceiveDataFromServer(arg,context)
{
    document.getElementById(arg.split('#')[0]).innerHTML=arg.split('#')[1];
    clBck = false;
}

    function clickButton(e, buttonid)
    {
     var bt = window.document.getElementById(buttonid); 
     if (bt)
     { 
         if(navigator.appName.indexOf("Netscape")>(-1)) 
         {
          if (e.keyCode == 13){ bt.click(); return false;
         }
     } 
    if(navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
    { 
        if(event.keyCode == 13)
            {
                bt.click(); 
                return false; 
            } 
      }  
    } 
}


/*function GetAllData()
 {
     if(IsValidCtrl("ddlState"))
        {
            SaveData("ddlState", "hdState");
        }
        else
        {
            SaveDataText("txtState", "hdState");
        }
    
       if(IsValidCtrl("ddlCity"))
        {
            SaveData("ddlCity", "hdCity");
        }
        else
        {
            SaveDataText("txtCity", "hdCity");
        }
    
       return true;
 }*/
 
 function GetAllData(){if( IsValidCtrl("ddlState") ){SaveData("ddlState", "hdState");}else{SaveDataText("txtState", "hdState");}return true;}
 
 /*function GetAllData(){if( IsValidCtrl("ddlCity") ){SaveData("ddlCity", "hdCity");}else{SaveDataText("txtCity", "hdCity");}return true;}*/

   function kH(e) {
    var pK = e ? e.which : window.event.keyCode;
    var tmp = e ? e.target : window.event.srcElement
    if( tmp.type == "textarea" ){return true;}
    return pK != 13;
   }

document.onkeypress = kH;
if (document.layers) document.captureEvents(Event.KEYPRESS);

 
  
