﻿// JScript File
function change(path)
{
    try
    {
        var a=document.getElementById("ctl00_Search1_hdnflash").value;
	    document.getElementById("logo").innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='240' height='90' title='citybeautiful.in'><param name='movie' value='"+path+"/flash/"+ a + "' /><PARAM NAME='wmode' value='transparent'><param name='quality' value='high' /><embed src='"+path+"/flash/"+ a + "' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='240' height='90'></embed></object>";
	    //document.getElementById("banner1").innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='317' height='83'><param name='movie' value='"+path+"/flash/video.swf' /><param name='wmode' value='transparent' /><param name='quality' value='high' /><embed src='"+path+"/images/video.swf' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='317' height='83'></embed></object>";
	    document.getElementById("banner1").innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='317' height='83'><PARAM NAME='wmode' value='transparent'><param name='embed' value='transparent'><param name='movie' value='"+path+"/flash/video.swf'><param name='quality' value='high'><embed src='"+path+"/images/video.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='317' height='83'></embed></object>";
    }
    catch(ex)	
    {
    }
}

function doEnter(btnid)
{
   try{
        var btn = document.getElementById(btnid);
      }catch(ex)
      {
      }
        if(window.Event)
        {
            window.captureEvents(Event.KEYPRESS)
        }
        document.onkeypress = keyPressed;
        function keyPressed(e)
        {
            var n;
            (window.Event) ? n=e.which : n=event.keyCode;
            if(n==13)
            {
                btn.click();
                return false;
            }
        }
}

function fillstate()
{
    try{
        document.getElementById("ctl00_ContentPlaceHolder1_hdnState").value=document.getElementById("ctl00_ContentPlaceHolder1_ddlState").value;
      }catch(ex)
      {
      }
}

 function underline(id)
  {
      try{
        document.getElementById(id.id).style.textDecoration="underline";
        }catch(ex)
        {
        }
  }
  function removeunderline(id)
  {
      try{
            document.getElementById(id.id).style.textDecoration="none";
        }catch(ex)
        {
        }
  }


function checkvali()
{

var p=2;
try
{
    if (document.getElementById ("Happeningplace1_rdOptions_0").checked == true )
    {
        p=1;
    }
    if (document.getElementById ("Happeningplace1_rdOptions_1").checked == true )
    {
        p=1;
    }
    if (document.getElementById ("Happeningplace1_rdOptions_2").checked == true )
    {
        p=1;
    }
    if ( document.getElementById ("Happeningplace1_rdOptions_3").checked == true )
    {
        p=1;
    }
}
catch(ex)
{
}

    if (p== 2)
    {
        alert ('Please select any poll option');
        return false;
    }
    else
    {
        return true;
    }
}


var objDate;
            
    function setloop()
    {
        try
        {
            objDate= new Date(document.getElementById('ctl00_lbldt').innerHTML);
            setInterval('ShowDateTime()', 1000);
        }
        catch(ex)
        {
        }
    }
    
    function ShowDateTime()
    {
        var nhours=objDate.getHours();
        var nmins=objDate.getMinutes();
        var nsecn=objDate.getSeconds();
        var nday=objDate.getDay();
        var nmonth=objDate.getMonth();
        var ntoday=objDate.getDate();
        var nyear=objDate.getYear();
        var AorP=" ";
        var mth="";
        
        try
        {
             if (nhours>=12)
            AorP="P.M.";
            else
                AorP="A.M.";

            if (nhours>=13)
                nhours-=12;

            if (nhours==0)
               nhours=12;

            if (nsecn<10)
             nsecn="0"+nsecn;

            if (nmins<10)
             nmins="0"+nmins;

            if (nday==0)
              nday="Sun";
            if (nday==1)
              nday="Mon";
            if (nday==2)
              nday="Tue";
            if (nday==3)
              nday="Wed";
            if (nday==4)
              nday="Thu";
            if (nday==5)
              nday="Fri";
            if (nday==6)
              nday="Sat";

            nmonth+=1;
            if(nmonth== 1)
                mth="Jan";
            if(nmonth== 2)
                mth="Feb";
            if(nmonth== 3)
                mth="Mar";
            if(nmonth== 4)
                mth="Apr";
            if(nmonth== 5)
                mth="May";
            if(nmonth== 6)
                mth="Jun";
            if(nmonth== 7)
                mth="Jul";
            if(nmonth== 8)
                mth="Aug";
            if(nmonth== 9)
                mth="Sep";
            if(nmonth== 10)
                mth="Oct";
            if(nmonth== 11)
                mth="Nov";
            if(nmonth== 12)
                mth="Dec";

            if (nyear<=99)
              nyear= "19"+nyear;

            if ((nyear>99) && (nyear<2000))
             nyear+=1900;
        
            document.getElementById('ctl00_lbldt').innerHTML= nday+", "+ ntoday + " " + mth+ " " +nyear+ " " + nhours+":"+nmins+":"+nsecn+" "+AorP;
            objDate.setSeconds(objDate.getSeconds() +1);
        }
        catch(ex)
        {
        }    
    }
    
    
    

    
    
