var Init = {
 
	baseSkinUrl : "css/",
 
	styles : ["common", "common02"],
 
	cookieKey : "nissan",
 
	getRandomNum : function(min, max){
		return min + Math.floor(Math.random() * (max - min + 1));  
	},
 
	getCookie : function(name) {
		var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
		if (arr != null) {
			return unescape(arr[2]);
		}
		return null;
	},
 
	setCookie : function(sName,sValue,objHours,sPath,sDomain,bSecure){
		var sCookie = sName + "=" + encodeURIComponent(sValue);
		if (objHours) {
			var date = new Date();
			var ms = objHours * 3600 * 1000;
			date.setTime(date.getTime() + ms);
			sCookie += ";expires=" + date.toGMTString();
		}
		if (sPath) {
			sCookie += ";path=" + sPath;
		}
		if (sDomain) {
			sCookie += ";domain=" + sDomain;
		}
		if (bSecure) {
			sCookie += ";secure";
		}
		document.cookie=sCookie;
	},
 
	loadCSS : function(){
		var length = this.styles.length,
		     random = this.getRandomNum(0, length-1),
		     cookieStyle = this.getCookie(this.cookieKey),
		     currentStyle = "default";
 
                while(this.styles[random] == cookieStyle)
		{
			random = this.getRandomNum(0, length-1)
		}
 
		currentStyle = this.styles[random];
 
                this.setCookie(this.cookieKey, currentStyle, 0.000000001, "/", "css9.net", false);
 
                if(currentStyle != "default")
		{
			document.write('<link rel="stylesheet" type="text/css" href="' + this.baseSkinUrl + this.styles[random] + '.css" />');
		}		
	}
}
 
Init.loadCSS();   
