﻿// JScript File

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 createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*8000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

/*function eraseCookie(name) {
	createCookie(name,"",-(date.getTime()+(days*24*60*60*100000)));
	document.cookie=null;
}*/

function DeleteCookie(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() - nDays*24*60*60*8000);
document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

  
  

function div_display()
{
var id1=document.getElementById('changetheme');
var pos=findPos(id1);

    try{
       document.getElementById("divcolor").style.display= "block" ;
       document.getElementById("divcolor").style.top=parseInt(pos[1])+21+"px";
       document.getElementById("divcolor").style.left=parseInt(pos[0])+4+"px";
       }catch(ex)
       {
       }
       }
       
       function weatherdiv()
{
//ert('welcome');
var id1=document.getElementById('checkwe');
var pos=findPos(id1);

    try{
       document.getElementById("hideaccu").style.display= "block" ;
       document.getElementById("hideaccu").style.top=parseInt(pos[1])+2+"px";
       document.getElementById("hideaccu").style.left=parseInt(pos[0])+1+"px";
       }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];
}

function div_hide()
{   
    try{
        document.getElementById("divcolor").style .display= "none" ;
      }catch(ex)
      {
      }
}
function pink() 
{
    pink_over();
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",'../themes/css/pink.css',1);
    try{
        document.getElementById('stylesheet1').href = '../themes/css/pink.css';
        
      }catch(ex)
      {
      }
}
function green() 
{
    green_over();
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",'../themes/css/green.css',1);
    try{
        document.getElementById('stylesheet1').href = '../themes/css/green.css';
        
      }catch(ex)
      {
      }
}
function orange() 
{

    orange_over();

    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",'../themes/css/orange.css',1);
    try{
        document.getElementById('stylesheet1').href = '../themes/css/orange.css';
       
      }catch(ex)
      {
      }
}
function gray() 
{
    
    gray_over();
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",'../themes/css/style.css',1);
    try{
        document.getElementById('stylesheet1').href = '../themes/css/style.css';
       
      }catch(ex)
      {
      }
}
function oyster() 
{
    oyster_over();
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",'../themes/css/oyster.css',1);
    try{
        document.getElementById('stylesheet1').href = '../themes/css/oyster.css';
      }catch(ex)
      {
      }
}


function purple() 
{
    purple_over();
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",'../themes/css/purple.css',1);
    try{
        document.getElementById('stylesheet1').href = '../themes/css/purple.css';
       
      }catch(ex)
      {
      }
}


function maintainstyle() 
{
    jQuery("div#uploadPhotoDiv").hide();
	var a=readCookie("ckstylesheet");
        
       
        if(a==null)
        {
        createCookie("ckstylesheet",'../themes/css/style.css',1);
        document.getElementById('stylesheet1').href = '../themes/css/style.css';
        }
        else
        {
        if(a=="../themes/css/green.css")
        {
        green_over();
        }
        if(a=="../themes/css/pink.css")
        {
        pink_over();
        }
        if(a=="../themes/css/orange.css")
        {
        orange_over();
        }

        if(a=="../themes/css/purple.css")
        {
        purple_over();
        }

        if(a=="../themes/css/oyster.css")
        {
        oyster_over();
        }
        if(a=="../themes/css/style.css")
        {
        gray_over();
        }

        document.getElementById('stylesheet1').href = readCookie("ckstylesheet");
     

    }
}
function green_over()
{
    try{
        document.getElementById('greenimg').src='../images/green_over.jpg'
        document.getElementById('purpleimg').src='../images/purple.gif'
        document.getElementById('pinkimg').src='../images/pink.jpg'
        document.getElementById('grayimg').src='../images/gray.jpg'
        document.getElementById('orangeimg').src='../images/orange.jpg'
      }catch(ex)
      {
      }
}
function pink_over()
{
try{
    document.getElementById('greenimg').src='../images/green.jpg'
    document.getElementById('purpleimg').src='../images/purple.gif'
    document.getElementById('pinkimg').src='../images/pink_over.jpg'
    document.getElementById('grayimg').src='../images/gray.jpg'
    document.getElementById('orangeimg').src='../images/orange.jpg'
  }catch(ex)
  {
  }
}
function purple_over()
{
try{
    document.getElementById('greenimg').src='../images/green.jpg'
    document.getElementById('purpleimg').src='../images/purple_over.gif'
    document.getElementById('pinkimg').src='../images/pink.jpg'
    document.getElementById('grayimg').src='../images/gray.jpg'
    document.getElementById('orangeimg').src='../images/orange.jpg'
    }catch(ex)
    {
    }
}
function gray_over()
{
try{
        document.getElementById('greenimg').src='../images/green.jpg'
        document.getElementById('purpleimg').src='../images/purple.gif'
        document.getElementById('pinkimg').src='../images/pink.jpg'
        document.getElementById('grayimg').src='../images/gray_over.jpg'
        document.getElementById('orangeimg').src='../images/orange.jpg'
   }catch(ex)
   {
   }
}
function oyster_over()
{
    try{
        document.getElementById('greenimg').src='../images/green.jpg'
        document.getElementById('purpleimg').src='../images/purple.gif'
        document.getElementById('pinkimg').src='../images/pink.jpg'
        document.getElementById('grayimg').src='../images/gray.jpg'
        document.getElementById('orangeimg').src='../images/orange.jpg'
     }catch(ex)
     {
     }
}
function orange_over()
{
    try{
        document.getElementById('greenimg').src='../images/green.jpg'
        document.getElementById('purpleimg').src='../images/purple.gif'
        document.getElementById('pinkimg').src='../images/pink.jpg'
        document.getElementById('grayimg').src='../images/gray.jpg'
        document.getElementById('orangeimg').src='../images/orange_over.jpg'
     }catch(ex)
     {
     }
}

