/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name,value)
{
    document.cookie= name + "=" + escape(value)
      window.location.reload( true );    
}

/**
 * functrion to hide "text only" link when page is in no css mode
 */
function hidtxtonly()
{
document.getElementById('txtonly').style.visibility = "hidden";  
}

/**
 * functrion to hide "Apply Css" link when page is in  css mode 
 */
function hidcss()
{
document.getElementById('applycss').style.visibility = "hidden";  
}
/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
    
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
 function CheckCookie()
{
    if (getCookie("name")==null)
    {
    //alert("name") ;
    } 
     else {
   disablecss();
    }
    
   
    
 }
  function CheckCookieOnload()
{
	//alert(getCookie("name"))
    if (getCookie("name")==null)
   {	
       hidcss();        
   }
   else
    {
  
    disablecss();
    hidtxtonly();
    //setTimeout( "refresh()", 2*1000 );
    //window.location.reload( true );
   }
    
 }
 function refresh()
 {
	window.location.reload( true );
 }
 
 
 
function deleteCookie(name)
{
    if (getCookie(name))
    {
        document.cookie = name + "=" 
        window.location.reload( true );
        //showcss()  
    }
}


function disablecss()
					{
						for (i=0; i<document.styleSheets.length; i++) 
						{
							void(document.styleSheets.item(i).disabled=true);
							
						}
						el = document.getElementsByTagName('*');
						for (i=0; i<el.length; i++) 
						{
							void(el[i].style.cssText = '');
							
						}
							
					}
//this fun is used to set user's onlinestatus=0,when the browser is closed by 
//clicking on '*' button of the browser
function HandleOnClose() 
			{
			 	if(navigator.appName == 'Netscape')
				{	
					if (e.PageY < 0 && e.PageX < 0) 
						{
						alert(1);
						   var i,j;
						    j=0;
								location.href='../members/SessionKill.aspx';
								for(i=0;i<=1000000;i++)
								{
								 j++;
								}
						}
				}
				else
				{
				
				//alert(event.clientY);
				
					if (event.clientY < 0 && event.clientX < 0) 
						{
						    var i,j;
						    j=0;
								location.href='../members/SessionKill.aspx';
								for(i=0;i<=1000000;i++)
								{
								 j++;
								}
								
						}
						
				}
			}
			function clearDefault(ctl,txt)
			{
			
			if(ctl.value==txt)
			ctl.value='';
			}
			function getImage(ctl,txt)
			{
			
			ctl.src=txt;
			}
