﻿var NORPP,KL,DWS,DOINW,SS,DSKH,BROWSER; var qsParm = {};var csParm = {};
function customDS() { if(document.getElementById('cdq')!=null){var ctl =  document.getElementById('cdq'); if(trim(ctl.value)=="") return; ctl.value =ctl.value.substring(0,200) ;var  searchtext = ctl.value ; if(searchtext.replace(/ /g,'').length == 0) { ctl.focus(); return false;} else {  document.forms['frmCustom'].submit();}} }
function emailCheck(emailtext){var emaillength = emailtext.length; var re = /^[^\s()<>@,;:\/]+@[\w\.-]+\.[a-z]{2,}$/i;if( emaillength > 0){if(!re.test(emailtext)){return false;} else {return true ;}}else{return false ;}}
function submitForm()
{
  if(Validate())
  {
     var domain = document.getElementById('ctl00_CPH_Txt_Domain').value;
     domain = domain.replace("http://","" );
     domain = domain.replace("www.","" );
     var idx = -1 ; 
     idx = domain.indexOf('/');
     if (idx!=-1) domain = domain.substring(0,idx);
     var logo = document.getElementById('ctl00_CPH_Txt_Logo').value  ;
     try
     {
        var lid1 =(getCheckedRadio()!=null ? getCheckedRadio():document.getElementById('ctl00_CPH_dlid').value );
     }
     catch(err){alert(err.message);}
     var sod = getSod();
     domain = domain.replace("http://","" );
     domain = domain.replace("www.","" );
     window.open('CustomDemo.aspx?dom=' + domain + '&logo=' + logo + '&lid=' + lid1 + '&sod=' + sod  ,'demo'); }}     
function setlogo(){var imgctl = document.getElementById('lg'); if (imgctl.width > 380 ) {imgctl.width = 380; }if (imgctl.height > 90 ) {imgctl.height = 90; }}
function chkDmn(){var domain =trim(document.getElementById("ctl00_CPH_Txt_Domain").value ) ; domain = domain.replace(/ /g,'');if( domain.indexOf('http://')!=0) { alert('Enter Valid Domain'); return true ;} var re = /^(http:\/\/|https:\/\/)(\w+|\w+.\w+)[.]\w{2}(.\w{2}|\w)$/; var temp=domain.length;var tempd=domain; if(domain.substring(temp-1)=="/"){ var tempd=domain.substring(0,temp-1);} if(!re.test(tempd))  {alert('Enter Valid Domain '); return true ;}   domain = domain.replace("http://","" ); domain = domain.replace("www.","" );  var idx = -1 ;    idx = domain.indexOf('/');     if (idx!=-1)domain = domain.substring(0,idx);   if (domain.length < 1){alert('Enter Domain '); return true ;}    if ( domain.length > 200){alert('Enter valid Domain '); return true ;}     }
function chkLogo(){var logo = trim(document.getElementById('ctl00_CPH_Txt_Logo').value );  logo = logo.replace(/ /g,'');if( logo.indexOf('http://')!=0) { return false ;} var re = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;  if(!re.test(logo))  { return false ;}  else {return true ;} } 
function Validate()
{
    var domain = document.getElementById('ctl00_CPH_Txt_Domain').value;
    var name = trim(document.getElementById('ctl00_CPH_Txt_Nm').value);
    var logo = document.getElementById('ctl00_CPH_Txt_Logo').value;
    var email = document.getElementById('ctl00_CPH_Txt_Mail').value;
    email = email.replace(/ /g,'') ;
    if(domain.replace(/ /g,'').length == 0)
    {
     alert("Provide the domain to be searched");
     document.getElementById('ctl00_CPH_Txt_Domain').focus();
     return false;
    }
    if(logo.length == 0)
    {
      alert("Enter Url of Logo");
      document.getElementById('ctl00_CPH_Txt_Logo').focus();
      return false;
    }
    if(logo.length > 250)
    {
     alert("Url of Logo can not be greater than 250 characters ");
     document.getElementById('ctl00_CPH_Txt_Logo').focus();
     return false;
    }
    if(!chkLogo())
    {
     alert("Enter Valid Url of Logo ");
     document.getElementById('ctl00_CPH_Txt_Logo').focus();
     return false;
    }
    if(name.length == 0)
    {
        alert("Enter Name");
        document.getElementById('ctl00_CPH_Txt_Nm').focus(); 
        return false;
    }
    if(name.length >150)
    {
    alert("Name can not be greater than 150 characters");
    document.getElementById('ctl00_CPH_Txt_Nm').focus();
    return false;
    }    
    var re=/\W/;    
    var re1=/[0-9]/;    
    var re2=/\s/;    
    
    if((re.test(name) && !re2.test(name)) || (re1.test(name) && !re2.test(name)))
    {
      alert('Name contains some illegal character(s)');
      document.getElementById('ctl00_CPH_Txt_Nm').focus();
      return false; 
    }
   if(!emailCheck(email))
   {
    alert("Enter Valid Email");
    document.getElementById('ctl00_CPH_Txt_Mail').focus();
    return false; 
   }
   if(email.length > 250)
   {
    alert("You can not enter Email ID more than 250 characters");
    document.getElementById('ctl00_CPH_Txt_Mail').focus();
    return false;
   }
   else { return true; }}
function SetHomePage(){var Page = document.getElementById('HomePageLink');    Page.style.behavior='url(#default#homepage)';if(KL!="EN") Page.setHomePage('http://search.webdunia.com/');else   Page.setHomePage('http://search.webdunia.com/default1.aspx?lid=EN');}

