var MiniSite=new Object();
MiniSite.Cookie={
	set:function(name,value,expires,path,domain){
		if(typeof expires=="undefined"){
			expires=new Date(new Date().getTime()+24*3600*1000);
		}
		document.cookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"; path=/")+((domain)?";domain="+domain:"");
	},
	get:function(name){
		var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
		if(arr!=null){
			return unescape(arr[2]);
		}
		return null;
	},
	clear:function(name,path,domain){
		if(this.get(name)){
			document.cookie=name+"="+((path)?"; path="+path:"; path=/")+((domain)?"; domain="+domain:"")+";expires=Fri, 02-Jan-1970 00:00:00 GMT";
		}
	}
};
	var moveTime = new Array();
	moveTime[0] = 0;
	moveTime[1] = 0;
	var speed = 30;

	function $(o){ return (typeof o == "object")?o:document.getElementById(o);}
function getExpires(a){//a:day
	var expires=new Date(new Date().getTime()+(a?a:1)*24*3600*1000);
	return expires;
}
function setdefSkin(){
	var expires = getExpires(90);
	var n =  MiniSite.Cookie.get("SmebxSkin");
	if(n!=null){
		var m = MiniSite.Cookie.get("defblue");
		if(!m){
			setSkin(0);
			MiniSite.Cookie.set("defblue","true",expires);
		}else{
			setSkin(n);
		}
			
	}else{
		MiniSite.Cookie.set("defblue","true",expires);
	}
}
	var cssList = new Array("PaleBlue.Css","Purple.Css","PaleGreen.Css")

	function setSkin(n){var expires = getExpires(90);var css = $("cssChange");var cssurl = "Smebx_Css/Default_Style/";cssurl +=cssList[n];css.href=cssurl;MiniSite.Cookie.set("SmebxSkin",n,expires);}

	function formatSkin()
	{var p = $("SkinList").getElementsByTagName("li");var s = $("sar");for(i=0;i<p.length;i++){p[i].num = i;p[i].onclick = function(){setSkin(this.num);}}s.onclick = function() { openSkin("sar","SkinList",42,46,2,0); };}

	function _openSkin(o1,o2,max,min,speed,n)
	{ return openSkin(o1,o2,max,min,speed,n);}

	function _closeSkin(o1,o2,max,min,speed,n)
	{ return closeSkin(o1,o2,max,min,speed,n);}

	//n=0 skin n=1 pro
	function openSkin(o1,o2,max,min,speed,n)
	{var a = $(o1);	var s = $(o2);var w = s.offsetWidth;var move=function(){w+=speed;if(w>=max){w = max;s.style.width = w+"px";				if(moveTime[n]){window.clearInterval(moveTime[n]);}if(n){$("pro_arrow").className = "al";$("pro_arrow").onclick = function() {closeSkin(o1,o2,max,min,speed,n);}				}else{a.innerHTML = "<div class='s'><img src='Smebx_Images/Default/Skin_White.Gif' alt='ÊÕËõ' /></div>";a.onclick = function() {closeSkin(o1,o2,max,min,speed,n);}}}else{s.style.width = w + "px";if(n){}else{s.style.display = "block";};}};moveTime[n] = window.setInterval(move,3);}

	function closeSkin(o1,o2,max,min,speed,n)
	{var a = $(o1);var s = $(o2);var w = s.offsetWidth;var move = function(){w-=speed;if(w<=min){w = min;s.style.width = w + "px";if(n){				$("pro_arrow").className = "ar";$("pro_arrow").onclick = function() {openSkin(o1,o2,max,min,speed,n);};}else{a.innerHTML = "<div><img src='Smebx_Images/Default/Skin_White.Gif' alt='¸ü¶àÆ¤·ô' /></div>";a.onclick = function() { openSkin(o1,o2,max,min,speed,n);}	};		if(moveTime[n]){window.clearInterval(moveTime[n]);}}else{s.style.display = "block";s.style.width = w + "px";};};moveTime[n] = window.setInterval(move,3);}
