﻿// 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(path) 
{

    pink_over(path);
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",path+'/themes/css/pink.css',1);
    try{
        document.getElementById('stylesheet1').href = path+'/themes/css/pink.css';
        
      }catch(ex)
      {
      }
}
function green(path) 
{
    green_over(path);
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",path+'/themes/css/green.css',1);
    try{
        document.getElementById('stylesheet1').href = path+'/themes/css/green.css';
        
      }catch(ex)
      {
      }
}
function orange(path) 
{

    orange_over(path);

    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",path+'/themes/css/orange.css',1);
    try{
        document.getElementById('stylesheet1').href = path+'/themes/css/orange.css';
       
      }catch(ex)
      {
      }
}
function gray(path) 
{
    
    gray_over(path);
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",path+'/themes/css/style.css',1);
    try{
        document.getElementById('stylesheet1').href = path+'/themes/css/style.css';
       
      }catch(ex)
      {
      }
}
function oyster(path) 
{
    oyster_over(path);
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",path+'/themes/css/oyster.css',1);
    try{
        document.getElementById('stylesheet1').href = path+'/themes/css/oyster.css';
      }catch(ex)
      {
      }
}


function purple(path) 
{
    purple_over(path);
    //eraseCookie("ckstylesheet");
    var a=readCookie("ckstylesheet");
    DeleteCookie("ckstylesheet",a,1);
    createCookie("ckstylesheet",path+'/themes/css/purple.css',1);
    try{
        document.getElementById('stylesheet1').href = path+'/themes/css/purple.css';
       
      }catch(ex)
      {
      }
}


