﻿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"  
}
//show search
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 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 showenglishbgon(objname,objnum,objlen)
{
 for(var id = 1;id<=objlen;id++)
 {
  var ssobj=objname+id;
  if(id==objnum){
document.getElementById(ssobj).src="http://www.iebook.cn/en/images/menu_over"+id+".jpg";
showDiv('mnav',id,4);
}
else
document.getElementById(ssobj).src="http://www.iebook.cn/en/images/menu_link"+id+".jpg";
  } 
}