function Display_Divsuzz()
{
    var id1=document.getElementById('HelpUsImprove');

    var pos=findPos(id1);
   
    try
    {
        var a=-30;
        var b=195;
        document.getElementById("banner1").style.visibility="hidden";
        document.getElementById("suzz").style.display= "block" ;
        document.getElementById("suzz").style.top=parseInt(pos[1])+parseInt(a)+"px";
        document.getElementById("suzz").style.left=parseInt(pos[0])-parseInt(b)+"px";
    }
    catch(ex)
    {
    }
}

function hidesuzz_div()
{
    try
    {
        document.getElementById("suzz").style.display= "none" ;
        document.getElementById("banner1").style.visibility= "visible" ;
    }
    catch(ex)
    {
    }
}

function findPos(obj)
{
    var curleft = curtop = 0;
    if (obj.offsetParent) 
    {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) 
        {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
    }
    return [curleft,curtop];
}


var my_Boxes 
 
function toggle(id,myarr)
{
    try
    {
        my_Boxes=myarr
        //NormalAllTags();
        name=id
    
    if (name == 'LocalDiv')
    {
        document.getElementById("LocalDiv").className="tabShow"
        document.getElementById("WorldDiv").className="tabShowRoll" 
        document.getElementById("FinanceDiv").className="tabShowRoll"
        document.getElementById("SportsDiv").className="tabShowRoll"
    }
    if (name == 'WorldDiv')
    {
        document.getElementById("LocalDiv").className="tabShowRoll"
        document.getElementById("WorldDiv").className="tabShow" 
        document.getElementById("FinanceDiv").className="tabShowRoll"
        document.getElementById("SportsDiv").className="tabShowRoll"
    }
    if (name == 'FinanceDiv')
    {
        document.getElementById("LocalDiv").className="tabShowRoll"
        document.getElementById("WorldDiv").className="tabShowRoll" 
        document.getElementById("FinanceDiv").className="tabShow"
        document.getElementById("SportsDiv").className="tabShowRoll"
    }
    if (name == 'SportsDiv')
    {
        document.getElementById("LocalDiv").className="tabShowRoll"
        document.getElementById("WorldDiv").className="tabShowRoll" 
        document.getElementById("FinanceDiv").className="tabShowRoll"
        document.getElementById("SportsDiv").className="tabShow"
    }
    
        document.getElementById(name).height="24"
        document.getElementById(name).className="tabShow" 
        //name=name.substring(0,name.lastIndexOf('txt'))
//        document.getElementById(name+'line').height="1";
//        document.getElementById(name+'line').className="";

            if(name == 'LocalDiv')
            {
                document.getElementById("divLocal").style.display="block"
                document.getElementById("divWorld").style.display="none"
                document.getElementById("divFinance").style.display="none"
                document.getElementById("divSports").style.display="none"
            }
            if(name == 'WorldDiv')
            {
               document.getElementById("divLocal").style.display="none"
                document.getElementById("divWorld").style.display="block"
                document.getElementById("divFinance").style.display="none"
                document.getElementById("divSports").style.display="none"
            }
            if(name == 'FinanceDiv')
            {
                document.getElementById("divLocal").style.display="none"
                document.getElementById("divWorld").style.display="none"
                document.getElementById("divFinance").style.display="block"
                document.getElementById("divSports").style.display="none"
            }
            if(name == 'SportsDiv')
            {
                document.getElementById("divLocal").style.display="none"
                document.getElementById("divWorld").style.display="none"
                document.getElementById("divFinance").style.display="none"
                document.getElementById("divSports").style.display="block"
            }
        
    }
    catch(ex)
    {
    }
    
  }
  
