// JScript 文件

function CreateXmlRequest(){
	http_request=false;
	if(window.XMLHttpRequest){//Mozilla
		http_request=new XMLHttpRequest();
		if(http_request.overrideMimeType){
			//http_request.overrideMimeType('text/xml');
		}
	}else if(window.ActiveXObject){//IE
		try{
			http_request=new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				http_request=new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){}
		}
	}
	if(!http_request){
		throw('Giving up:(Cannot create an XMLHTTP instance)');
	}
	return http_request;
}
function getUrlToInnerHTML(id,url){
	return getUrlToInnerHTML(id,url,null);
}
function getUrlToInnerHTML(id,url,onevent){
	try{
		var xhttp=CreateXmlRequest();
		var nParamter='';
		try{
			nParamter=document.getElementById(id).getAttribute('paramter');
		}catch(err){ /*alert("Can't find DIV with id='"+id+"'!");*/return;}
		if(nParamter!=null){url+='&paramter='+nParamter;}
		xhttp.onreadystatechange=function(){
			//if(id=="channel_include"){
			//	alert("xhttp.readyState:"+xhttp.readyState+" , xhttp.status:"+xhttp.status+" , window.location.href:"+window.location.href);
			//}
			if(xhttp.readyState == 4 && (xhttp.status==200 || window.location.href.indexOf("http")==-1)){
				//alert(id+'   :   '+url);
				document.getElementById(id).innerHTML=xhttp.responseText;
				if(onevent!=null){onevent(xhttp.responseText);}
			}else if(xhttp.readyState == 1){
				//
			}
		}
		xhttp.open("GET",url,true);
		xhttp.send(null);
	}catch(err)
	{
		document.getElementById(id).innerHTML="Err:"+err;
	}
}
function getUrlToFunction(url,onevent){
	try{
		var xhttp=CreateXmlRequest();
		xhttp.onreadystatechange=function(){
			//if(id=="channel_include"){
			//	alert("xhttp.readyState:"+xhttp.readyState+" , xhttp.status:"+xhttp.status+" , window.location.href:"+window.location.href);
			//}
			if(xhttp.readyState == 4 && (xhttp.status==200 || window.location.href.indexOf("http")==-1)){
				//alert(id+'   :   '+url);
				onevent(xhttp.responseText);
			}else if(xhttp.readyState == 1){
				//
			}
		}
		xhttp.open("GET",url,true);
		xhttp.send(null);
	}catch(err)
	{
		onevent("Err:"+err);
	}
}
//设置为首页
  function setHomePage()
  {
  var sURL=" http://lssp.cqvip.com/";
  if (document.all)
  　 {
  　　　 document.body.style.behavior = 'url(#default#homepage)';
  　　　 document.body.setHomePage(sURL);
  　 }
  　 else if (window.sidebar)
  　 {
  　　　 if (window.netscape)
  　　　 {
  try
  {
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  }
  catch (e)
  {
  alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
  }
  　　　 }
  　　　 var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
  　　　 prefs.setCharPref('browser.startup.homepage', sURL);
  　 }
  }
//添加收藏
function addFavorite()
{
    typeid=1;
    var address=window.location.href;
	if(typeid==1)
	{
	   if (document.all)
       {
          window.external.addFavorite(address,"文献共享服务平台");
       }
       else if (window.sidebar)
       {
          window.sidebar.addPanel("文献共享服务平台", address, "");
       }
	}
}