function trim(s){return s.replace(/^\s*(.*?)\s*$/,"$1"); }
function doSubmitForm()
{
 try{
        var searchtext='';var searchon = '';var old_searchon = '';        
        var ctl = document.getElementById(objCustom.getTextAreaID().id);        
      
        if(trim(ctl.value)=="") return;
        ctl.value = ctl.value.substring(0,200) ;
        searchtext=ctl.value ;
        document.getElementById(objCustom.getTextAreaID().id).value=searchtext;
        document.forms["searchform"].submit();}catch(err){  alert('ErrorCode 317 '+err.description); }
}
function lp()
{
 try
 {
   switch(gpid())
   {
     case 5:initvar();loadControlNew('cdq','hello',KL,'S','');break;
     case 6:if(KeyboardLanguage()!='EN')
            {
              if (document.getElementById('hello')!=null)
              loadControlNew('q','hello',KL,'S','kb_div');
            }
            else
            {
             document.getElementById(objCustom.getTextAreaID().id).value=document.getElementById('qOld').value ;
             document.getElementById(objCustom.getTextAreaID().id).focus();
            }
            break;
    default:return;
   }
 }catch(err){ }
}
function gab(eid,pos){    try{ var bust = Math.floor(1000000*Math.random()+1);               if(pos=='top'){ if(document.getElementById(eid)!=null) document.getElementById(eid).innerHTML='<iframe src="http://cmads.webdunia.com/cgi-bin/advertpro/banners.pl?region=468x60_search&bust=' + bust + '&keyword=NULL" height=60 width=468 marginwidth="0" marginheight="0" vspace="0" hspace="0" frameborder="0" align="middle" scrolling="no"><a href="http://cmads.webdunia.com/cgi-bin/advertpro/blink.pl?region=468x60_search&bust=' + bust + '" target="_blank"><img src="http://cmads.webdunia.com/cgi-bin/advertpro/bimg.pl?region=468x60_search&keyword=NULL&bust=' + bust + '" border="0"></a></iframe>';  }        else  {if(document.getElementById(eid)!=null)  document.getElementById(eid).innerHTML='<iframe src="http://cmads.webdunia.com/cgi-bin/advertpro/banners.pl?region=728x90_search&bust=' + bust + '&keyword=NULL" height="90" width="728" marginwidth="0" marginheight="0" vspace="0" hspace="0" frameborder="0" align="middle" scrolling="no"><a href="http://cmads.webdunia.com/cgi-bin/advertpro/blink.pl?region=728x90_search&bust=' + bust + '" target="_blank"><img src="http://cmads.webdunia.com/cgi-bin/advertpro/bimg.pl?region=728x90_search&keyword=NULL&bust=' + bust + '" border="0"></a></iframe>'; }     }     catch(err)    { alert('ErrorCode 116 '+err.description); }}

function Blink(lang)
{
 document.getElementById("lLinks").innerHTML='<div align="center" class="english"><a href="http://www.webdunia.net/Advertise/index.htm" class="topLinks" target="_blank" title="Advertise with us">Advertising Programs</a>&nbsp;|&nbsp;<a href="http://www.webdunia.net/" class="topLinks" target="_blank" title="http://www.webdunia.net/">About Webdunia</a>&nbsp;|&nbsp;<a id="uxUserSubmitsite" href="../UserSubmitSite.aspx?lid='+ lang +'" class="topLinks" title="You can submit your website or webpage here">Submit Your Website</a>&nbsp;|&nbsp;<a href="../faq.htm" class="topLinks" title="Queries about crawler">FAQ</a>&nbsp;|&nbsp;<a href="http://info.webdunia.com/disclaimer.htm" class="topLinks" target="_blank" title="http://info.webdunia.com/disclaimer.htm">Disclaimer</a>&nbsp;|&nbsp;<a href="http://info.webdunia.com/privacy.htm" class="topLinks" target="_blank" title="http://info.webdunia.com/privacy.htm">Privacy Policy</a>&nbsp;|&nbsp;<a href="http://info.webdunia.com/tnc.htm" class="topLinks" target="_blank" title="http://info.webdunia.com/tnc.htm">Terms of Service</a></div>'
                                             +'<div id="copy" class="english">&copy; 2007-2008 Webdunia.com </div>';
}
function setClass(){var pid = gpid();if(pid==6 ){var showKB = document.getElementById("showKB");if(showKB!=null) showKB.checked = DSKH; }}
function gpid(){if(window.location.href.toLowerCase().indexOf('searcherror.aspx')>0) return 4;if(window.location.href.toLowerCase().indexOf('customize.aspx')>0) return 4;if(window.location.href.toLowerCase().indexOf('customdemo.aspx')>0) return 5;if(window.location.href.toLowerCase().indexOf('custom.aspx')>0) return 6;  return 1;}
function getCookie(c_name){try { if (document.cookie.length>0) {  c_start=document.cookie.indexOf(c_name + "=");  if (c_start!=-1)    {     c_start=c_start + c_name.length+1 ;    c_end=document.cookie.indexOf(";",c_start);    if (c_end==-1) c_end=document.cookie.length;    return unescape(document.cookie.substring(c_start,c_end));    }   }return "";}catch(err){alert('ErrorCode 201 '+err.description);}}
function cs(){try{var query = getCookie('WSC1');var parms = query.split('&');	for (var i=0; i<parms.length; i++) {var pos = parms[i].indexOf('=');		if (pos > 0) {	var key = parms[i].substring(0,pos);			var val = parms[i].substring(pos+1);csParm[key] = val;}}}catch(err){alert('ErrorCode 202 '+err.description);}}
function qs(){try{var query = window.location.search.substring(1);var parms = query.split('&');for(var i=0; i<parms.length; i++){var pos = parms[i].indexOf('=');		if (pos > 0) {			var key = parms[i].substring(0,pos);			var val = parms[i].substring(pos+1);qsParm[key]  = val;}}}catch(err){alert('ErrorCode 203 '+err.description);}}
function initvar()
{    

    qs();cs();   
    NORPP = NumberOfRecordsPerPage();
    KL = KeyboardLanguage();     
    DWS = doWebSearch();
    DOINW = DoOpenInNewWindow();
    SS = SearchString();  
    BROWSER=BrowserName();
    var l = document.getElementById('lid');
    var n = document.getElementById('num');    
    if(l!=null) l.value = KL;
    if(n!=null) n.value =NORPP;    
  
}
function doWebSearch()
{
    try
    {
        if (qsParm['sod'] != null)
        {
             if (qsParm['sod'].toUpperCase() == 'TRUE') 
             {
                if (qsParm['w'] != null)
                {
                 if (qsParm['w'] == 'true')
                  { return true ;}
                }
               return false ; 
             }
       }
       if (qsParm['w'] != null)
       {
        if (qsParm['w'] == 'true')
         { return true;}
        else
        { return false;}
       }
       else
       { return true;}
  }catch(err){alert('ErrorCode 216 '+err.description);}
 }

