function setNitromeCookie(cookie_name, cookie_value, exp_y, exp_m, exp_d, cookie_path, cookie_domain, cookie_secure){
	var cookie_string=cookie_name+"="+escape(cookie_value);
	if(exp_y){
		var cookie_expires=new Date(exp_y,exp_m,exp_d);
		cookie_string+="; expires="+cookie_expires.toGMTString();
	}
	if(cookie_path){
		cookie_string+="; path="+escape(cookie_path);	
	}
	if(cookie_domain){
		cookie_string+="; domain="+escape(cookie_domain);	
	}
	if(cookie_secure){
		cookie_string+="; secure";	
	}
	document.cookie=cookie_string;
}
function getNitromeCookie(cookie_name){
	var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );
  	if ( results ){
    	return ( unescape ( results[1] ) );
	}else{
    	return null;
	}
}

//load in correct colour scheme

var latest_style="party";

var site_style=getNitromeCookie("skin");

var last_newest=getNitromeCookie("lastnewest");


if(site_style==null){
	site_style=latest_style;
	skin_pref="newest";
	last_newest=latest_style;
}else{
	
	//does the user want to see the newest version?
	var skin_pref=getNitromeCookie("skinpref");
	if(skin_pref=="newest"){
		if(last_newest!=latest_style){
			site_style=latest_style;
		}
	}else if(skin_pref==null){
		skin_pref="newest";	
	}else{
	}
	
	//now save the current last newest
	last_newest=latest_style;
	
	
	
	
	//user has changed styles before - save it
	var d=new Date();
	var year=d.getFullYear();
	var month=d.getMonth();
	var day=d.getDate();
	year+=2;
	setNitromeCookie("skin",site_style,year,month,day,"/");
	setNitromeCookie("skinpref",skin_pref,year,month,day,"/");
	setNitromeCookie("lastnewest",last_newest,year,month,day,"/");
}




//images folder
var images_folder=images_folder+site_style+"/";

//colours for javascript
var c="<script language='JavaScript' type='text/javascript' src='";
c+=scripts_folder;
c+="colours_";
c+=site_style;
c+=".js'></script>";

document.write(c);


//css - fix colours below

var f="<style type='text/css'>";
	f+="body{";
	f+="margin: 0;";
	f+="padding: 0;";
	f+="text-align: center;";
	f+="color: #000000;";
	f+="background-image: url('";
	f+=images_folder;
	f+="tile.png');";
	
	
	if(site_style=="classic"){
		f+="background-repeat: repeat;";
		f+="background-color: #";
		f+="FD74B3";
	}else if(site_style=="winter"){
		f+="background-repeat: repeat;";
		f+="background-color: #";
		f+="BDEDFF";
	}else if(site_style=="retro"){
		f+="background-attachment: fixed;";
		f+="background-repeat: repeat-x;";
		f+="background-position: bottom;";
		f+="background-color: #";
		f+="809604";
	}else if(site_style=="horror"){
		f+="background-attachment: fixed;";
		f+="background-repeat: repeat-x;";
		f+="background-position: bottom;";
		f+="background-color: #";
		f+="271061";
	}
	f+="; font-family: arial;";
	f+="font-size: 10px;";
	f+="}";
	f+=".inner_corner_bl{";
	f+="background: url('";
	f+=images_folder;
	f+="inner_corner_bl.gif') 0 100% no-repeat #";
	if(site_style=="classic"){
		f+="FEB2D5";
	}else if(site_style=="winter"){
		f+="A1C8CF";
	}else if(site_style=="retro"){
		f+="B0BCB2";
	}else if(site_style=="horror"){
		f+="DE82FF";
	}
	f+="; height: 100%;";
	f+="}";
	f+=".inner_corner_br{";
	f+="background: url('";
	f+=images_folder;
	f+="inner_corner_br.gif') 100% 100% no-repeat; height: 100%;";
	f+="}";
	f+=".inner_corner_tl{";
	f+="background: url('";
	f+=images_folder;
	f+="inner_corner_tl.gif') 0 0 no-repeat;";
	f+="}";
	f+=".inner_corner_tr{";
	f+="background: url('";
	f+=images_folder;
	f+="inner_corner_tr.gif') 100% 0 no-repeat;";
	f+="padding: 0px 7px;";
	f+="}";
	f+=".outer_corner_bl{";
	f+="background: url('";
	f+=images_folder;
	f+="outer_corner_bl.gif') 0 100% no-repeat #FFFFFF; height: 100%;";
	f+="}";
	f+=".outer_corner_br{";
	f+="background: url('";
	f+=images_folder;
	f+="outer_corner_br.gif') 100% 100% no-repeat; height: 100%;";
	f+="}";
	f+=".outer_corner_tl{";
	f+="background: url('";
	f+=images_folder;
	f+="outer_corner_tl.gif') 0 0 no-repeat;";
	f+="}";
	f+=".outer_corner_tr{";
	f+="background: url('";
	f+=images_folder;
	f+="outer_corner_tr.gif') 100% 0 no-repeat;";
	f+="padding: 0px 7px;";
	
	f+="}";
	f+=".inner_corner_tl_current{";
	f+="background: url('";
	f+=images_folder;
	f+="inner_corner_tl_current.gif') 0 0 no-repeat;";
	
	f+="}";
	f+=".inner_corner_tl_main{";
	f+="background: url('";
	f+=images_folder;
	f+="inner_corner_tl_main.gif') 0 0 no-repeat;";
	
	f+="}</style>";
	
document.write(f);

if(pageid!=""){
	var page_styles=styles_folder+pageid+".css";
	var s='<link rel="stylesheet" type="text/css" href="';
	s+=page_styles;
	s+='"/>';

	document.write(s);
}

var styles=styles_folder+"colours_"+site_style+".css";

var s='<link rel="stylesheet" type="text/css" href="';
s+=styles;
s+='"/>';

document.write(s);