function divsearch_hide()
{   
    try{
        document.getElementById("divsearch").style .display= "none" ;
        }catch(ex)
        {
        }
}
var my_Boxes 
 
  function toggle(id,myarr)
  {
  try{
    my_Boxes=myarr
    NormalAllTags();
    name=id
    alert(name);
    if (name == 'Abouttxt')
    {
  
    // alert('yes');
    document.getElementById("Abouttxt").className="show_td"
    document.getElementById("Amenitiestxt").className="hide_td" 
     document.getElementById("Tarifftxt").className="hide_td"
     document.getElementById("Phototxt").className="hide_td"
    
    }
     if (name == 'Amenitiestxt')
    {
    document.getElementById("Amenitiestxt").className="show_td"
    document.getElementById("Abouttxt").className="hide_td" 
    document.getElementById("Tarifftxt").className="hide_td"
    document.getElementById("Phototxt").className="hide_td"
   
    }
    if (name == 'Tarifftxt')
    {
    document.getElementById("Tarifftxt").className="show_td"
    document.getElementById("Amenitiestxt").className="hide_td" 
    document.getElementById("Abouttxt").className="hide_td" 
    document.getElementById("Phototxt").className="hide_td"
    }
     if (name == 'Phototxt')
    {
    document.getElementById("Phototxt").className="show_td"
    document.getElementById("Abouttxt").className="hide_td" 
     document.getElementById("Amenitiestxt").className="hide_td"
     document.getElementById("Tarifftxt").className="hide_td"
    }
    document.getElementById(name).height="26"
    document.getElementById(name).className="show_td" 
    name=name.substring(0,name.lastIndexOf('txt'))
    
    document.getElementById(name+'line').height="1";
    document.getElementById(name+'line').className="";
    document.getElementById(name).style.display="block"
    }catch(ex)
    {
    }
    
  }


  
//  function toggle1(id,myarr)
//  {
//  try{
//    my_Boxes=myarr
//    NormalAllTags();
//    name=id.id;
//    //alert(name);
//      //alert(name);
//    if (name == 'LiveInfotxt')
//    {

