// JavaScript Document
/*
Made by huad
2008-12-10
*/
function hideandshow(n,w)
{
	if(w=="1")
	{
		try{document.getElementById(n).style.display="block"}catch(e){};
	}
	else
	{
		try{document.getElementById(n).style.display="none"}catch(e){};
	}
}

function secCardSearch(n)
{
	var thisdom=document.getElementById("slidecard").getElementsByTagName("li");
	for(i=0;i<4;i++)
	{
		if(i==n)
		{
			try{thisdom[i].className="cardSelectedSearch1";}catch(e){};
			secaction(i);
		}
		else
		{
			try{thisdom[i].className="cardSelectedSearch2"}catch(e){};
		}
	}
}

function sm()
{
	if(trim(document.SearchForm.keywords.value) == "")
	{
	    alert("中国114库提醒您：\n\n搜索关键字不能为空，请重新输入!");
	    document.SearchForm.keywords.focus();
	    return false;
	}
	switch (document.SearchForm.which.value)
	{
	  case "all":
	  actionurl="/search/searchall.asp";
	  break;
	  
	  case "corporation":
	  actionurl="/search/searchcor.asp";
	  break;
	  
	  case "news":
	  actionurl="/search/searchnews.asp";
	  break;  
	}
	document.SearchForm.action=actionurl;
}

function trim(inputString)
{
	if (typeof inputString != "string") { return inputString; }
    var retValue = inputString;
    var ch = retValue.substring(0, 1);
    while (ch == " ") { 
	 //检查字符串开始部分的空格
         retValue = retValue.substring(1, retValue.length);
         ch = retValue.substring(0, 1);
    }
    ch = retValue.substring(retValue.length-1, retValue.length);
    while (ch == " ") {
        //检查字符串结束部分的空格
       retValue = retValue.substring(0, retValue.length-1);
       ch = retValue.substring(retValue.length-1, retValue.length);
    }
    while (retValue.indexOf("  ") != -1) { 
	    //将文字中间多个相连的空格变为一个空格
       retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
    }
    return retValue;
} 

function secaction(n)
{
	var actionurl;
	switch (n)
	{
	  case 0:
	  actionurl="/search/searchall.asp";
	  break;
	  
	  case 1:
	  actionurl="/search/searchcor.asp";
	  break;
	  
	  case 2:
	  actionurl="/search/searchnews.asp";
	  break;  
	  
	  case 3:
	  actionurl="http://qun.114ku.com/search/Search.asp";
	  break; 
	}
	document.SearchForm.action=actionurl;
}
function showDiv(obj,num)
{
 for(var id = 1;id<=2;id++)
 {
  var setID=obj+id;
  var setnavID=obj+"nav"+id;
  if(id==num){
  try{document.getElementById(setID).style.display="block"}catch(e){};
  try{document.getElementById(setnavID).className="ontilte"}catch(e){};
  }else{
  try{document.getElementById(setID).style.display="none"}catch(e){};
  try{document.getElementById(setnavID).className="outtilte"}catch(e){};
  }
 }  
}
function show_sader(mylink)
{
window.open(mylink,'','top=50,left=150,width=264,height=462,scrollbars=no')
}

function printyear()
{
	today=new Date();
	document.write(today.getYear());
}

function GQPicOnload(PicObject)
{
	if(PicObject.height>PicObject.width)
	{
		PicObject.height=100;
	}
	else{
		PicObject.width=100;
	}	
}

function GQPicOnError(PicObject)
{
	PicObject.src="/picture/gongying.gif";
}
function closeLB(){
	document.getElementById('luckyBox').style.display='none';
	document.getElementById('luckyBox1').style.display='none';
}
function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
function cpIt(s){   
    if (window.clipboardData) {   
        window.clipboardData.setData("Text",s);   
    }   
    else   
    {     
        var flashcopier = 'flashcopier';   
        if(!document.getElementById(flashcopier)) {   
          var divholder = document.createElement('div');   
          divholder.id = flashcopier;   
          document.body.appendChild(divholder);   
        }   
        document.getElementById(flashcopier).innerHTML = '';   
        var divinfo = '<embed src="/js/clipboard.swf" FlashVars="clipboard='+encodeURIComponent(s)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';   
        document.getElementById(flashcopier).innerHTML = divinfo;   
    }   
    alert("\r\n信息：\r\n\r\n恭喜您，您需要的信息已经被成功复制到剪贴板了！\r\n\r\n贴心小提示：\r\n\r\n(1) 按 Ctrl+v 可以将上面信息粘贴到您指定的位置。\r\n\r\n(2) 按空格键可迅速关闭本提示框");   
}