function toggle1(id,myarr)
{
  try
    {
        my_Boxes=myarr
        NormalAllTags();
        name=id
  
    if (name == 'EntertainmentDiv')
    {
        document.getElementById("EntertainmentDiv").className="tabShow"
        document.getElementById("DownloadDiv").className="tabShowRoll" 
        document.getElementById("GamesDiv").className="tabShowRoll"
        document.getElementById("EventsDiv").className="tabShowRoll"
    }
    if (name == 'DownloadDiv')
    {
        document.getElementById("EntertainmentDiv").className="tabShowRoll"
        document.getElementById("DownloadDiv").className="tabShow" 
        document.getElementById("GamesDiv").className="tabShowRoll"
        document.getElementById("EventsDiv").className="tabShowRoll"
    }
    if (name == 'GamesDiv')
    {
        document.getElementById("EntertainmentDiv").className="tabShowRoll"
        document.getElementById("DownloadDiv").className="tabShowRoll" 
        document.getElementById("GamesDiv").className="tabShow"
        document.getElementById("EventsDiv").className="tabShowRoll"
    }
    if (name == 'EventsDiv')
    {
        document.getElementById("EntertainmentDiv").className="tabShowRoll"
        document.getElementById("DownloadDiv").className="tabShowRoll" 
        document.getElementById("GamesDiv").className="tabShowRoll"
        document.getElementById("EventsDiv").className="tabShow"
    }
    
        document.getElementById(name).height="24"
        document.getElementById(name).className="tabShow" 
      

            if(name == 'EntertainmentDiv')
            {
                document.getElementById("divEntertainment").style.display="block"
                document.getElementById(myarr[4]).style.display="block"
            }
            if(name == 'DownloadDiv')
            {
                document.getElementById('divDownload').style.display="block"
                document.getElementById(myarr[4]).style.display="none"
            }
            if(name == 'GamesDiv')
            {
                document.getElementById('divGames').style.display="block"
                document.getElementById(myarr[4]).style.display="none"
            }
            if(name == 'EventsDiv')
            {
                document.getElementById('divEvents').style.display="block"
                document.getElementById(myarr[4]).style.display="none"
            }
        
    }
    catch(ex)
    {
    }
}

function NormalAllTags()
{
     var item_to_normal;
     try{
    
         for(i=0; i<my_Boxes.length; i++)
         {
            item_to_normal=my_Boxes[i]
            document.getElementById(item_to_normal).style.display="none"
             
             if(item_to_normal== 'divLocal')
             {
                document.getElementById("LocalDiv").className="tabShow" 
             }
             if(item_to_normal== 'divWorld')
             {
                document.getElementById('WorldDiv').className="tabShow" 
             }
             if(item_to_normal== 'divFinance')
             {
                document.getElementById('FinanceDiv').className="tabShow" 
             }
             if(item_to_normal== 'divSports')
             {
                document.getElementById('SportsDiv').className="tabShow" 
             }
             
            
//            itemline_to_normal = item_to_normal + 'line'
//            document.getElementById(itemline_to_normal).className="line_bg"           
                
         }
     }catch(ex)
     {
     }    
  }
  
  
  function underline(id)
  {
      try
      {
        document.getElementById(id.id).style.textDecoration="underline";
      }
      catch(ex)
      {
      }
  }
  
  function removeunderline(id)
  {
      try
      {
        document.getElementById(id.id).style.textDecoration="none";
      }
      catch(ex)
      {
      }
  }
  