function DoOpenInNewWindow(){try{if (csParm != null){if (csParm['IOL'] != null)	{if (csParm['IOL'] == true){ return true; }}return false;}}catch(err){alert('ErrorCode 217 '+err.description);}}
function SearchString(){return window.location.search.substring(1) ; }
function NumberOfRecordsPerPage(){try{var rpg = 10;if (qsParm['num'] == null){if (csParm['H'] != null)  rpg = csParm['H'];}else rpg = qsParm['num'];return rpg;    }catch(err){alert('ErrorCode 219 '+err.description);}}    
function KeyboardLanguage()
{
    try{var lang="HI";
        if(qsParm['lid']==null)
        {        
            if(csParm['IL']!=null)
            {lang=csParm['IL'];}
            else{lang='HI';}
        }
        else{lang=qsParm['lid']};lang=lang.toUpperCase(); return trim(lang.toUpperCase());}catch(err){alert('ErrorCode 215 '+err.description)}}

function BrowserName(){if(navigator.appName == 'Microsoft Internet Explorer') return "IE"; else return "Other"; }
function _wiocliteControlSetProperties(object)
{
    
    try
    {    
         object.sCtx("/sc/wioc21/images/");
         if(object.ctlid=='q')
         {
          object.sSbOn(false);object.sTbEn(false);
          object.sHpOn(true);            
          object.sDcOn(true);
          object.sEgTOn(false);
          object.drwC();          
         }
         if(object.ctlid=='cdq')
         {
            object.sSbOn(false);
            object.sHpOn(false);
            object.sDcOn(true);
            object.sTbEn(false);           
            object.drwC();            
         }
    }catch(err){alert('ErrorCode alert(1); '+err.description)}    
}
function loadControlNew(ctrlID,divID,LangID,ctype,kbdiv)
{
 try
 { 
   var obj=new WEBDWIOCLITE();  
    obj.generateControlWEBD2('4','50',divID,ctrlID,'6',LangID,ctype,kbdiv);
 }catch(err){alert('ErrorCode 113 '+err.description);}
}
function _wiocliteControlLoaded(id)
{

 var ctl=document.getElementById(id); 
  try
  {
    if(id=='cdq')
    {      
      ctl.style.height="17px";
      document.getElementById('hello').style.width="100%";
      document.getElementById('TEXTAREA_cdq').style.width='100%';
      ctl.focus();
    }
    if(gpid()==6)
    {
        if(id=='q')
        {       
         ctl.style.height="17px";                      
         ctl.value=document.getElementById('qOld').value;         
         ctl.focus();
        }
    }
  
 }catch(err){alert('ErrorCode 102 '+err.description)}}
 
function _wiocliteEnterKeyEvent(ctlid){ try{if(ctlid=='cdq'){customDS()};if(ctlid=='q')doSubmitForm();}catch(err){alert('ErrorCode 115 '+err.description)}}
function _wiocliteKeypressed(id,event){try{if(BROWSER=='IE'&&(id=='q'||id=='cdq')){if(document.getElementById(id).value.length>200){event.returnValue=false;return false}}else if(BROWSER!='IE'&&(id=='q'||id=='cdq')){if(document.getElementById(id).value.length>200){event.preventDefault();return false}}}catch(err){alert('ErrorCode 227 '+err.description)}return true}

/*function ss(){ if(gpid()==4){gab('tb','top');gab('bb','bottom');}} */