function maintainstyle(path) 
{
    //jQuery("div#uploadPhotoDiv").hide();
	var a=readCookie("ckstylesheet");        
       
        if(a==null)
        {
        createCookie("ckstylesheet",path+'/themes/css/style.css',1);
        document.getElementById('stylesheet1').href = path+'/themes/css/style.css';
        }
        else
        {
        if(a==path+"/themes/css/green.css")
        {
        green_over(path);
        }
        if(a==path+"/themes/css/pink.css")
        {
        pink_over(path);
        }
        if(a==path+"/themes/css/orange.css")
        {
        orange_over(path);
        }

        if(a==path+"/themes/css/purple.css")
        {
        purple_over(path);
        }

        if(a==path+"/themes/css/oyster.css")
        {
        oyster_over(path);
        }
        if(a==path+"/themes/css/style.css")
        {
        gray_over(path);
        }

        document.getElementById('stylesheet1').href = readCookie("ckstylesheet");
     

    }
}
function green_over(path)
{
    try{
        document.getElementById('greenimg').src=path+'/images/green_over.jpg'
        document.getElementById('purpleimg').src=path+'/images/purple.gif'
        document.getElementById('pinkimg').src=path+'/images/pink.jpg'
        document.getElementById('grayimg').src=path+'/images/gray.jpg'
        document.getElementById('orangeimg').src=path+'/images/orange.jpg'
      }catch(ex)
      {
      }
}
function pink_over(path)
{
    try
    {
    document.getElementById('greenimg').src=path+'/images/green.jpg'
    document.getElementById('purpleimg').src=path+'/images/purple.gif'
    document.getElementById('pinkimg').src=path+'/images/pink_over.jpg'
    document.getElementById('grayimg').src=path+'/images/gray.jpg'
    document.getElementById('orangeimg').src=path+'/images/orange.jpg'
   }
   catch(ex)
   {
   }
}
function purple_over(path)
{
try{
    document.getElementById('greenimg').src=path+'/images/green.jpg'
    document.getElementById('purpleimg').src=path+'/images/purple_over.gif'
    document.getElementById('pinkimg').src=path+'/images/pink.jpg'
    document.getElementById('grayimg').src=path+'/images/gray.jpg'
    document.getElementById('orangeimg').src=path+'/images/orange.jpg'
    }catch(ex)
    {
    }
}
function gray_over(path)
{
try{
        document.getElementById('greenimg').src=path+'/images/green.jpg'
        document.getElementById('purpleimg').src=path+'/images/purple.gif'
        document.getElementById('pinkimg').src=path+'/images/pink.jpg'
        document.getElementById('grayimg').src=path+'/images/gray_over.jpg'
        document.getElementById('orangeimg').src=path+'/images/orange.jpg'
   }catch(ex)
   {
   }
}
function oyster_over(path)
{
    try{
        document.getElementById('greenimg').src=path+'/images/green.jpg'
        document.getElementById('purpleimg').src=path+'/images/purple.gif'
        document.getElementById('pinkimg').src=path+'/images/pink.jpg'
        document.getElementById('grayimg').src=path+'/images/gray.jpg'
        document.getElementById('orangeimg').src=path+'/images/orange.jpg'
     }catch(ex)
     {
     }
}
function orange_over(path)
{
    try{
        document.getElementById('greenimg').src=path+'/images/green.jpg'
        document.getElementById('purpleimg').src=path+'/images/purple.gif'
        document.getElementById('pinkimg').src=path+'/images/pink.jpg'
        document.getElementById('grayimg').src=path+'/images/gray.jpg'
        document.getElementById('orangeimg').src=path+'/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
  
    if (name == 'Featurestxt')
    {
  
    document.getElementById("Featurestxt").className="show_td"
    document.getElementById("Entertainmenttxt").className="box1title" 
     document.getElementById("TodayEventstxt").className="box1title"
     document.getElementById("PlayGamestxt").className="box1title"
    
    }
     if (name == 'Entertainmenttxt')
    {
    document.getElementById("Entertainmenttxt").className="show_td"
    document.getElementById("Featurestxt").className="box1title" 
     document.getElementById("TodayEventstxt").className="box1title"
     document.getElementById("PlayGamestxt").className="box1title"
   
    }
    if (name == 'TodayEventstxt')
    {
    document.getElementById("TodayEventstxt").className="show_td"
    document.getElementById("Featurestxt").className="box1title" 
     document.getElementById("Entertainmenttxt").className="box1title"
     document.getElementById("PlayGamestxt").className="box1title"
   
    }
     if (name == 'PlayGamestxt')
    {
    document.getElementById("TodayEventstxt").className="box1title"
    document.getElementById("Featurestxt").className="box1title" 
     document.getElementById("Entertainmenttxt").className="box1title"
     document.getElementById("PlayGamestxt").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 toggle1(id,myarr)
  {
  try{
    my_Boxes=myarr
    NormalAllTags();
    name=id;
    //alert(name);
      //alert(name);
    if (name == 'LiveInfotxt')
    {

    document.getElementById("LiveInfotxt").className="show_td"
    
    document.getElementById("PhotoGallerytxt").className="box1title" 
     
     document.getElementById("TopSearchtxt").className="box1title"
     document.getElementById("Sporttxt").className="box1title"
    
    }
     if (name == 'PhotoGallerytxt')
    {
   //alert(name);
    document.getElementById("PhotoGallerytxt").className="show_td";
    document.getElementById("LiveInfotxt").className="box1title" ;
     document.getElementById("TopSearchtxt").className="box1title";
     document.getElementById("Sporttxt").className="box1title"
   
    }
    if (name == 'TopSearchtxt')
    {
   // alert(name);
   
    document.getElementById("TopSearchtxt").className="show_td";
    document.getElementById("PhotoGallerytxt").className="box1title"; 
     document.getElementById("LiveInfotxt").className="box1title";
     document.getElementById("Sporttxt").className="box1title"
   
    }
     if (name == 'Sporttxt')
    {
   // alert(name);
   
    document.getElementById("TopSearchtxt").className="box1title";
    document.getElementById("PhotoGallerytxt").className="box1title"; 
     document.getElementById("LiveInfotxt").className="box1title";
     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("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 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("div1menu").style.width="125px";
            document.getElementById("div1menu").style.top=(cord[1]+35)+"px";
            document.getElementById("div1menu").style.left=cord[0]+"px";
           document.getElementById("div1menu").style.display="block";
        }
        
        function hideDivMenu()
        {
       // alert('aaaa');
              document.getElementById("div1menu").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 ("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=650px,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)
{
//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 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 show(obj)
//{

//mh=$("#divlargeimg").height();
//wheight=(($(window).height()+$(window).scrollTop()))-mh;
//objt=$(obj).offset().top;
//objb=objt+$(obj).height();
//margin=objb-objt;


//if(objb>wheight){
//	newtop=objb-mh;
//	if(newtop>wheight){
//		newtop=objb-(mh+margin);
//	}
//}else{
//newtop=objt;
//}
////alert(objb+", "+newtop+", "+wheight);
//$("#divlargeimg").css("left",80);
//$("#divlargeimg").css("top",newtop);
//}