function AjaxCall(id, name)
{
    var divId="div"+id;
    var a=document.getElementById(divId)
    if(a.value!="")
    {  
         $.ajax
            ({
                type: "Get",
                url: name,
                data: id+"="+divId,
                beforeSend:function()
                {
                    jQuery("div#"+divId).html('<div align="center" valign="center" style="height:50px;"><img src="images/load.gif" border="0" valign="middle"/></div>');
                    //a.innerHTML= '<div align="center" valign="center" style="height:50px;"><img src="images/load.gif" border="0" valign="middle"/></div>';
                },
                success: function(msg)
                {
                    jQuery("div#"+divId).html(msg);
                }				
	       });
        }
  }
 function urlencode(str) 
 {
        str = escape(str);
        str = str.replace('+', '%2B');
        str = str.replace('%20', '+');
        str = str.replace('*', '%2A');
        str = str.replace('/', '%2F');
        str = str.replace('@', '%40');
        return str;
}

    function urldecode(str) 
    {
        str = str.replace('+', ' ');
        str = unescape(str);
        return str;
    }
    
 function showCalender()
  {
     try
     {
        alert("aa");
        document.getElementById('ctl00_ContentPlaceHolder1_CalenderControl1_calendar').visible= true ;
     }
     catch(ex)
     {
     }
  }
  
  function chkContent()
  {
  try{
     var a=document.getElementById('ctl00_ContentPlaceHolder1_FreeTextBox1').value;
     }catch(ex)
     {
     }
        
        if(a.length>100000)
        {
        alert("Content limit should not be greater than 1,00,000");
        }
        return false;  
  }
  function displaytrailer(id1,id2)
  {
    try
    {
       window.open("movies/frmMovieTrailer.aspx?movieid="+id1+"&moviepath="+id2,"a","height=200,width=230,top=20,left=100");
    }
    catch(ex)
    {
    }
  }
  
  function getText(id)
  {
    var a = id;
    a = a.substr(2,a.length);
    document.getElementById('ctl00_Search1_txtsearch').value=a;
  }
  function CheckAllDataGridCheckBoxes(aspCheckBoxID,checkVal,rows,gridname)
 {
    try
     {
      rows = rows + 2;
      for(i = 0; i < document.forms[0].elements.length; i++)
      {
       elm = document.forms[0].elements[i].type
       if (elm == "checkbox")
       {
        for(j=2;j<rows;j++)
        {
            var a;
            if(j<10)
            {
             a = "ctl00_ContentPlaceHolder1_"+gridname+"_ctl0"+j+"_chk";
            }
            else
            {
                a = "ctl00_ContentPlaceHolder1_"+gridname+"_ctl"+j+"_chk";
            }
            document.getElementById(a).checked=checkVal;
            
        }
       }
      }
      }
      catch(ex)
      {
      }
 }
 
function  onefunction()
{
    var chk="";
    chk=showErrorwhenNotChecked()
    
    if(chk==true)
        {
     return disp_confirm();
     
        }
        else
        return false;
}
function disp_confirm()
{
   var r=confirm('Are you sure, you want to delete these record');
   
 if(r==false)
  {
  return false;
  }
 
}

function  onefunction12()
{
    var chk="";
    chk=showErrorwhenNotChecked()
    
    if(chk==true)
        {
     return disp_confirm12();
     
        }
        else
        return false;
}
function disp_confirm12()
{
   var r=confirm('Are you sure, you want to block these IP');
   
 if(r==false)
  {
  return false;
  }
 
}



function showErrorwhenNotChecked()
{
    var ch="true";
    for(var i=0; i < document.forms[0].elements.length; i++)
        {
            var elmnt = document.forms[0].elements[i].type;
            if(elmnt=="checkbox")
            {
                if(document.getElementById(document.forms[0].elements[i].id).checked==true)
                {
                  ch="false";
                }
            }
        }
        if(ch=="true")
        {
        alert("Please select at least one record");
        return false;
        }
        else
        {
        return true;
        }
}


function  CheckFunction()
{
    var chk="";
    chk=showErrorwhenNotChecked()
    
    if(chk==true)
        {
          return Check_Confirm();
        }
        else
        return false;
}

function Check_Confirm()
{
   var r=confirm('There are records associated with the selected user(s), Deleting the user will delete all the associated records. "<br/>" Are you sure, you want to delete these record');
   
 if(r==false)
  {
  return false;
  }
 
}

function windowopenlargeimages(a,b)
{
    var pollstyle="";
    //pollstyle=readCookie("ckstylesheet");
     window.open("largeimage.aspx?photopath="+a+"&imgname="+ b + "&style="+pollstyle,"ovb","Top=55px,Height=670px,Width=900px,Left=50px,scrollbars = 1,resizable=1");
   // window.open ("largeimage.aspx?photopath="+a+"&style="+pollstyle,"ovb","Top=50px,Height=250px,Width=300px,Left=200px,resizable=1");

}