function gpn(WiocCode){ var lang;if(WiocCode == null) WiocCode = 'HI';switch (WiocCode.toUpperCase()){case 'EN':lang ='english'; break;case 'HI':lang ='hindi'; break;case 'MA':lang = 'marathi'; break;case 'TM':lang = 'tamil'; break;case 'TG':lang = 'telugu'; break;case 'KN':lang = 'kannada'; break;case 'PN':lang = 'punjabi'; break;case 'BN':lang = 'bengali'; break;case 'ML':lang = 'malayalam'; break;case 'GU':lang = 'gujarati'; break; default :lang = 'hindi';}return lang ;}
function getC(lang){switch(lang.toUpperCase()) {case "EN":return 1;case "HI":return 2;case "TM":return 6;case "GU":return 7;case "PN":return 5;case "BN":return 8;case "KN":return 10;case "TG":return 9;case "MA":return 3;case "ML":return 4;default :return 1;}}
function GetClsC(lang){switch(lang.toUpperCase()){case "EN":return 1; case "HI":return 2;case "TM":return 3;case "GU":return 4;case "PN":return 5;case "BN":return 6;case "KN":return 7;case "TG":return 8;case "MA":return 9;case "ML":return 10;default :return 1;}}
function Ulink(lang)
{
var bl='<a target="_blank" href="http://info.webdunia.com/downloadfont.htm" class="topLinks" title="Download Font">Font Download</a>&nbsp;&nbsp;';
if(lang.toUpperCase()=="EN" && gpid()==4)
  document.getElementById("aLinks").innerHTML='<div id="topBar"><div id="topBarleft"><a href="http://hindi.webdunia.com/" target="_blank" class="topLinks" title="hindi.webdunia.com">'
                                            +'Webdunia</a>&nbsp;|&nbsp;<a href="http://news.webdunia.com/" target="_blank" class="topLinks" title="http://news.webdunia.com">News</a>&nbsp;|&nbsp;<a href="http://english.mywebdunia.com/" target="_blank" class="topLinks" title="http://mywebdunia.com">MyWebdunia</a>&nbsp;|&nbsp;</div>'
                                            +'<a href="javascript:void(0)" id="more" class="topLinks" onclick="showSubMenu('+'\'shMenu'+'\')" title="More Properties">More&gt;&gt;</a>'                                            +'<div id="righttop"></div><div id="subMenu" style="z-index: 6050; display: none;" valign="top" onmouseover="showSubMenu('+'\'subMenu'+'\')">'
                                            +'<a href="http://mail.webdunia.com/" target="_blank" class="topLinks">Mail</a>&nbsp;|&nbsp;<a href="http://quest.webdunia.com/" title="http://quest.webdunia.com"  target="_blank" class="topLinks">Quest</a>&nbsp;|&nbsp;<a href="http://games.webdunia.com/" target="_blank" class="topLinks">Games</a>&nbsp;|&nbsp;'
                                            +'<a href="http://mobile.webdunia.com/" title="http://mobile.webdunia.com"  target="_blank" class="topLinks">Mobile</a>&nbsp;|&nbsp;<a href="http://greetings.webdunia.com/english.html" title="http://greetings.webdunia.com/english.html" target="_blank" class="topLinks">Greetings</a>'
                                            +'&nbsp;|&nbsp;<a href="http://classified.webdunia.com/" title="http://classified.webdunia.com" target="_blank" class="topLinks">Classifieds</a>&nbsp;|&nbsp; <a href="http://results.webdunia.com/" target="_blank" title="http://results.webdunia.com" class="topLinks">Results</a>&nbsp;|&nbsp;'
                                            +'<a href="javascript:void(0)" class="topLinks hide" onclick="showSubMenu('+'\'hdMenu'+'\')" title="Hide Properties">&lt;&lt;Hide</a></div></div>';

if(lang.toUpperCase()!="EN" && gpid()==4)
    document.getElementById("aLinks").innerHTML='<div id="topBar"><div id="topBarleft"><a href="http://' + gpn(lang) + '.webdunia.com/" target="_blank" class="topLinks" title="' + gpn(lang) + '.webdunia.com" >Webdunia</a>&nbsp;|&nbsp;'
    			+'<a href="http://' + gpn(lang) + 'news.webdunia.com/" target="_blank" class="topLinks" title="http://' + gpn(lang) + 'news.webdunia.com">News</a>&nbsp;|&nbsp;'
			    +'<a href="http://' + gpn(lang) + '.mywebdunia.com/" target="_blank"  class="topLinks" title="http://' + gpn(lang) + '.mywebdunia.com">MyWebdunia</a>&nbsp;|&nbsp;'
        		+'</div>'                                                                       
		        +'<a href="javascript:void(0)"  id="more" class="topLinks" onClick="showSubMenu('+'\'shMenu'+'\')" title="More Properties">More&gt;&gt;</a>'
		 	    +'<div id="righttop">'+bl+'</div><div id="subMenu" style=" z-index:6050;display:none;" valign="top" onMouseOver="showSubMenu('+'\'subMenu'+'\')">'
				+'<a href="http://mail.webdunia.com/" title="http://mail.webdunia.com"  target="_blank" class="topLinks">Mail</a>&nbsp;|&nbsp;'
				+'<a href="http://quest.webdunia.com/" title="http://quest.webdunia.com"  target="_blank" class="topLinks">Quest</a>&nbsp;|&nbsp;'
				+'<a href="http://games.webdunia.com/index.aspx?id='+ getC(lang)+'&code='+ lang+'" target="_blank" title="http://games.webdunia.com"  class="topLinks" >Games</a>&nbsp;|&nbsp;'
				+'<a href="http://mobile.webdunia.com/" title="http://mobile.webdunia.com"  target="_blank" class="topLinks">Mobile</a>&nbsp;|&nbsp;'
				+'<a href="http://greetings.webdunia.com/'+ gpn(lang)+'.html" title="http://greetings.webdunia.com/'+ gpn(lang)+'.html" target="_blank" class="topLinks">Greetings</a>&nbsp;|&nbsp;'
				+'<a href="http://classified.webdunia.com/index.php?lang='+ GetClsC(lang) +'" title="http://classified.webdunia.com" target="_blank" class="topLinks">Classifieds</a>&nbsp;|&nbsp;'
				+'<a href="http://results.webdunia.com/" target="_blank" title="http://results.webdunia.com" class="topLinks">Results</a>&nbsp;|&nbsp;'
				+'<a href="javascript:void(0)" id="hide" class="topLinks" onClick="showSubMenu('+'\'hdMenu'+'\')" title="Hide Properties">&lt;&lt;Hide</a>'
			    +'</div></div>';
		    
if(lang.toUpperCase()=="EN" && gpid()==6){document.getElementById("aLinks").innerHTML='<div id="topBar"></div>';}
if(lang.toUpperCase()!="EN" && gpid()==6){document.getElementById("aLinks").innerHTML='<div id="topBar"><div id="righttop">'+bl+'</div></div>';}
}

