// JavaScript Document
function check_searchform(){
	if (document.forms["searchform"].keywords.value==""){
		//alert("please input the search of keywords!");
		var keywords=document.forms["searchform"].keywords;
		keywords.focus();
		keywords.className="error";
		return false;
	}
	return true;
}
//设为首页
function setHomePage(obj,url){
	obj.style.behavior='url(#default#homepage)';
	obj.setHomePage(url);
}

//加入收藏夹
function addFavorite(urlName,url) {
	window.external.addFavorite(url,urlName);
}

//重写Date方法,如new Date().format("yy-MM-dd")
Date.prototype.format = function(format){
	var o = {
	"M+" : this.getMonth()+1, //month
	"d+" : this.getDate(),    //day
	"h+" : this.getHours(),   //hour
	"m+" : this.getMinutes(), //minute
	"s+" : this.getSeconds(), //second
	"q+" : Math.floor((this.getMonth()+3)/3),  //quarter
	"S" : this.getMilliseconds() //millisecond
	}
	if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
	(this.getFullYear()+"").substr(4 - RegExp.$1.length));
	for(var k in o)if(new RegExp("("+ k +")").test(format))
	format = format.replace(RegExp.$1,
	RegExp.$1.length==1 ? o[k] :
	("00"+ o[k]).substr((""+ o[k]).length));
	return format;
}

//只能输入数字
function onlyNum(e){
 	var theEvent = window.event || e;
	if (theEvent.keyCode < 45 || theEvent.keyCode > 57)
		theEvent.returnValue = false;
}
