﻿function showDiv(obj,num,len)
{
 for(var id = 1;id<=len;id++)
 {
  var ss=obj+id;
  if(id==num){
  try{document.getElementById(ss).style.display="block"}catch(e){};
  }else{
  try{document.getElementById(ss).style.display="none"}catch(e){};
  }
 }  
}
function qc(name,cd)
{
 for(var id = 1;id<=cd;id++)
 {
  var sid=name+id;
  try{document.getElementById(sid).style.display="none"}catch(e){};
 }  
}
function affiche() {
document.getElementById("affiche").style.display="none"
}
function afficheout() {
document.getElementById("affiche").style.display="block"  
}


function showiebookbgon(objname,objnum,objlen)
{
 for(var id = 1;id<=objlen;id++)
 {
  var ssobj=objname+id;
  if(id==objnum){
document.getElementById(ssobj).src="images/navover"+id+".gif";
showDiv('mnav',id,10);
if(objnum!=1)
document.getElementById("affiche").style.display="none";
}
else
document.getElementById(ssobj).src="images/navlink"+id+".gif";
  } 
}

//点击申请
function openSq(url)
		{
			window.open(url,'_blank',"width=682,height=670, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no'");
		}


function showTab(obj,obj2,num,len,listyle)
{
 for(var id = 1;id<=len;id++)
 {
  var ss=obj+id;
  var ss2=obj2+id;
  if(id==num){
  try{
document.getElementById(ss2).className=listyle;
document.getElementById(ss).style.display="block"}catch(e){};
  }else{
  try{
document.getElementById(ss2).className="";
document.getElementById(ss).style.display="none"}catch(e){};
  }
 }  
}

function showTabBG(obj2,num,len,listyle)
{
 for(var id = 1;id<=len;id++)
 {
  var ss2=obj2+id;
  if(id==num){
  try{
document.getElementById(ss2).className=listyle}catch(e){};
  }else{
  try{
document.getElementById(ss2).className=""}catch(e){};
  }
 }  
}



function showDiv(obj,num,len)
{
 for(var id = 1;id<=len;id++)
 {
  var ss=obj+id;
  if(id==num){
  try{document.getElementById(ss).style.display="block"}catch(e){};
  }else{
  try{document.getElementById(ss).style.display="none"}catch(e){};
  }
 }  
}

//头部菜单前两个
function ddin(ddobj,ddnum,topobj,topnum) {
var mm=ddobj+ddnum;
var topmm=topobj+topnum;
document.getElementById(mm).style.display="block";
document.getElementById(topmm).className="toplinkhover";
}
function ddout(doutobj,doutnum,topoobj,toponum) {
var outt=doutobj+doutnum;
var topout=topoobj+toponum;
document.getElementById(outt).style.display="none";
document.getElementById(topout).className="toplink";  
}
//后三个
function dd3in(dd3obj,dd3num,top3obj,top3num) {
var mm3=dd3obj+dd3num;
var top3mm=top3obj+top3num;
document.getElementById(mm3).style.display="block";
document.getElementById(top3mm).className="toplinkbhover";
}
function dd3out(dout3obj,dout3num,top3oobj,top3onum) {
var outt3=dout3obj+dout3num;
var top3out=top3oobj+top3onum;
document.getElementById(outt3).style.display="none";
document.getElementById(top3out).className="toplinkb";  
}


function GotoSearch()
{
	
//alert(window.document.getElementById("search_content").getAttribute("value"));
if(document.getElementById("search_content").value=="" || document.getElementById("search_content").value=="Search..")
alert("搜索内容不能为空！");
else
window.location.href="http://www.iebook.cn/search/Default.aspx?keyword="+escape(document.getElementById("search_content").value);

return false;
}

function ClearWord()
{
    if(document.getElementById("search_content").value=="Search..")
    {
        window.document.getElementById("search_content").setAttribute("value","");
    }
    else
    {
         document.getElementById("search_content").select();
    }
    
    document.getElementById("search_content").style.color="#000000";
    
}

function UTF8UrlEncode(input)
{
	var output = "";
	var currentChar = '';
	
	for(var counter = 0; counter < input.length; counter++) 
	{
		currentChar = input.charCodeAt(counter);
		
		if((48 <= currentChar) && (currentChar <= 57))
			output = output + input.charAt(counter);
		else if((65 <= currentChar) && (currentChar <= 90))
			output = output + input.charAt(counter);
		else if((97 <= currentChar) && (currentChar <= 122))
			output = output + input.charAt(counter);
		else
			output =  output + UTF8UrlEncodeChar(currentChar); 
	}
	return output;
}