function windowopenlargeTouristimages(a,b)
{
    var pollstyle="";
    //pollstyle=readCookie("ckstylesheet");
     window.open("EnlargeImage.aspx?photopath="+a+"&imgname="+ b + "&style="+pollstyle,"ovb","Top=55px,Height=670px,Width=800px,Left=100px,scrollbars = 1,resizable=1");
   // window.open ("largeimage.aspx?photopath="+a+"&style="+pollstyle,"ovb","Top=50px,Height=250px,Width=300px,Left=200px,resizable=1");

}
           
function windowopenlargeAlbumImages(a, b)
{
    var pollstyle="";
    //pollstyle=readCookie("ckstylesheet");
     window.open("PhotoAlbumEnlargeImage.aspx?AlbumImage="+a+"&AlbumCaption="+ b+"&style="+pollstyle,"ovb","Top=55px,Height=670px,Width=900px,Left=50px,scrollbars = 1,resizable=1");
   // window.open ("largeimage.aspx?photopath="+a+"&style="+pollstyle,"ovb","Top=50px,Height=250px,Width=300px,Left=200px,resizable=1");

}
           
        function windowopengameplay(a,b)
           {
                var pollstyle="";
                //pollstyle=readCookie("ckstylesheet");
                 window.open ("popupgames.aspx?gamefile="+a+"&style="+pollstyle+"&name="+b,"ovb","Top=55px,Height=900px,Width=900px,Left=100px,scrollbars = 1,resizable=1");
               // window.open ("largeimage.aspx?photopath="+a+"&style="+pollstyle,"ovb","Top=50px,Height=250px,Width=300px,Left=200px,resizable=1");

           }
           function windowopengameplay1(a,b)
           {
                var pollstyle="";
                pollstyle=readCookie("ckstylesheet");
                 window.open ("games/popupgames.aspx?gamefile="+a+"&style="+pollstyle+"&name="+b,"ovb","Top=55px,Height=900px,Width=900px,Left=100px,scrollbars = 1,resizable=1");
               // window.open ("largeimage.aspx?photopath="+a+"&style="+pollstyle,"ovb","Top=50px,Height=250px,Width=300px,Left=200px,resizable=1");

           }
           function windowopenforsendnews()
           {
                var pollstyle="";
                pollstyle=readCookie("ckstylesheet");
                 window.open ("sendnewsonmail.aspx?style="+pollstyle,"ovb","Top=155px,Height=220px,Width=560px,Left=150px");
               // window.open ("largeimage.aspx?photopath="+a+"&style="+pollstyle,"ovb","Top=50px,Height=250px,Width=300px,Left=200px,resizable=1");

           }


function windowopenEnlargePics(a, b)
{
    var pollstyle="";
    //pollstyle=readCookie("ckstylesheet");
    window.open("EnlargePics.aspx?photopath="+a+"&imgname="+ b + "&style="+pollstyle,"ovb","Top=55px,Height=680px,Width=800px,Left=120px,scrollbars = 1,resizable=1");
}
           

function termsPopUp()
{
     try
        {
            window.open("scontent.aspx?page=TermsConditions","terms","Top=55px,Height=600px,Width=500px,Left=180px,scrollbars=1");       
        }
        catch(ex)
        {
    
        }

}

function privacyPopUp()
{
     try
        {
            window.open("scontent.aspx?page=PrivacyPolicy","privacy","Top=55px,Height=600px,Width=500px,Left=180px,scrollbars=1");       
        }
        catch(ex)
        {
    
        }

}