function GetXmlHttpObject(){var objXMLHttp=null;if(window.XMLHttpRequest){objXMLHttp=new XMLHttpRequest();if(objXMLHttp.overrideMimeType){objXMLHttp.overrideMimeType('text/html')}}else if(window.ActiveXObject){try{objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){objXMLHttp=false}}};return objXMLHttp}

function UrlAjaxFn(u,q)
{   

var xmlHttp;
var browser=navigator.appName;
var url;
xmlHttp=GetXmlHttpObject();
if(browser!="Microsoft Internet Explorer")
{
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
}catch(e){}
}
if(!window.XMLHttpRequest)
{
window.XMLHttpRequest=function()
{
try
{
return new ActiveXObject('MSXML2.XMLHTTP.3.0');
}catch(ex){}
}
}
if(xmlHttp==null)
{
alert("Browser does not support HTTP Request");
return;
}
xmlHttp.onreadystatechange=function()
                           {
                            if(xmlHttp.readyState==4)
                            {
                                url="../ShowLink.aspx";
                                try
                                {
                                xmlHttp.open("POST",url,true);
                                }
                                catch(e){alert("Exception : "+e.message);}
                                
                                xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
                                var postdata="u="+encodeURIComponent(u)+"&q="+encodeURIComponent(q);
                                xmlHttp.send(postdata);		        	
                                return true;
                             }
                            }
}

function GetLink(Text,Link,icp,dom,stype)
{
if (icp==null){icp=false;}

var l=document.createElement('li');
var an = document.createElement('a');
if(!icp)
{
an.setAttribute("href","javascript:sfc(" +Link+",'"+dom+"','"+stype+"')");
}
else
{       
    an.style.fontWeight="bold";    
    an.className="currentpage";
}


an.innerHTML = Text;
l.appendChild(an);
return l;
}

function sfc(pcp,dom,stype)
{
var logoUrl=document.getElementById('logourl').value;
var Custom='';
if(document.getElementById('custom')!=null)
 Custom=document.getElementById('custom').value;
var q= document.getElementById('qOld').value;
var sod=document.getElementById('sod').value;
CP = pcp;        
           
    if(dom.length >0)
        window.location = "custom.aspx?lid="+ KL + "&num="+ NORPP + "&dom="+ qsParm['dom'] + "&q="+replaceAll(escape(q),'+')+"&w=" +DWS+ "&logourl="+ logoUrl+"&custom="+Custom +"&sod="+ sod +"&cp="+ pcp+"&st="+stype;
    else
        window.location = "custom.aspx?lid="+ KL + "&num="+ NORPP + "&q="+replaceAll(escape(q),'+')+"&w=" +DWS+ "&logourl="+ logoUrl+"&custom="+Custom +"&sod="+ sod +"&cp="+ pcp+"&st="+stype;
   
}
function replaceAll(strTarget,str)
{
   var strText=strTarget;
   var intIndexOfMatch=0;
   for (var i = 0; i < strTarget.length; i++ )
   {
     intIndexOfMatch = strText.indexOf(str);    
     strText = strText.replace( str, '%2b');
   }  
return strText;
}
function lpg(ParentId,cpi,tp,dom,nxt,prev,stype)
{

    cpi=parseInt(cpi);
    tp=parseInt(tp);
    
    var pager = document.getElementById(ParentId);
    var start=1;var end=1;

    if(cpi == null) cpi =1;
    var pl =5;
    if (tp > 1)
    {
        if (tp  <= pl)
        {
            start = 1;
            end = tp;
        }
        else
        {
            start = (((cpi - 1) / pl) * pl) + 1;
            if(start+pl > tp)
            {
                start = tp-pl+1;
            }
            end = start + pl-1;
        }
        if ( start > 1){pager.appendChild(GetLink(prev,cpi - 1,false,dom,stype));}  
        for (; start <= end; start++){pager.appendChild(GetLink(start,start,cpi==start,dom,stype));}
        if (start <= tp){pager.appendChild(GetLink(nxt,parseInt(cpi)+1,false,dom,stype));}
       
    }
}
function getWctrl()
{

var ev='';
var subfn="customDS();"
if(gpid()==6)  subfn="doSubmitForm();"; 

var Wtbl='<table border="0" cellspacing="0" cellpadding="0" align="top"><tr><td align="center" valign="middle"><div class="wd-icon"></div></td><td align="center" valign="middle" title="webdunia search">'
+'<div class="textfieldOuter"><div style="padding-top:7px;"></div><div id="hello"></div></div></td><td align="center" valign="middle"><a href="javascript:void(0)" onclick="'+subfn+'" id="uxSearchButton" title="search" >'
+'<div class="src-icon" '+ev+'></div></a></td>'
+'</tr></table>';

document.getElementById('searchmain_b').innerHTML=Wtbl;
}

