function chg(obj,color){
	var f = false;
	Set(color);
	/*
	$(obj).parent().children().each(function(){
		var subimg = $(this).children().attr("src");
		$(this).children().attr("src",subimg.replace("2","1"));
	});

	var imgsrc = $(obj).children().attr("src");
	$(obj).children().attr("src", imgsrc.replace("1","2"));
	*/
	for( i=0 ; i < document.styleSheets.length ; i++){
		if(document.styleSheets.item(i).href.indexOf('master')>-1){
			continue;}
			document.styleSheets.item(i).disabled = true;
	}
	for( i=0 ; i < document.styleSheets.length ; i++){
		if( document.styleSheets.item(i).href.indexOf(color) >-1 ){
			document.styleSheets.item(i).disabled = false;
			return;
		}
	}
	$.include("/css/"+color+".css");
	return false;
}

function Set(color){
	var Then = new Date() ;
	Then.setTime(Then.getTime() + 60000000*1000 ) ;
	document.cookie = "css="+color+";expires="+ Then.toGMTString() ;
	//alert(document.cookie +" | "+ Then.toGMTString() );
}


function Get(){ 
	var cookieString = new String(document.cookie);
	var cookieHeader = "css=";
	var beginPosition = cookieString.indexOf(cookieHeader);
	if (beginPosition != -1){
		return(  cookieString.substring(beginPosition + cookieHeader.length) );
	}else
		return false;
}


//在页面加载时来读取用的COOKIE中保存的样式文件名,如果存在文件名将重新导入该样式
function loadchg(){
	var color = Get();
	if(!color) return;
	else color = color.split(";");
	$.include("/css/"+color[0]+".css");
}












//add favorites
function bookmark(){
var title=document.title
var url=document.location.href
if (window.sidebar) window.sidebar.addPanel(title, url,"");
else if( window.opera  &&  window.print ){
var mbm = document.createElement('a');
mbm.setAttribute('rel','sidebar');
mbm.setAttribute('href',url);
mbm.setAttribute('title',title);
mbm.click();}
else if( document.all ) window.external.AddFavorite( url, title);
}

//remove google images search border
if(top.location!=self.location)top.location=self.location;