function TestGuess()
{
    var reg=/[~`!@#$%^&*()+=|{}[\]\\;:"'<,>?/]/;
    var a = document.getElementById("ctl00_ContentPlaceHolder1_WebUsrCtl_Login1_Txt_UserName").value;
    var b = document.getElementById("ctl00_ContentPlaceHolder1_WebUsrCtl_Login1_Txt_Password").value;
    if(a=="")
    {
        alert("Please Enter User Name");
        document.getElementById("ctl00_ContentPlaceHolder1_WebUsrCtl_Login1_Txt_UserName").focus();
        return false;
    }
    else if(reg.test(a))
    {
        alert("Special character instead of _ - . are not allowed in username field.");
        document.getElementById("ctl00_ContentPlaceHolder1_WebUsrCtl_Login1_Txt_UserName").focus();
        return false;
    }
    else if(b=="")
    {
        alert("Please Enter Password");
        document.getElementById("ctl00_ContentPlaceHolder1_WebUsrCtl_Login1_Txt_Password").focus();
        return false;
    }
    else
    {
    return true;
    }
}
function forceNumber(id)
{

    var regExp=/^[0-9]/;
        var char1=id.value.substr((id.value.length-1),(id.value.length));

    if(regExp.test(char1))
    {
    id.value=id.value.replace(/^\s+$/,"");
    }
    else{
    id.value=id.value.substr(0,id.value.length-1);
    }
}

function forceregularex(id)
{
    var regExp=/^[A-Za-z0-9._-]/;
    var rg= /^[A-Za-z]/;
    var char1=id.value.substr((id.value.length-1),(id.value.length));
    if(regExp.test(char1))
     {
       id.value=id.value.replace(/^\s+$/,"");
     }
    else
     {
        id.value=id.value.substr(0,id.value.length-1);
     }
    if(rg.test(id.value.charAt(0)))
    {
    }
    else
    {
        id.value=id.value.substr(0,id.value.length-1);
    }       
}

function forceemail(id)
{
//
//alert(id.value);
    var regExp=/^[A-Za-z0-9._@\-]/;
   
   var char1=id.value.substr((id.value.length-1),(id.value.length));

    if(regExp.test(char1))
    {
       
    }
    else
    {
       id.value=id.value.substr(0,id.value.length-1);
    }
    //id.value=id.value.replace(/\s+/,"");
}

function forcereguler(id)
{

    var regExp=/^[A-Za-z0-9._!@#$%^&*'()]/;
            var char1=id.value.substr((id.value.length-1),(id.value.length));

    if(regExp.test(char1))
    {
        id.value=id.value.replace(/^\s+$/,"");
    }
    else
    {
    id.value=id.value.substr(0,id.value.length-1);
    }
}

function TestUsername()
{
    var reg=/[~`!@#$%^&*()+=|{}[\]\\;:"'<,>?/]/;
    var a = document.getElementById("ctl00_ContentPlaceHolder1_txtNewUser").value;
    
    if(a=="")
    {
        alert("Please Enter User Name");
        document.getElementById("ctl00_ContentPlaceHolder1_txtNewUser").focus();
        return false;
    }
    else if(reg.test(a))
    {
        alert("Special character instead of _ - . are not allowed in username field.");
        document.getElementById("ctl00_ContentPlaceHolder1_txtNewUser").focus();
        return false;
    }
    else
    {
    return true;
    }
}

function forceregularextext(id)
{
//
//alert(id.value);
var regExp=/^[A-Za-z0-9._-]/;
var rg= /^[A-Za-z]/;
        var char1=id.value.substr((id.value.length-1),(id.value.length));

if(regExp.test(char1))
{

}else{
id.value=id.value.substr(0,id.value.length-1);
}
if(rg.test(id.value.charAt(0)))
{
}
else
{
id.value=id.value.substr(0,id.value.length-1);
}
}

 function AjaxForCheck(id)
    {
        var a=document.getElementById('ctl00_ContentPlaceHolder1_'+id)
    
        $.ajax({
        type: "Get",
        url: "checkexistbyajax.aspx",
        data: "name="+a.value,
        success: function(msg)
        {
            if(msg!="")
            {
                alert(msg);
                a.value="";
                a.focus();
            }
        }
        });
    }
    
     function AjaxForCheckemail(id)
    {
        var a=document.getElementById('ctl00_ContentPlaceHolder1_'+id)
        if(a.value!="")
        {   
            $.ajax({
            type: "Get",
            url: "checkexistbyajax.aspx",
            
            data: "email="+urlencode(a.value),
            success: function(msg)
            {
                if(msg!="")
                {
                    alert(msg);
                    a.value="";
                    a.focus();
                }
            }
            });
        }
    }
    
     function truncate(cntrlid)
    {
        try
        {
        if(cntrlid.value.length>1000)
            {
                cntrlid.value=cntrlid.value.substring(0,1000);
                alert('Maximum characters limit has been reached.\n Truncating extra characters');
            }
        }
        catch(ex)
        {
        }
    }
    
    function truncatevalue(cntrlid, maxlnth)
    {
        try
        {
        if(cntrlid.value.length>maxlnth)
            {
                cntrlid.value=cntrlid.value.substring(0,maxlnth);
                alert('Maximum characters limit has been reached.\n Truncating extra characters');
            }
        }
        catch(ex)
        {
        }
    }
    
    function DetailMax(eve, lbl, txt,maxlen)
    {
        try
        {
            var e = document.getElementById('ctl00_ContentPlaceHolder1_'+lbl);
            var txt = document.getElementById('ctl00_ContentPlaceHolder1_'+txt).value;
            var lenth = parseInt(txt.length);
            e.innerHTML=" "+lenth;
            if(lenth >=maxlen && eve.keyCode!=8)
            {
            return false;
            }
            else
            {return true;}
        }
        catch(ex)
        {
        }
    }
    function forceregularexName(id)
{
    var regExp=/^[A-Za-z0-9._-]/;
    var rg= /^[A-Za-z]/;
    var char1=id.value.substr((id.value.length-1),(id.value.length));
    
    if(rg.test(id.value.charAt(0)))
    {
    }
    else
    {
        id.value=id.value.substr(0,id.value.length-1);
    }       
}
function divlargeimgfx(img)
{
    try
    {    
         document.getElementById("lgimg").src='';
         document.getElementById("lgimg").src=img;
         document.getElementById('logoarea').style.display="none";
         var m=document.getElementById('maindivdisplay');
         m.style.display="block";
         m.style.backgroundColor="#838383";
         jQuery('div#divlargeimg').show(500);         
    }
    catch(ex)
    {
    }
}

function setPosition(obj,lyr)
{
    var top=$(document.body).offset().top+$(window).scrollTop();
    //left=$(document.body).offset().left+$(window).scrollLeft();
   $("div#divlargeimg").css("top",top); 
   var h=$(window).height(); 
   var w=$(window).width();
   $("div#maindivdisplay").css("height",h-50);
   $("div#maindivdisplay").css("width",w-5);
}
function setExactpos(obj,lyr)
{
    var top=$(obj).offset().top;
    var left=$(obj).offset().left;
    $("div#qtoftheday").css("top",top+15);
    $("div#qtoftheday").css("left",left-100);
    $("div#qtoftheday").show(500);
}
function qtclosediv()
{
    $("div#qtoftheday").hide(500);
}
function closedivlargeimg()
{
    try
    {
         document.getElementById("lgimg").src='none';
         document.getElementById('divlargeimg').style.display='none';
         var m=document.getElementById('maindivdisplay');
         m.style.display="none";
         document.getElementById('logoarea').style.display="block";
    }
    catch(ex)
    {
    }    
}

function showweatherdiv()
{
    try
    {
        var left=$("div#divforsearch").offset().left;
          var top=$("div#divforsearch").offset().top;
        $("div#divforweather").show("500");
         $("div#divforweather").css("left",left+330);
         $("div#divforweather").css("top",top-30);
    }
    catch(ex)
    {
    }
}
function divweatherclose()
{
   try
    {      
      $("div#divforweather").hide("500");      
    }
    catch(ex)
    {
    }  
}

function divsearch_display()
{   
    try{
    var id1=document.getElementById('ctl00_Search1_txtsearch');


    var pos=findPos(id1);
//alert(id1);
    //ctl00$Search1$txtsearch
        document.getElementById("divsearch").style .display= "block" ;
        document.getElementById("divsearch").style.top=parseInt(pos[1])+23+"px";
       document.getElementById("divsearch").style.left=parseInt(pos[0]-12)+"px";
    }
    catch(ex)
    {
    }
}

function divsearch_hide()
{   
    try
    {
        document.getElementById("divsearch").style .display= "none" ;
    }catch(ex)
    {
    }
}

function Display_Div(toppos,leftpos)
{
    var id1=document.getElementById('imgmap23');

    var pos=findPos(id1);
    try{
       document.getElementById("DivMap").style .display= "block" ;
       document.getElementById("DivMap").style.top=parseInt(pos[0])+parseInt(toppos)+"px";
       document.getElementById("DivMap").style.left=parseInt(pos[1])+ parseInt(leftpos)+"px";
       }catch(ex)
       {
       }
        
}

function Hide_Div()
{
    try{
        document.getElementById("DivMap").style .display= "none" ;
       }catch(ex)
       {
       }
}
