
function menu(whichMenu,whatState){if(document.getElementById)
{document.getElementById(whichMenu).style.visibility=whatState;}
else{document[whichMenu].visibility=whatState;}}
function checkop(sForm)
{eval('var oDoc = document.'+sForm);if(oDoc.srchopt.value=='')
{alert("Select an Operator.");return false;}
else
{return true;}}
var xhrObj=false;function showWait(){if(divid)getEl(divid).innerHTML="<img src='images/status.gif'>"}
var iRemoteProcedure=0;var tRemoteProcedures={};function RemoteProcedure(sUrl,fnOnLoad,fnOnPatience){this.req=null;this.fnOnLoad=null;this.id=++iRemoteProcedure;tRemoteProcedures[this.id]=this;this.timer=null;this.call(sUrl,fnOnLoad,fnOnPatience);}
RemoteProcedure.prototype.call=function(url,fnOnLoad,fnOnPatience){if(xhrObj&&xhrObj.readyState!=0){xhrObj.abort();}
this.fnOnLoad=fnOnLoad;this.fnOnPatience=fnOnPatience;this.timer=window.setTimeout('tRemoteProcedures['+this.id+'].showPatience()',500);var sRand=(url.indexOf('?')==-1?'?':'&')+'Rand='+Math.random();if(window.XMLHttpRequest){this.req=new XMLHttpRequest();this.req.onreadystatechange=new Function('tRemoteProcedures['+this.id+'].processReqChange()');this.req.open("GET",url+sRand,true);this.req.send(null);}else if(window.ActiveXObject){this.req=new ActiveXObject("Microsoft.XMLHTTP");if(this.req){this.req.onreadystatechange=new Function('tRemoteProcedures['+this.id+'].processReqChange()');this.req.open("GET",url+sRand,true);this.req.send();}}}
RemoteProcedure.prototype.showPatience=function(){this.clearTimeout();if(this.fnOnPatience)
this.fnOnPatience();}
RemoteProcedure.prototype.clearTimeout=function(){if(this.timer!=null){window.clearTimeout(this.timer);this.timer=null;}}
RemoteProcedure.prototype.processReqChange=function(){if(this.req.readyState==4){this.clearTimeout();if(this.req.status==200||this.req.status==0){if(this.fnOnLoad)
this.fnOnLoad(this.req);}
else
alert("Error "+this.req.status+"\n"+this.req.statusText+"\n\n"+this.req.responseText.replace(/\r\n/g,''));}}
function getEl(id){return document.getElementById(id)}
String.prototype.trim=function(s){s=this!=window?this:s;return s.replace(/^\s+/g,'').replace(/\s+$/g,'');}
function AutoSuggestControl(suggestFld){this.fld=suggestFld;var strSuggestFld="fld_"+suggestFld+"_name";this.textbox=getEl(strSuggestFld);this.suggestFld=strSuggestFld;var strSuggestDiv="div_"+suggestFld+"_name";this.layer=getEl(strSuggestDiv);this.cur=-1;this.init();}
AutoSuggestControl.prototype.init=function(){var oThis=this;this.textbox.onkeyup=function(oEvent){if(!oEvent){oEvent=window.event;}
oThis.handleKeyUp(oEvent);};this.textbox.onkeydown=function(oEvent){if(!oEvent){oEvent=window.event;}
oThis.handleKeyDown(oEvent);};};AutoSuggestControl.prototype.handleKeyUp=function(oEvent){var iKeyCode=oEvent.keyCode;if(iKeyCode==8||iKeyCode==46){eval("getSearchSuggestions('"+this.fld+"')");}else if(iKeyCode<32||(iKeyCode>=33&&iKeyCode<46)||(iKeyCode>=112&&iKeyCode<=123)){}else{eval("getSearchSuggestions('"+this.fld+"')");}};AutoSuggestControl.prototype.handleKeyDown=function(oEvent){if(this.layer.style.display=="block"){switch(oEvent.keyCode){case 38:this.previousSuggestion();break;case 40:this.nextSuggestion();break;case 13:this.hideSuggestions();break;}}};AutoSuggestControl.prototype.nextSuggestion=function(){if(this.layer.style.display=="block"){var cSuggestionNodes=this.layer.childNodes;if(cSuggestionNodes.length>0&&this.cur<cSuggestionNodes.length-1){var oNode=cSuggestionNodes[++this.cur];this.highlightSuggestion(oNode);this.textbox.value=oNode.firstChild.nodeValue;return false;}}};AutoSuggestControl.prototype.previousSuggestion=function(){var cSuggestionNodes=this.layer.childNodes;if(cSuggestionNodes.length>0&&this.cur>0){var oNode=cSuggestionNodes[--this.cur];this.highlightSuggestion(oNode);this.textbox.value=oNode.firstChild.nodeValue;return false;}};AutoSuggestControl.prototype.highlightSuggestion=function(oSuggestionNode){for(var i=0;i<this.layer.childNodes.length;i++){var oNode=this.layer.childNodes[i];if(oNode==oSuggestionNode){oNode.className="currentsuggestitem";}else if(oNode.className=="currentsuggestitem"){oNode.className="suggestitem";}}};AutoSuggestControl.prototype.hideSuggestions=function(){eval("doBlurSuggestions()");this.cur=-1;};AutoSuggestControl.prototype.disable=function(){eval("doBlurSuggestions()");this.textbox.onkeyup=null;};var sAutoSuggestFld="";var suggestBox;var suggestCharLenght=3;var arrSearchOptions=new Array();function closedropdown(id){document.getElementById(id).style.display="none";}
function opendropdown(id){document.getElementById(id).style.display="block";}
function initSuggestionsfrom(sCurrentFld){sAutoSuggestFld=sCurrentFld;suggestBox=new AutoSuggestControl(sAutoSuggestFld);}
function fldOnBlur(suggestFld){var strInstFld="fld_"+suggestFld+"_name";var strInstIdFld="fld_"+suggestFld+"_id";var sIdBlurred="iframe_"+suggestFld+"_name";var tempStr;tempStr=arrSearchOptions[document.getElementById(strInstFld).value.toLowerCase()];if(tempStr){document.getElementById(strInstIdFld).value=tempStr;}else{}
closedropdown('iframe_'+suggestFld+'_name');closedropdown('div_'+suggestFld+'_name');}
function doBlurSuggestions(sCurrentFld){sAutoSuggestFld=sCurrentFld;hideSearchOptionsSuggestions();}
function doDisableSuggestions(){suggestBox.disable();}
function getSearchSuggestions(sCurrentFld){sAutoSuggestFld=sCurrentFld;doBlurSuggestions(sAutoSuggestFld);type=1;search_text=document.getElementById('fld_'+sAutoSuggestFld+'_name').value;if(search_text.length>=suggestCharLenght){processSearchOptions(search_text,sCurrentFld);}else{document.getElementById('div_'+sAutoSuggestFld+'_name').innerHTML='';}}
function processSearchOptions(inst_name,sCurrentFld){if(sCurrentFld=='search_optionsWall'){var url='suggest_key.php?key='+inst_name+'&type=5';}else if(sCurrentFld=='search_optionsAni'){var url='suggest_key.php?key='+inst_name+'&type=29';}else{var url='suggest_key.php?key='+inst_name;}
var xhr1=new RemoteProcedure(url,formatSearchOptions,showWaitProcessSearchOptions);}
function showWaitProcessSearchOptions(){document.getElementById('div_'+sAutoSuggestFld+'_name').innerHTML="<img src='images/loading.gif'/>loading...";}
function formatSearchOptions(xhrObj){if(xhrObj.responseText){var strHTML="";var strHTML="";retVal=xhrObj.responseText;keyVal=retVal.split('|');for(i=0;i<keyVal.length;i++){strHTML+="<div class=\"suggestitem \" id=\"opt_"+sAutoSuggestFld+"\"  onClick=\"populateSearchField('"+keyVal[i].trim()+"');\" onmouseover=\"populateOnHover('"+keyVal[i].trim()+"', this);\">"+keyVal[i]+"</div>";}
opendropdown('div_'+sAutoSuggestFld+'_name');opendropdown('iframe_'+sAutoSuggestFld+'_name');document.getElementById('div_'+sAutoSuggestFld+'_name').innerHTML=strHTML+document.getElementById('temp_'+sAutoSuggestFld+'_footer').innerHTML;document.getElementById('div_'+sAutoSuggestFld+'_name').style.width=(parseInt(document.getElementById('fld_'+sAutoSuggestFld+'_name').offsetWidth)-10)+"px";document.getElementById('iframe_'+sAutoSuggestFld+'_name').style.height=document.getElementById('div_'+sAutoSuggestFld+'_name').offsetHeight+"px";document.getElementById('iframe_'+sAutoSuggestFld+'_name').style.width=document.getElementById('div_'+sAutoSuggestFld+'_name').offsetWidth+"px";}}
function populateOnHover(searchStr,oSuggestionNode){var sId=oSuggestionNode.id.substr(4,oSuggestionNode.id.length-4);var oParent=document.getElementById('div_'+sId+'_name');for(var i=0;i<oParent.childNodes.length;i++){var oNode=oParent.childNodes[i];if(oNode==oSuggestionNode){oNode.className="currentsuggestitem";}else if(oNode.className=="currentsuggestitem"){oNode.className="suggestitem";}}
document.getElementById('fld_'+sAutoSuggestFld+'_name').value=searchStr;}
function populateSearchField(searchStr){document.getElementById('fld_'+sAutoSuggestFld+'_name').value=searchStr;doBlurSuggestions(sAutoSuggestFld);}
function hideSearchOptionsSuggestions(){if(document.getElementById('iframe_'+sAutoSuggestFld+'_name'))closedropdown('iframe_'+sAutoSuggestFld+'_name');if(document.getElementById('div_'+sAutoSuggestFld+'_name'))closedropdown('div_'+sAutoSuggestFld+'_name');}
function st2(t){for(i=1;i<=4;i++){ts=document.getElementById('tt'+i);tr=document.getElementById('dd'+i);ta=document.getElementById('aa'+i);if(t==i){if(t==1)ts.className="tbsel";if(t==2)ts.className="tbsel";if(t==3)ts.className="tbsel";if(t==4)ts.className="tbsel";ta.className="srchlinksel2";ts.style.borderBottom="1px solid #FFFFFF";tr.style["display"]="block";tr.style["visibility"]="visible";}
else{ts.className="tbmono";ta.className="srchlink2";ts.style.borderBottom="1px solid #B7B7B7";tr.style["display"]="none";tr.style["visibility"]="hidden";}}}
function ValidateMe()
{var phnno=document.frmprof.mobileno.value
var phnlen=document.frmprof.mobileno.value.length
var anum=/(^\d+$)|(^\d+\.\d+$)/
if(anum.test(phnno)&&(phnlen==10))
testresult=true;
else{alert("Invalid number.Please enter the correct number")
document.frmprof.mobileno.focus();return false;testresult=false}
document.frmprof.submit();}
function checkOp(sForm)
{eval('var oDoc = document.'+sForm);if(oDoc.srchopt.value=='')
{alert("Select an Operator.");return false;}
else
{return true;}}