function set_stylesheet(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
window.location.reload();
}

function get_stylesheet(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function check_stylesheet()
{
username=getCookie('username');
if (username!=null && username!="")
{
alert('Welcome again '+username+'!');
}
else 
{
username=prompt('Please enter your name:',"");
if (username!=null && username!="")
{
setCookie('username',username,365);
} 
}
}

//get cookie value
stylesheet = get_stylesheet('css_swap');
if(stylesheet == '' || stylesheet == 's')
{
document.write('<link rel="stylesheet" href="css/text_s.css" type="text/css">');
}
if(stylesheet == 'm')
{
document.write('<link rel="stylesheet" href="css/text_m.css" type="text/css">');
}
if(stylesheet == 'l')
{
document.write('<link rel="stylesheet" href="css/text_l.css" type="text/css">');
}

