// JavaScript Document
var myStyleName=readCookie("AlpharmaStyle");
function readCookie(name)

{

  var cookieValue = "";

  var search = name + "=";

  if(document.cookie.length > 0)

  { 

    offset = document.cookie.indexOf(search);

    if (offset != -1)

    { 

      offset += search.length;

      end = document.cookie.indexOf(";", offset);

      if (end == -1) end = document.cookie.length;

      cookieValue = unescape(document.cookie.substring(offset, end))

    }

  }

  return cookieValue;

}

//check to see if cookie exist
if(myStyleName=="")
{ 
//if doesn't exist write default style
document.write('<link href="/css/interior_default.css" rel="stylesheet" type="text/css" />');
}
else
{
//if exists write new style
document.write('<link href="/css/'+myStyleName+'.css" rel="stylesheet" type="text/css" />');

}

//when called this function grabs the variable, sets the cookie and refreshes the page.
function changeStyle(what)
{
	
pageStyle=what;		

 writeCookie("AlpharmaStyle", pageStyle, 24);

// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.

function writeCookie(name, value, hours)

{

  var expire = "";

  if(hours != null)

  {

    expire = new Date((new Date()).getTime() + hours * 3600000);

    expire = "; expires=" + expire.toGMTString();

  }
	var path = "; path=/;";
  document.cookie = name + "=" + escape(value) + expire +"; path=/" 

}
//refresh page
window.location=self.location 
}