//Chrome Drop Down Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: June 14th, 06'

var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: true, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(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;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
}
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
}

}

//tab
function show_area(pre,n,select_n){
for (i=1;i <= n;i++){
var aread=document.getElementById(pre+i);
aread.style.display="none";
if(i==select_n){aread.style.display="block";}
}}
function hide_area(pre,n,select_n){
var aread=document.getElementById(pre+select_n);
aread.style.display="none";
}
function G(id){return document.getElementById(id);}
function show_tab(pre,pree,cls,n,select_n){
for (i=1;i <= n;i++){
var intro=G(pre+i);
var cha=G(pree+i);
intro.style.display="none";
cha.className=cls+"2";
if(i==select_n){
intro.style.display="block";
cha.className=cls+"1";
}
}
}

//大图页幻灯
function featuredcontentslider_init(a){featuredcontentslider.init(a)}var featuredcontentslider={settingcaches:{},init:function(a){if(this.$(a.id)==null)return;this.settingcaches[a.id]=a;a.contentdivs=[];a.toclinks=[];a.topzindex=0;a.currentpage=a.playtab||1;a.prevpage=a.currentpage;a.etype="on"+(a.revealtype||"click");a.curopacity=0;this.buildpaginate(a)},buildpaginate:function(b){this.buildcontentdivs(b);var e=this.$(b.id),f=this.$("paginate-"+b.id),j="",i=b.toc,d=b.nextprev;if(typeof i=="string"&&i!="markup"&&i!="scroll"||typeof i=="object"){for(var c=1;c<=b.contentdivs.length;c++){j+='<i class="iToc iToc'+c+'"><a href="#'+c+'" class="toc">'+(typeof i=="string"?i.replace(/#increment/,c):i[c-1])+'</a></i> '}j=(d[0]!=''?'<i class="iToc iToc'+c+'"><a href="#prev" class="prev">'+d[0]+'</a></i> ':'')+j+(d[1]!=''?'<i class="iToc iToc'+c+'"><a href="#next" class="next">'+d[1]+'</a></i>':'');f.innerHTML='<i class="subLineTab"></i><span class="subPageTab">'+j+'</span>'}var h=[],m=f.getElementsByTagName("*");for(var c=0;c<m.length;c++){if(m[c].nodeType==1)h.push(m[c])}var k=0,n=this;for(var c=0;c<h.length;c++){if(this.css(h[c],"toc","check")){if(k>b.contentdivs.length-1){h[c].style.display="none";continue}if(i=="scroll"){if(!k){var o=f.getElementsByTagName("div");this.masker=o[0];this.maskee=o[1];this.thumbWidth=[0]}var l=this.thumbWidth,g=h[c];g.style.styleFloat=g.style.cssFloat="left";l.push(l[l.length-1]+g.offsetWidth+this.style(g,"marginLeft",true)+this.style(g,"marginRight",true)+this.style(g,"borderLeftWidth",true)+this.style(g,"borderRightWidth",true))}h[c].setAttribute("rel",++k);h[c][b.etype]=function(){var a=this.getAttribute("rel");if(n.delayTimer)window.clearTimeout(n.delayTimer);n.delayTimer=window.setTimeout(function(){featuredcontentslider.turnpage(b,a)},b.delay);return false};b.toclinks.push(h[c])}else if(this.css(h[c],"prev","check")||this.css(h[c],"next","check")){h[c].onclick=function(){featuredcontentslider.turnpage(b,this.className);return false}}}this.turnpage(b,b.currentpage,true);if(b.autorotate[0]){f[b.etype]=function(){return false};e["onmouseover"]=f["onmouseover"]=function(){featuredcontentslider.cleartimer(b,window["fcsautorun"+b.id]);return true};e["onmouseout"]=f["onmouseout"]=function(){featuredcontentslider.autorotate(b);return true};b.autorotate[1]=b.autorotate[1]+(1/b.enablefade[1]*80);this.autorotate(b)}},buildcontentdivs:function(a){var b=this.$(a.id).getElementsByTagName("div");for(var e=0;e<b.length;e++){if(this.css(b[e],"contentdiv","check")){a.contentdivs.push(b[e]);b[e].style.display="none";b[e].style.overflow="hidden"}}},jumpTo:function(a,b){this.turnpage(this.settingcaches[a],b)},turnpage:function(a,b,e){var f=a.currentpage,j=a.contentdivs,i=j.length,d=(/prev/i.test(b))?f-1:(/next/i.test(b))?f+1:b|0;d=(d<1)?i:(d>i)?1:d;if(d==a.currentpage&&typeof e=="undefined")return;a.currentpage=d;j[a.prevpage-1].style.display="none";j[d-1].style.zIndex=++a.topzindex;this.cleartimer(a,window["fcsfade"+a.id]);a.cacheprevpage=a.prevpage;if(a.enablefade[0]){a.curopacity=0;this.fadeup(a)}j[d-1].style.visibility="visible";j[d-1].style.display="block";if(a.prevpage<=a.toclinks.length)this.css(a.toclinks[a.prevpage-1],"selected","remove");if(d<=a.toclinks.length)this.css(a.toclinks[d-1],"selected","add");a.prevpage=d;if(a.toc=="scroll"){var c=this,h=0.25,m=20,k=c.masker.clientWidth,n=a.contentdivs.length,o=a.toclinks[d-1],l=this.thumbWidth[this.thumbWidth.length-1],d=k/2-o.offsetWidth/2-this.thumbWidth[d-1],g=c.maskee.currentStyle?c.maskee.currentStyle["marginLeft"]:window.getComputedStyle(c.maskee,"").getPropertyValue("margin-left");g=g.substr(0,g.length-2)|0;d=d<=k-l?k-l:d;d=d>0?0:d;function p(){g+=(d-g)*h;if(Math.round(d-g)==0){window.clearInterval(c.thumbTimer);return}c.maskee.style.marginLeft=Math.ceil(g)+"px"}if(c.thumbTimer)window.clearInterval(c.thumbTimer);c.thumbTimer=window.setInterval(p,m)}},setopacity:function(a,b){var e=a.contentdivs[a.currentpage-1];e.className="contentdiv sliderfilter";e.style.cssText+=";filter:alpha(opacity="+b*100+");-moz-opacity:"+b+";opacity:"+b;a.curopacity=b},fadeup:function(a){if(a.curopacity<=0.95){this.setopacity(a,a.curopacity+a.enablefade[1]);window["fcsfade"+a.id]=setTimeout(function(){featuredcontentslider.fadeup(a)},25)}else{this.setopacity(a,1);var b=a.contentdivs[a.currentpage-1];b.className="contentdiv";if(a.cacheprevpage!=a.currentpage)a.contentdivs[a.cacheprevpage-1].style.display="none"}},cleartimer:function(a,b){if(b){clearTimeout(b);clearInterval(b);if(a.cacheprevpage!=a.currentpage){a.contentdivs[a.cacheprevpage-1].style.display="none"}}},css:function(a,b,e){var f=new RegExp("(^|\\s+)"+b+"($|\\s+)","ig");if(e=="check")return f.test(a.className);else if(e=="remove")a.className=a.className.replace(f,"");else if(e=="add")a.className+=" "+b},style:function(a,b,e){var f;if(a.currentStyle){f=a.currentStyle[b]}else if(window.getComputedStyle){b=b.replace(/([A-Z])/g,"-$1");b=b.toLowerCase();f=window.getComputedStyle(a,"").getPropertyValue(b)}return!e?f:f.substr(0,f.length-2)|0},autorotate:function(a){window["fcsautorun"+a.id]=setInterval(function(){featuredcontentslider.turnpage(a,"next")},a.autorotate[1])},$:function(a){return document.getElementById(a)}}

