function changeBorder(obj, isOver){
		obj.style.border = isOver ? "#0000FF 1px solid" : "#F6F6F6 1px solid"
}
function padinput(obj, isBlur){
	isBlur ? (obj.value=="" ? (obj.value=obj.getAttribute("defaultValue"),obj.className="gray") : "") : ((obj.value==obj.getAttribute("defaultValue")) ? (obj.value="",obj.className="black") : "");
}

function  reSizeImage(ImgObj, reWidth, reHeight){
	reWidth = reWidth || 200; reHeight=reHeight || 150;
	var image=new  Image(); image.src=ImgObj.src;
	if(image.width>0 || image.height>0){
		if(image.width / image.height >=  reWidth / reHeight){
			if(image.width > reWidth){
				ImgObj.width  = reWidth;
				ImgObj.height = (image.height * reWidth) / image.width;
			}else{
				 ImgObj.width = image.width;
				 ImgObj.height= image.height;
			}
        }else{
			if(image.height > reHeight){
				ImgObj.height =reHeight;
				ImgObj.width  =(image.width*reHeight) / image.height;
				}else{
				ImgObj.width  =image.width;
				ImgObj.height =image.height;
			}
		}
	}else{
		imgObj.width=image.width;
		imgObj.height=image.height;
	}
	//return;
	//ImgObj.style.position="absolute";
	var parentNode=findNode(ImgObj,"DIV","parent");
	var pWidth=parentNode.offsetWidth;
	var pHeight=parentNode.offsetHeight;
	ImgObj.style.marginLeft=(pWidth-ImgObj.offsetWidth)/2+"px";
	ImgObj.style.marginTop=(pHeight-ImgObj.offsetHeight)/2+"px";
}

var oldNode;
var nodeStatus=new Object();

String.prototype.trim=function (){return (this.replace(/^[\s\xA0]+/,"").replace(/[\s\xA0]+$/,""));}

//window.onerror=function(a,b,c){if(a.indexOf("Î´Ö¸Ã÷´íÎó")>=0)return true;else return true;}
//document.oncontextmenu=function(){return false}
function findNode(obj, nName, type){
		if (typeof(obj)!="object") return false;
		if (obj.nodeName.toLowerCase()==nName.toLowerCase()) return obj;
		type = type ? type.toLowerCase() : "child";
		if (type=="child" && obj.childNodes){
			for (var i=0; i<obj.childNodes.length; i++){
				if (obj.childNodes[i].nodeName == nName){
					return obj.childNodes[i];
					} else {
					var tmp = findNode (obj.childNodes[i], nName, type);
					if (tmp) return tmp;
				}
			}
		} else if (obj.parentNode){
				if (obj.parentNode.nodeName==nName) return obj.parentNode;
					return findNode (obj.parentNode, nName, type);
		}
		return false;
}
var Ajax={lastModify:"2008.05.08",author:"ÑîËÉ QQ:493150076",getAjax:function (type){type=type ? type : "text/xml";var xmlHttp;if(window.XMLHttpRequest){xmlHttp=new XMLHttpRequest();xmlHttp.overridemimeType=type;}else{try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){xmlHttp=false;}}}return xmlHttp;},dealWithStatus:function(ajaxObj,funcHandle){return function(){if(ajaxObj.readyState==4){if(ajaxObj.status==200){funcHandle(ajaxObj.responseText);return true;}funcHandle(ajaxObj.statusText,ajaxObj.status);}}},send:function (URL,callFunc,method,async){if(!URL||!callFunc)return;method=method?((method.toUpperCase()=="POST")?"POST":"GET"):"GET";async=(typeof(async)=="boolean")?async:true;var s=this.getAjax(); if (!s) return false;s.open(method,URL,async);s.onreadystatechange=this.dealWithStatus(s,callFunc);s.send(null);}};
var Event={_on:"",addEventType:"",removeEvent:"",
	addEvt:function (id, evt, func, cancel, isObj){	
			var tmp=isObj ? id : document.getElementById(id);
			if(tmp)eval("tmp."+this.addEventType+"('"+evt+"',"+func+","+cancel+")");},
	getNode:function (theEvent){
			if(theEvent){return theEvent.target ? theEvent.target : theEvent.srcElement;}
			else{return false;}},
	initialize:function(){
		if(document.addEventListener){this.addEventType="addEventListener";this.removeEvent="removeEventListener";}else if(document.attachEvent){this.addEventType="attachEvent";this.removeEvent="detachEvent";this._on="on";}
	}
}
Event.initialize();
var cookie={
	set:function(s){
		var t=new Date();
		t.setYear((t.getYear()+1));
		document.cookie=s+';expires='+t.toUTCString();
	},
	get:function(s){
		var c=document.cookie;if(!s)return c;
		c=c.split(";");
		var temp;
		for(var i=0;i<c.length;i++){
			temp=c[i].split("=");
			if(temp[0].trim()==s){return temp[1];}
		}
		return false;
	}
}
function getStandardPosition(s){
	var pos={"x":0,"y":0};
	if(typeof window.pageYOffset != 'undefined') {
		pos["x"] = window.pageXOffset;
		pos["y"] = window.pageYOffset;
	}
	else if(typeof document.compatMode != 'undefined' &&
		  document.compatMode != 'BackCompat') {
		  pos["x"] = document.documentElement.scrollLeft;
		  pos["y"] = document.documentElement.scrollTop;
	}
	else if(typeof document.body != 'undefined'){
		pos["x"] = document.body.scrollLeft;
		pos["y"] = document.body.scrollTop;
	}
	return s?(s=="x"?pos["x"]:((s=="y")?pos["y"]:false)):pos;
}

function checkSearch(o){
	o=o.elements;
	return (o["w"].value==""||o["w"].value=='Search products')?false:true;
}

//window.onunload=function(){cookie.set('scrollTop='+getStandardPosition("y"));}
//Event.addEvt(window,Event._on+"load",setPagePosition,false,true);
//function setPagePosition(){var t=cookie.get("scrollTop");if(t)window.scroll(0,t);setMenu();}

function checklogin(o){
	var err="";
	o=o.elements;
	if(o["l_u"].value=="")err+=' Please enter your user name!\n';
	if(o["l_p"].value=="")err+=' Please enter your password!\n';
	if(err){
		return false;
	}
	return true;
}