function get3Div()
{
   var tbl2='';
   var divdict='';
   var kbDiv='';
   var divMsg=''; 
   divMsg= document.getElementById('dvmsg').innerHTML;
        tbl2='<div id="tbl2B" style="display: none;position: absolute;">';
        divdict='<div id="dictCus" style="display:none; position:absolute; background-color:#FFFFFF; border:1px solid #E2E2E0; vertical-align:top; margin-left: 290px;top:128px;" align="right">';
        //kbDiv='<div id="kb_q" style="position:absolute;" align="center">';
        
        
   var rem= tbl2 + '<div id="tipcontent" style="float: left; margin-left: 4px;"><div id="hlptxt">'+divMsg+'</div>'
           +'</div><div id="close2" onclick="newh('+'\'tbl2B'+'\');" class="closeBtn2" style="margin-top: 5px;width: 12px; float: right; height: 10px;">'
           +'</div></div>'+ divdict+'<a href="javascript:void(0)" onclick="newh('+'\'dict'+'\');"><div id="close3" onclick="newh('+'\'dictCus'+'\');" class="closeBtn2" style="width: 10px;height:10px;">'
           +'</div></a><table><tr><td><div class="dictrow"><div class="dictinput"><input name="" type="text" class="inputdict" autocomplete="off" id="dictxt" onkeypress="Findkey('+'\'dictxt'+'\',event);" onkeydown="Findkey('+'\'dictxt'+'\',event);"/>'
           +'</div><div class="dict_arrow" onclick="on_click();return false;"></div></div> </td></tr><tr><td><div id="dict1" style="display:none;" ></div></td></tr></table></div>'
           +'</div>';
           
   document.getElementById('searchmain_d').innerHTML=rem;
}

function newsh(val){
	if(val=='kb_q'){
		document.getElementById('searchmain_d').style.display="none";   	    
		//document.getElementById('kb_q').style.display="block";
		document.getElementById('tbl2B').style.display="none";
		document.getElementById('dictCus').style.display="none";
	}
	if(val=='tbl2B'){	    
	    document.getElementById('searchmain_d').style.display="block";
		//document.getElementById('kb_q').style.display="none";
		document.getElementById('tbl2B').style.display="block";
		document.getElementById('dictCus').style.display="none";		
		objCustom.wiocKeyboard.displayKeyboard(false);
	}
	if(val=='dictCus'){	    
		document.getElementById('dictCus').style.display="block";
		document.getElementById('dictxt').value="";					
		document.getElementById('dict1').style.display="none";	
		//document.getElementById('kb_q').style.display="none";
		document.getElementById('tbl2B').style.display="none";
		document.getElementById('searchmain_d').style.display="block";
		objCustom.wiocKeyboard.displayKeyboard(false);
		document.getElementById('dictxt').focus();
	}
}
function newh(val){
	if(val=='kb_q'){	   
	    document.getElementById('searchmain_d').style.display="none"; 
		//document.getElementById('kb_q').style.display="none";
		document.getElementById('tbl2B').style.display="none";
		document.getElementById('dictCus').style.display="none";
		objCustom.wiocKeyboard.displayKeyboard(false);
	}
	if(val=='tbl2B'){	 
	    document.getElementById('searchmain_d').style.display="none";    
		//document.getElementById('kb_q').style.display="none";
		document.getElementById('tbl2B').style.display="none";
		document.getElementById('dictCus').style.display="none";
	}
	if(val=='dictCus'){		
	    document.getElementById('dict1').style.display="none";
		document.getElementById('dictCus').style.display="none";
		document.getElementById('dictxt').value="";				
		document.getElementById('searchmain_d').style.display="none"; 
		//document.getElementById('kb_q').style.display="none";
		document.getElementById('tbl2B').style.display="none";		
	}
}
function showSubMenu(val){
	if(val=='shMenu'){
		document.getElementById('subMenu').style.display="block";
		document.getElementById('more').style.display="none";
		document.getElementById('righttop').style.display="none";
	}
	if(val=='hdMenu'){
		document.getElementById('subMenu').style.display="none";
		document.getElementById('more').style.display="block";
		document.getElementById('righttop').style.display="block";
		}
}
function setBtn3(obj){
		obj.className=obj.className=="fdbbtn"?"fdbbtnoff":"fdbbtn";
		obj.title=obj.title=="feedback Off"?"feedback On":"feedback Off";
		if(obj.className=='fdbbtnoff'){
		document.getElementById('feedBackB').style.display="block";
		document.getElementById('apDiv4').style.display="none";
		document.getElementById('feedBackP').style.display="none";
		}
	}
