﻿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(window.document.getElementById("search_content").getAttribute("value"));

return false;
}

function ClearWord()
{
    if(window.document.getElementById("search_content").getAttribute("value")=="Search..")
    {
        window.document.getElementById("search_content").setAttribute("value","");
    }
    else
    {
         window.document.getElementById("search_content").select();
    }
    
    window.document.getElementById("search_content").style.color="#fff";
    
}

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();

}




