function JSAddFavorite()
{
	if ( window.sidebar && "object" == typeof( window.sidebar ) && "function" == typeof( window.sidebar.addPanel ) )
	{
		//  firefox
		window.sidebar.addPanel( document.title, document.location.href, '' );
	}
	else if ( document.all && "object" == typeof( window.external ) )
	{
		//  ie
		window.external.addFavorite( document.location.href, document.title );
	}
}

function JSSetHome()
{
	if ( document.all && "object" == typeof( window.external ) )
	{
		var obj = document.getElementById("swsy");
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage('http://qiansn.com/');
	}
	else
	{
		alert("该功能仅在微软的IE浏览器下有效 -_-");
	}
}

function inputbox(inputarr){
	var formlists=document.getElementsByTagName("form");
	for(var i=0;i<formlists.length;i++){
		formlists[i].reset();
	}
	inputarr=inputarr.split(",");
	for(var i=0;i<inputarr.length;i++){
		inputoc(inputarr[i]);
	}
}

function inputoc(inputname){
	var valuetxt=getObject(inputname).value;
	getObject(inputname).onclick=function(){
		if(getObject(inputname).value==valuetxt){
			getObject(inputname).value="";
			getObject(inputname).style.color="#000";
		}
	}
	getObject(inputname).onkeydown=function(){
		if(getObject(inputname).value==valuetxt){
			getObject(inputname).value="";
			getObject(inputname).style.color="#000";
		}
	}
	/*getObject(inputname).ondblclick=function(){
		getObject(inputname).value="";
		getObject(inputname).style.color="#000";
	}*/
	getObject(inputname).onmouseover=function(){
		getObject(inputname).style.color="#000";
		getObject(inputname).style.border="1px solid #7C6";
		if(getObject(inputname).value!=valuetxt){
			getObject(inputname).select();
		}
	}
	getObject(inputname).onmouseout=function(){
		getObject(inputname).style.border="1px solid #BBB";
		getObject(inputname).value=getObject(inputname).value;
		if(getObject(inputname).value=="" || getObject(inputname).value==valuetxt){
			getObject(inputname).style.color="#999";
			getObject(inputname).value=valuetxt;
		}
	}
}

function getObject(objectId) {
     if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	   return document.getElementById(objectId);
     } 
     else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	   return document.all(objectId);
     } 
     else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	   return document.layers[objectId];
     } 
     else {
	   return false;
    }
}