//    document.getElementById("LiveInfotxt").className="show_td"
//    
//    document.getElementById("PhotoGallerytxt").className="hide_td" 
//     
//     document.getElementById("TopSearchtxt").className="hide_td"
//     document.getElementById("Sporttxt").className="hide_td"
//    
//    }
//     if (name == 'PhotoGallerytxt')
//    {
//   //alert(name);
//    document.getElementById("PhotoGallerytxt").className="show_td";
//    document.getElementById("LiveInfotxt").className="hide_td" ;
//     document.getElementById("TopSearchtxt").className="hide_td";
//     document.getElementById("Sporttxt").className="hide_td"
//   
//    }
//    if (name == 'TopSearchtxt')
//    {
//   // alert(name);
//   
//    document.getElementById("TopSearchtxt").className="show_td";
//    document.getElementById("PhotoGallerytxt").className="hide_td"; 
//     document.getElementById("LiveInfotxt").className="hide_td";
//     document.getElementById("Sporttxt").className="hide_td"
//   
//    }
//     if (name == 'Sporttxt')
//    {
//   // alert(name);
//   
//    document.getElementById("TopSearchtxt").className="hide_td";
//    document.getElementById("PhotoGallerytxt").className="hide_td"; 
//     document.getElementById("LiveInfotxt").className="hide_td";
//     document.getElementById("Sporttxt").className="show_td"
//   
//    }
//    document.getElementById(name).height="26"
//    //document.getElementById(name).className="show_td" 
//    name=name.substring(0,name.lastIndexOf('txt'))
//    document.getElementById(name+'line').height="1";
//    document.getElementById(name+'line').className="";
//    document.getElementById(name).style.display="block"
//    }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"
             
            itemtag_to_normal = item_to_normal + 'txt'
            document.getElementById(itemtag_to_normal).className="" 
            
            itemline_to_normal = item_to_normal + 'line'
            document.getElementById(itemline_to_normal).className="line_bg" 
           
                
         }
     }catch(ex)
     {
     }    
  }
  
  
  function showCalender()
  {
     try{
        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("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 showMenuDiv()
{
    alert("hello");

        document.getElementById("divmen").style.display="block";
//      }
//      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];
}
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])+20+"px";
       document.getElementById("divsearch").style.left=parseInt(pos[0]+3)+"px";
    }
    catch(ex)
    {
    }
}

function showDivMenu(id)
        {
            var id1=document.getElementById('showdivmenutd');
            var cord = findPos(id1);
            document.getElementById("div1").style.width="125px";
            document.getElementById("div1").style.top=(cord[1]+35)+"px";
            document.getElementById("div1").style.left=cord[0]+"px";
           document.getElementById("div1").style.display="block";
        }
        
        function hideDivMenu()
        {
       // alert('aaaa');
              document.getElementById("div1").style.display="none";  
        }
        
        function showSubMenu(id)
        {
                var cord = findPos(id);
                document.getElementById("divsubMenu").style.width="125px";
                document.getElementById("divsubMenu").style.top=(cord[1])+"px";
                document.getElementById("divsubMenu").style.left=(cord[0]+80)+"px";
               document.getElementById("divsubMenu").style.display="block";
        }
        function popuppollresult()
           {
               var pollstyle="";
               pollstyle=readCookie("ckstylesheet");
               window.open ("pollresult.aspx?style="+pollstyle,"cvb","Top=50px,Height=200px,Width=550px,Left=200px");
           }
        function popupresultclose()
           {
                window.close ();
                 return true;
           }
           function windowopenlargeimages(a)
           {
                var pollstyle="";
                pollstyle=readCookie("ckstylesheet");
                 window.open ("largeimage.aspx?photopath="+a+"&style="+pollstyle,"ovb","Top=55px,Height=500px,Width=600px,Left=180px,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("../album/PhotoAlbumEnlargeImage.aspx?AlbumImage="+a+"&AlbumCaption="+ b+"&style="+pollstyle,"ovb","Top=55px,Height=500px,Width=600px,Left=180px,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 ("http://192.168.25.26/cityB/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 ("http://192.168.25.26/cityB/news/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 termsPopUp()
{
     try
        {
            window.open("../UI/scontent.aspx?page=TermsConditions","terms","Top=55px,Height=600px,Width=500px,Left=180px,scrollbars=1");       
        }
        catch(ex)
        {
    
        }

}

function privacyPopUp()
{
     try
        {
            window.open("../UI/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)
{
//alert("aaa");
//
    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;
    }
}

/// remove html tags
//function stripHTML(id)
//{
//var re = /(<([^>]+)>)/gi;
//for (i=0; i<arguments.length; i++)
//arguments[i].value=arguments[i].value.replace(re, "")/
//}

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 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 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 forceChar(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(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 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"
            }
            if(name == 'DownloadDiv')
            {
                document.getElementById('divDownload').style.display="block"
            }
            if(name == 'GamesDiv')
            {
                document.getElementById('divGames').style.display="block"
            }
            if(name == 'EventsDiv')
            {
                document.getElementById('divEvents').style.display="block"
            }
        
    }
    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)
      {
      }
  }