function showfeedback(val){
	if(val=='feedBackP'){
		document.getElementById('feedBackB').style.display="none";
		document.getElementById('feedBackP').style.display="block";
		document.getElementById('apDiv4').style.display="block";
	}
	else{
		document.getElementById('apDiv4').style.display="none";
		document.getElementById('feedBackP').style.display="none";
		document.getElementById('feedBackB').style.display="block";
		}
}
function showfeedback2(val){
	if(val=='feedBackP'){
		document.getElementById('feedBackB').style.display="block";
		document.getElementById('apDiv4').style.display="none";
		document.getElementById('feedBackP').style.display="none";
		document.getElementById('hideFeed').className="fdbbtnoff";
	}else{
		document.getElementById('apDiv4').style.display="none";
		document.getElementById('feedBackP').style.display="none";
		document.getElementById('feedBackB').style.display="none";
		}
}
function changLang(obj){
		obj.className=obj.className=="langBtnOn"?"langBtnOff":"langBtnOn";
	}
function setBtn2(obj){
		obj.className=obj.className=="suggestionsChOn"?"suggestionsChOff":"suggestionsChOn";
		obj.title=obj.title=="Suggestions Check Box Off"?"Suggestions Chech Box On":"Suggestions Check Box Off";
	}
function setBtn5(obj){
		obj.className=obj.className=="normal"?"boldText":"normal";
	}
function testKeyCode(e)
 {
     var keycode;
         if (window.event)
         { keycode = window.event.keyCode;}
         else{ if (e) keycode = e.which; }
         
         var e = e || window.event;
             if(keycode==81 && e.altKey)
             document.getElementById(objCustom.getTextAreaID().id).focus();
 }
 function clearData(obj){
	if(obj.value == obj.title)
		obj.value="";
		obj.style.color = "#333333";
}
function getData(obj){
	if(obj.value == ""){
    	obj.value = obj.title;
		obj.style.color = "#cccccc";
    }
}
function Findkey(ctrlid,keyPressed)
{  
var code;

if (BROWSER=='IE')
{code =  keyPressed.keyCode;}
else{code =  keyPressed.which;}			

if((code == 13 || code == 40 || code == 38))
{             
if(code == 40)
{  
if(document.getElementById(index+"_"+ctrlid) != null)   
document.getElementById(index+"_"+ctrlid).className = 'dict_link';
if(document.getElementById('0'+"_"+ctrlid) != null)   
document.getElementById('0'+"_"+ctrlid).className = 'dict_link';   
index = index + 1;   	              
if(index > cnt)
{
index = 0;  
if(document.getElementById((cnt+"_"+ctrlid)) != null)    
document.getElementById((cnt+"_"+ctrlid)).className = 'dict_link';     
}

if(index > 0)
{                         
if(document.getElementById((index-1)+"_"+ctrlid) != null)    
document.getElementById((index-1)+"_"+ctrlid).className = 'dict_link';       
} 

if(document.getElementById(index+"_"+ctrlid) != null)   
document.getElementById(index+"_"+ctrlid).className = 'dict_link_over';         

if (navigator.appName == 'Microsoft Internet Explorer')
{ keyPressed.returnValue = false;}
else{keyPressed.preventDefault();return false;}						  

return false;	             
}
else if(code == 38)
{      
if(document.getElementById(index+"_"+ctrlid) != null)   
document.getElementById(index+"_"+ctrlid).className = 'dict_link';

if(document.getElementById('0'+"_"+ctrlid) != null)   
document.getElementById('0'+"_"+ctrlid).className = 'dict_link';

index = index - 1;         

if(index < 0 )
{
index = cnt;      
if(document.getElementById('0'+"_"+ctrlid) != null)
document.getElementById('0'+"_"+ctrlid).className = 'dict_link';     
}    

if(index >= 0 && index < cnt)
{       
if(document.getElementById((index+1)+"_"+ctrlid) != null)         
document.getElementById((index+1)+"_"+ctrlid).className = 'dict_link';                                         
}  

if(document.getElementById(index+"_"+ctrlid) != null)    
document.getElementById(index+"_"+ctrlid).className = 'dict_link_over';                                                   

if (navigator.appName == 'Microsoft Internet Explorer')
{
keyPressed.returnValue = false;
}
else
{
keyPressed.preventDefault();			
return false;
}				
return false;	         			 
}
else if(code == 13)
{            
setValue(ctrlid,keyPressed);
}//else
}//if
}	//fn
function getLang(lang){ switch(lang.toUpperCase()){case "HI": return "hi-IN";case "TM": return "ta-IN";case "GU": return "gu-IN";case "PN": return "pa-IN";case "BN": return "x-bn-IN";case "KN": return "kn-IN";case "TG": return "te-IN";case "MA": return "mr-IN";case "ML": return "x-ml-IN";default:return "hi-IN"; }   }
function on_click() {if(document.getElementById("dict1").style.display=="block")document.getElementById("dict1").style.display="none";if(document.getElementById("dictxt").value.length>0){
index=0;cnt=1;ajaxObj=ajaxObject();
//var serviceUrl="http://localhost:2972/Search/Services/dictionary.asmx";
//var serviceUrl="http://searchtest.webdunia.com/Services/dictionary.asmx";
var serviceUrl="http://search.webdunia.com/Services/dictionary.asmx";
var key=document.getElementById("dictxt").value;
var soapEnvelop= "<?xml version='1.0' encoding='utf-8'?>"; 
soapEnvelop+= "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "; 
soapEnvelop+= "xmlns:xsd='http://www.w3.org/2001/XMLSchema' "; 
soapEnvelop += "xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"; 
soapEnvelop += "<soap:Body><getDictMeaning xmlns='http://tempuri.org/'>"; 
soapEnvelop += "<keyword>";
soapEnvelop += key;
soapEnvelop += "</keyword>";
soapEnvelop += "<lang>";
soapEnvelop += getLang(KL);
soapEnvelop += "</lang>";
soapEnvelop += "</getDictMeaning></soap:Body></soap:Envelope>"; 
ajaxObj.onreadystatechange = state_Change; 
ajaxObj.open("POST", serviceUrl, true); 
ajaxObj.setRequestHeader ("Content-Type", "text/xml"); 
ajaxObj.setRequestHeader ("SOAPAction", "http://tempuri.org/getDictMeaning");     
ajaxObj.send(soapEnvelop); 
}}