function UTF8UrlEncodeChar(input)
{
	if(input <= 0x7F) return "%" + input.toString(16);

	var leadByte = 0xFF80; var hexString = ""; var leadByteSpace = 5;
	while(input > (Math.pow(2, leadByteSpace + 1) - 1))
	{
		hexString = "%" + ((input & 0x3F) | 0x80).toString(16) + hexString;
		leadByte = (leadByte >> 1);
		leadByteSpace--;
		input = input >> 6;
	} 
	return ("%" + (input | (leadByte & 0xFF)).toString(16) + hexString).toUpperCase();

}



function shownews(objt,objt2,objt3,numt,lent,listylet,ulstyle)
{
 for(var id = 1;id<=lent;id++)
 {
  var sst=objt+id;
  var sst2=objt2+id;
  var ulstyle3=ulstyle+id;
  if(id==numt){
  try{
document.getElementById(sst2).className=listylet;
document.getElementById(objt3).className=ulstyle3;
showwidth(objt2,id);
document.getElementById(sst).style.display="block"}catch(e){};
  }else{
  try{
document.getElementById(sst2).className="";
document.getElementById(sst).style.display="none"}catch(e){};
  }
 }  
}
function showwidth(setidname,byid)
{
  switch(byid){
   case 1:  document.getElementById(setidname+"1").style.width="88px";
document.getElementById(setidname+"2").style.width="71px";
document.getElementById(setidname+"3").style.width="76px";
break;
      case 2:  document.getElementById(setidname+"1").style.width="72px";
document.getElementById(setidname+"2").style.width="88px";
document.getElementById(setidname+"3").style.width="75px";
break;
      case 3:  document.getElementById(setidname+"1").style.width="78px";
document.getElementById(setidname+"2").style.width="70px";
document.getElementById(setidname+"3").style.width="88px";
break;
   default: document.getElementById(setidname+"1").style.width="88px";break;
}
}


function showcases(objt,objt2,objt3,numt,lent,listylet,ulstyle)
{
 for(var id = 1;id<=lent;id++)
 {
  var sst=objt+id;
  var sst2=objt2+id;
  var ulstyle3=ulstyle+id;
  if(id==numt){
  try{
document.getElementById(sst2).className=listylet;
document.getElementById(objt3).className=ulstyle3;
showwidth2(objt2,id);
document.getElementById(sst).style.display="block"}catch(e){};
  }else{
  try{
document.getElementById(sst2).className="";
document.getElementById(sst).style.display="none"}catch(e){};
  }
 }  
}
function showwidth2(setidname,byid)
{
  switch(byid){
   case 1:  document.getElementById(setidname+"1").style.width="88px";
document.getElementById(setidname+"2").style.width="68px";
document.getElementById(setidname+"3").style.width="66px";
document.getElementById(setidname+"4").style.width="70px";
document.getElementById(setidname+"5").style.width="76px";
break;
      case 2:  document.getElementById(setidname+"1").style.width="68px";
document.getElementById(setidname+"2").style.width="80px";
document.getElementById(setidname+"3").style.width="75px";
document.getElementById(setidname+"4").style.width="70px";
document.getElementById(setidname+"5").style.width="76px";
break;
      case 3:  document.getElementById(setidname+"1").style.width="70px";
document.getElementById(setidname+"2").style.width="70px";
document.getElementById(setidname+"3").style.width="88px";
document.getElementById(setidname+"4").style.width="63px";
document.getElementById(setidname+"5").style.width="75px";
break;
      case 4:  document.getElementById(setidname+"1").style.width="70px";
document.getElementById(setidname+"2").style.width="70px";
document.getElementById(setidname+"3").style.width="68px";
document.getElementById(setidname+"4").style.width="88px";
document.getElementById(setidname+"5").style.width="70px";
break;
      case 5:  document.getElementById(setidname+"1").style.width="70px";
document.getElementById(setidname+"2").style.width="70px";
document.getElementById(setidname+"3").style.width="70px";
document.getElementById(setidname+"4").style.width="70px";
document.getElementById(setidname+"5").style.width="88px";
break;
   default: document.getElementById(setidname+"1").style.width="88px";break;
}
}


/*第一种形式 第二种形式 更换显示样式*/ 
function setTab(name,cursel,n)
{ 
  for(i=1;i<=n;i++){ 
  var menu=document.getElementById(name+i); 
  var con=document.getElementById("con_"+name+"_"+i); 
  //var more=document.getElementById("more_"+name+"_"+i);
  menu.className=i==cursel?"hover":""; 
  con.style.display=i==cursel?"block":"none"; 
  //more.style.display=i==cursel?"block":"none"; 
} 
} 