//个性模版设置 2010.06.08

var arrCSS=[
    ["<img src='templates/default/images/t1/largeBg_2.jpg' width='49' height='30' class='themes' title='默认模板'>","templates/default/styles/t1.css"],
    ["<img src='templates/tpl_2/images/largeBg_2.jpg' width='49' height='30' class='themes' title='蔚蓝星空'>","templates/tpl_2/styles/t1.css"],
    ["<img src='templates/tpl_3/images/largeBg_2.jpg' width='49' height='30' class='themes' title='春意盎然'>","templates/tpl_3/styles/t1.css"],
    ["<img src='templates/tpl_4/images/largeBg_2.jpg' width='49' height='30' class='themes' title='生如夏花'>","templates/tpl_4/styles/t1.css"],
    ["<img src='templates/tpl_5/images/largeBg_2.jpg' width='49' height='30' class='themes' title='冰凉夏天'>","templates/tpl_5/styles/t1.css"],
	["<img src='templates/tpl_6/images/largeBg_2.jpg' width='49' height='30' class='themes' title='激情世界杯'>","templates/tpl_6/styles/t1.css"],
	["<img src='templates/tpl_7/images/largeBg_2.jpg' width='49' height='30' class='themes' title='夏天来了'>","templates/tpl_7/styles/t1.css"],
    ""
];

// 获取样式表连接
function v(){
	return;
}

// 设置 Cookies 记录 
function writeCookie(name, value){ 
	exp = new Date(); 
	exp.setTime(exp.getTime() + (86400 *365));
	document.cookie = name + "=" + escape(value) + "; expires=" + exp.toGMTString() + "; path=/"; 
} 

function readCookie(name){ 
	var search; 
	search = name + "="; 
	offset = document.cookie.indexOf(search); 
	if (offset != -1) { 
		offset += search.length; 
		end = document.cookie.indexOf(";", offset);  
		if (end == -1){
			end = document.cookie.length;
		}
		return unescape(document.cookie.substring(offset, end)); 
	}else{
		return "";
	}
}

// 默认样式表
function writeCSS(){
  for(var i=0;i<arrCSS.length;i++){
    document.write('<link title="styles'+i+'" href="'+arrCSS[i][1]+'" rel="stylesheet" disabled="true" type="text/css" />');
  }
    setStyleSheet(readCookie("stylesheet"));
}

function writeCSSLinks(){
  for(var i=0;i<arrCSS.length-1;i++){
    if(i>0) document.write('  '); 
    document.write('<a href="javascript:v()" onclick="setStyleSheet(\'styles'+i+'\')">'+arrCSS[i][0]+'</a>');
  } 
} 
function setStyleSheet(strCSS){
  var objs=document.getElementsByTagName("link");
  var intFound=0;
  for(var i=0;i<objs.length;i++){
    if(objs[i].type.indexOf("css")>-1&&objs[i].title){
      objs[i].disabled = true;
      if(objs[i].title==strCSS) intFound=i;
    }
  }
  
  objs[intFound].disabled = false; 
  writeCookie("stylesheet",objs[intFound].title);
}

writeCSS();
setStyleSheet(readCookie("stylesheet"));

// 隐藏显示换肤框
function ShowHideDiv(init) {
	if(document.getElementById("Sright").style.display == "block"){
	    document.getElementById("Sright").style.display = "none";
  }
  else{
  	document.getElementById("Sright").style.display = "block";
  }
}