﻿//--------------------排行榜---------
//操作条菜单
function showgaoji(obj,str){
    var x=getposOffset_top(obj,'left');
    var y=getposOffset_top(obj,'top');
	var divotherChannel=document.getElementById("otherChannel"+str); 
	var img_obj=document.getElementById("img_otherchannel");
	
    var frm=document.searchadvformnewbook;
    var d=new Date();
    var yearn=d.getFullYear(); 
	if(frm){
	if(frm.catalog.value.substring(0,2)=="01"){
		if(frm.sy.options.length<2&&frm.ey.options.length<2){
			for(i=2;i<7;i++){
				var option = new Option(yearn,yearn);
				frm.sy.options.add(option,i);
				var option1 = new Option(yearn,yearn);
				frm.ey.options.add(option1,i);
				yearn--;
			}
		}
	}
	}
	if(img_obj!=null)
		img_obj.src="/images/myHome_down.gif";
	divotherChannel.style.left=(x-5)+'px';
	if(!isIE_c())
	    divotherChannel.style.top=(y+16)+'px';
	else
	    divotherChannel.style.top=(y+16)+'px';
	divotherChannel.style.display="inline";
    showhideobject(1);    
}

function showhideobject(tr){
	return ;
}

function hideotherchannel(str){
		var divotherChannel=document.getElementById("otherChannel"+str);
	var img_obj=document.getElementById("img_otherchannel");
    if(divotherChannel.style.display!="none"){
    divotherChannel.style.display="none";
		if(img_obj!=null){
		img_obj.src="/images/myHome_up.gif";
		}	
    }
	}

//取位置
function getposOffset(what, offsettype)
{ 
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; 
    var parentEl=what.offsetParent; 
    while (parentEl!=null)
    { 
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; 
         parentEl=parentEl.offsetParent; 
    } 
    return totaloffset; 
}

function getposOffset_top(what, offsettype)
{ 
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; 
    var parentEl=what.offsetParent; 
    while (parentEl!=null)
    { 
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; 
         parentEl=parentEl.offsetParent; 
    } 
    return totaloffset; 
}

//ff兼容
function isIE_c(){ 
   return window.navigator.userAgent.toLowerCase().indexOf("msie")>=1?true:false; 
} 

if(!isIE_c()){ //firefox innerText define
   HTMLElement.prototype.__defineGetter__(     "innerText", 
    function(){
     var anyString = "";
     var childS = this.childNodes;
     for(var i=0; i<childS.length; i++) {
      if(childS[i].nodeType==1)
       anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText;
      else if(childS[i].nodeType==3)
       anyString += childS[i].nodeValue;
     }
     return anyString;
    } 
   ); 
   HTMLElement.prototype.__defineSetter__(     "innerText", 
    function(sText){ 
     this.textContent=sText; 
    } 
   ); 
}