var ajaxObject = function(){
try{return new XMLHttpRequest();}catch(ex){};
try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){};
try{return new SOAPCall();}catch(ex){};
}
function state_Change() 
{   
if (ajaxObj.readyState==4)
{         
var strToShow="<table width='100%' border='0' cellpadding='3' cellspacing='0' class='HI1' style='padding-top: 2px;'>";
if (ajaxObj.status==200)
{
if(navigator.userAgent.indexOf("MSIE") >= 0)
{
var responseXml = new ActiveXObject('Microsoft.XMLDOM');        
responseXml.loadXML(ajaxObj.responseText);                                                                 
var responseNode = responseXml.selectSingleNode("//" +"getDictMeaningResponse//Table[@diffgr:id=\"Table" + cnt+"\"]");              

if(!responseNode)
responseNode = responseXml.selectSingleNode("//" +"getDictMeaningResult//Table[@diffgr:id=\"Table" + cnt+"\"]");               

while(responseNode!=null)
{ 
strToShow=strToShow+"<tr><td><div id='"+index+"_dictxt'   class='dict_link'   onmouseover=\"suggestOver(this,'dictxt')\" onmouseout=\"suggestOut(this)\" onclick=\"setValue('dictxt',event)\" >"+responseNode.lastChild.text+"</div></td></tr>";
cnt=cnt+1;                 
index=index+1;               
if(cnt==6)  break;
responseNode = responseXml.selectSingleNode("//" +"getDictMeaningResponse//Table[@diffgr:id=\"Table" + cnt+"\"]");                                                                 
}

}
else
if(navigator.userAgent.indexOf("Gecko") >= 0)
{
var icnt=0;
//Mozilla
var xmlDocument = new DOMParser().parseFromString(ajaxObj.responseText, "text/xml");                                                 
var xmlText=xmlDocument.getElementsByTagName('Table'); 

for(index=0;index<xmlText.length;index++)
{   
icnt++;
var eTA=xmlText[index].getElementsByTagName('keywords');
strToShow=strToShow+"<tr ><td><div id='"+index+"_dictxt' class='dict_link' onmouseover=\"suggestOver(this,'dictxt')\" onmouseout=\"suggestOut(this)\" onclick=\"setValue('dictxt',event)\" >"+eTA[0].firstChild.nodeValue+"</div></td></tr>";
if(icnt==6) break;
}            
}

index=index-1;
cnt=index;
document.getElementById("dict1").style.display="block";        

if(index>=0)
{  
document.getElementById("dict1").innerHTML= strToShow +"</table>";            
document.getElementById("dict1").focus();
document.getElementById("dictxt").focus();

} 
else
{ document.getElementById("dict1").innerHTML=strToShow+ "<tr><td>Sorry! No meaning found</td></tr></table>";}
}
else 
{
document.getElementById("dict1").style.display="block";        
 document.getElementById("dict1").innerHTML=strToShow+ "<tr><td>Sorry! No meaning found</td></tr></table>";
} 

}
}
function setValue(ctrlid,keyPressed)
{
if( document.getElementById("dict1").style.display=="block")
{            
for(index = 0; index<=cnt;index++)
{             
if(document.getElementById(index+"_"+ctrlid) != null)
{
if(document.getElementById(index+"_"+ctrlid).className == 'dict_link_over')
{                             
document.getElementById(objCustom.getTextAreaID().id).value=trim(document.getElementById(index+"_"+ctrlid).innerHTML); 
document.getElementById(index+"_"+ctrlid).className='dict_link';                   

document.getElementById(objCustom.getTextAreaID().id).setAttribute("autocomplete","off");
setTimeout("document.getElementById(objCustom.getTextAreaID().id).select();document.getElementById(objCustom.getTextAreaID().id).focus()",0);

index = 0;                                                         

if (BROWSER=='IE')
{ 	              
keyPressed.returnValue = false;
return false;	
}
else
{			         
keyPressed.preventDefault();		
return false;
}
}
}
}
}
{
on_click();
if (BROWSER=='IE')
{ 	              
keyPressed.returnValue = false;  
return false; 		
}
else
{
keyPressed.preventDefault();		
return false;
}	
}
}

function suggestOver(div_value,textID) 
{   
var max=cnt;            
if(max > 0 && div_value.id.charAt(0) != "0")
document.getElementById('0_'+textID).className = 'dict_link';        
div_value.className = 'dict_link_over';
}
function suggestOut(div_value) 
{
div_value.className = 'dict_link';
}
function clearData(obj){
	if(obj.value == obj.title)
		obj.value="";
		obj.style.color="black";			
}
function getData(obj){
	if(obj.value == ""){
    	obj.value = obj.title;	
		obj.style.color="Silver";
    }
}

