﻿// JavaScript Document
var qswhU2GB=["D2BB","B6A1","8140","C6DF","8141","8142","8143","CDF2","D5C9","C8FD","C9CF","CFC2","D8A2","B2BB","D3EB","8144","D8A4","B3F3","8145"];

var qswhSpell=["a",45217,"ai",45219,"an",45232];

function UrlEncode(str){
	var i,c,ret="",strSpecial="!\"#$%&'()*+,/:;<=>?@[\]^`{|}~%";
	for(i=0;i<str.length;i++){
		if(str.charCodeAt(i)>=0x4e00){
			c=qswhU2GB[str.charCodeAt(i)-0x4e00];
			ret+="%"+c.slice(0,2)+"%"+c.slice(-2);
		}
		else{
			c=str.charAt(i);
			if(c==" ")
				ret+="+";
			else if(strSpecial.indexOf(c)!=-1)
				ret+="%"+str.charCodeAt(i).toString(16);
			else
				ret+=c;
		}
	}
	return ret;
}

function getSpell(str,sp){
	var i,c,t,ret="";
	if(sp==null)sp="";
	for(i=0;i<str.length;i++){
		if(str.charCodeAt(i)>=0x4e00){
			c=parseInt(qswhU2GB[str.charCodeAt(i)-0x4e00],16);
			if(c<55290){
				for(t=qswhSpell.length-1;t>0;t=t-2)if(qswhSpell[t]<=c)break;
				if(t>0)ret+=qswhSpell[t-1]+sp;
			}
		}
	}
	return ret.substr(0,ret.length-sp.length);
}
function changescard(obj){

		var word = ""; 
		if(document.getElementById("contentsearch0").className == "show")
			{
				word = document.getElementById("sht0").value;
			}
			else if(document.getElementById("contentsearch1").className == "show")
			{
				word = document.getElementById("sht").value;
			}
			else if(document.getElementById("contentsearch2").className == "show")
			{
				word = document.getElementById("sht2").value;
			}
			else if(document.getElementById("contentsearch3").className == "show")
			{
				word = document.getElementById("sht3").value;
			}
			

		for(i=0; i <4; i++)
		{
			if (i == obj)
			{
				//document.getElementById("title"+i).className  = "nowcard";
				document.getElementById("contentsearch"+i).className  = "show";	
				if(i==0){
					document.getElementById("sht0").value = word;
				}
				else if(i==1){
					document.getElementById("sht").value = word;
				} 
				else if(i==2){
	       

					document.getElementById("sht2").value = word;
				} 
				else if(i==3){
					document.getElementById("sht3").value = word;
				} 
				
			}else{		
				//document.getElementById("title"+i).className  = "othercard";
				document.getElementById("contentsearch"+i).className  = "hide";
			}
		} 
}
function smt0(){
	var m = "false";
	
          if(document.getElementById("sht0").value==""){
	alert("请添入馆藏目录关键词");
	m="false";
	return;
	}else{
	m="true";
	}
	 if (m=="true") {

	document.sf0.submit();}
}



function request(name)   
{   
  var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");   
  var r = window.location.search.substr(1).match(reg);   
  if (r!=null) return unescape(r[2]); return null;   
} 




function qksmt2()
{

if(document.getElementById("sht2").value=="")
         {
	alert("请添入搜索期刊关键词");
	return;
	}
    //document.getElementById("param_pattern_value").value=document.getElementById("sht2").value

	document.sf2.submit();
}

function xssmt1()
{

if(document.getElementById("sht").value=="")
         {
	alert("请添入搜索学术论文关键词");
	return;
	}

//alert(document.getElementById("sht").value);
	document.sf1.submit();
}

function gpsmt3()
{

if(document.getElementById("sht3").value=="")
         {
	alert("请添入搜索随书光盘关键词");
	return;
	}

	document.sf3.submit();
}


function catalink()
{
var str 
    str=document.getElementById("rft.atitle").value
   // document.getElementById("rft.atitle").value=UrlEncode(str)
    document.OpenURL.submit();
}
