var oScript = document.createElement("SCRIPT");
oScript.src = "/include/js/system.config.js";
var system_root="/";
var _sto = window.setTimeout;
document.getElementsByTagName("HEAD")[0].appendChild(oScript);;

function getLoad(){
	var t = new Date().getTime();
	jQuery("#iStatus").empty().load(system_root+"member/login.php",{t:t,action:"js"});
}

function closeBox(id){
	if(id)
	{
		jQuery("#"+id).hide();
	}else{
	jQuery("#login_box").hide();
    jQuery("#mask").hide();
     jQuery("#user_center").hide();
	getLoad();
	}
}

String.prototype.striphtml = function(){return this.replace(/<\/?[^>]+>/g,'');};
String.prototype.trim = function(){var temp = this.replace(/(^\s*)|(\s*$)/g,"");return temp.replace(/(\s*)/g,"");};
window.setTimeout = function(callfunc,delay){
	if(typeof callfunc == 'function'){
		var args = Array.prototype.slice.call(arguments,2);
		var func = (function(){callfunc.apply(null,args);});
		return _sto(func,delay);
	}
	return _sto(callfunc,delay);
}

$(function(){
var sWidth,sHeight;
sWidth = screen.width;
sWidth = document.body.offsetWidth;
sHeight=document.body.offsetHeight;
if (sHeight<screen.height){sHeight=screen.height;}
jQuery("#mask").css("width" , sWidth + "px");
jQuery("#mask").css("height" , sHeight + "px");
jQuery("#mask").hide();
  jQuery("#user_center").hide();
})

//by nardo 2008-11-10
//brandmall清除搜索栏
function clrKeyword(obj)
{
	obj.value = '';
	var length = document.searchForm.searchtype.length;
	for(var i=0;i<length;i++)
	{
		if(document.searchForm.searchtype[i].checked)
		{
			var type = document.searchForm.searchtype[i].value;
			if(type == 'product'){obj.title = '请输入商品名称作为关键词';}
			if(type == 'company'){obj.title = '请输入商品或店铺名称作为关键词';}
		}
	}
}

//by nardo 2008-12-24
function searchWord(keyword,mod){window.location.replace(encodeURI(system_root+mod+"/search.php?search=1&keyword="+keyword));}
function addStyle(obj){obj.className="addunderline";}
function delStyle(obj){obj.className="nounderline";}
function addClickEvent(id){
	var oTags = document.getElementById(id);
	if(oTags){
		var tags = oTags.getElementsByTagName("kbd");
		var len = tags.length;
		for(var i=0;i<len;i++){
			tags[i].onclick = function(){
				var mods = id.split("_");
				if(mods[2]){searchWord(this.innerHTML,mods[2]);}
				else{searchWord(this.innerHTML,"brandmall")}
			};
			tags[i].onmouseover = function(){addStyle(this);};
			tags[i].onmouseout = function(){delStyle(this);};
		}
	}
}
function addClickEvents()
{
	addClickEvent("tdbox");
	addClickEvent("search_hot_brandmall");
	addClickEvent("search_hot_supplier");
	addClickEvent("search_hot_trademark");
	addClickEvent("search_hot_txjy");
}
window.onload = addClickEvents;