|
|
Line 1: |
Line 1: |
| <html> | | <html> |
- | <script type="text/javascript"> | + | <script> |
- | (function(r,o){
| + | var DDSPEED = 10; |
- | var t=navigator.appVersion.match(/MSIE/i)?navigator.appVersion.replace(/.*?MSIE ([^;]+);.*/i,"$1"):null;
| + | var DDTIMER = 15; |
| | | |
- | function u(c,a){
| + | // main function to handle the mouse events // |
- | var b,d={};
| + | function ddMenu(id,d){ |
- | for(b in a){
| + | var h = document.getElementById(id + '-ddheader'); |
- | d[b]=a[b]
| + | var c = document.getElementById(id + '-ddcontent'); |
- | }
| + | clearInterval(c.timer); |
- | for(b in c){
| + | if(d == 1){ |
- | d[b]=c[b]
| + | clearTimeout(h.timer); |
- | }
| + | if(c.maxh && c.maxh <= c.offsetHeight){return} |
- | return d
| + | else if(!c.maxh){ |
| + | c.style.display = 'block'; |
| + | c.style.height = 'auto'; |
| + | c.maxh = c.offsetHeight; |
| + | c.style.height = '0px'; |
| } | | } |
| + | c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER); |
| + | }else{ |
| + | h.timer = setTimeout(function(){ddCollapse(c)},50); |
| + | } |
| + | } |
| | | |
- | function v(c,a){
| + | // collapse the menu // |
- | return(a||o).getElementsByTagName(c)
| + | function ddCollapse(c){ |
- | }
| + | c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER); |
| + | } |
| | | |
- | function w(){
| + | // cancel the collapse if a user rolls over the dropdown // |
- | var c,a,b=r,d=o,e=d.documentElement,f=d.body;
| + | function cancelHide(id){ |
- | if(b.innerWidth){
| + | var h = document.getElementById(id + '-ddheader'); |
- | c=b.innerWidth;
| + | var c = document.getElementById(id + '-ddcontent'); |
- | a=b.innerHeight
| + | clearTimeout(h.timer); |
- | }else if(e.clientWidth){
| + | clearInterval(c.timer); |
- | c=e.clientWidth;
| + | if(c.offsetHeight < c.maxh){ |
- | a=e.clientHeight
| + | c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER); |
- | }else{
| + | } |
- | c=f.clientWidth;
| + | } |
- | a=f.clientHeight
| + | |
- | }return{'w':c,'h':a}
| + | |
- | }
| + | |
| | | |
- | function x(){
| + | // incrementally expand/contract the dropdown and change the opacity // |
- | var c=o,a=c.documentElement,b=c.body,d,e;
| + | function ddSlide(c,d){ |
- | e=a.scrollHeight;
| + | var currh = c.offsetHeight; |
- | d=a.scrollWidth;
| + | var dist; |
- | if(a.clientHeight>e){
| + | if(d == 1){ |
- | e=a.clientHeight
| + | dist = (Math.round((c.maxh - currh) / DDSPEED)); |
- | }
| + | }else{ |
- | if(a.clientWidth>d){
| + | dist = (Math.round(currh / DDSPEED)); |
- | d=a.clientWidth
| + | } |
- | }
| + | if(dist <= 1 && d == 1){ |
- | if(b.scrollHeight>e){
| + | dist = 1; |
- | e=b.scrollHeight
| + | } |
- | }
| + | c.style.height = currh + (dist * d) + 'px'; |
- | if(b.scrollWidth>d){
| + | c.style.opacity = currh / c.maxh; |
- | d=b.scrollWidth
| + | c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')'; |
- | }return{'w':d,'h':e}
| + | if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){ |
- | }
| + | clearInterval(c.timer); |
- | | + | } |
- | function y(c,a,b,d){
| + | } |
- | if(c.addEventListener){
| + | |
- | c.addEventListener(a,b,d)
| + | |
- | }else{
| + | |
- | c.attachEvent("on"+a,b)
| + | |
- | }
| + | |
- | }
| + | |
- | | + | |
- | function s(c,a){
| + | |
- | for(var b in a){
| + | |
- | c.style[b]=a[b]
| + | |
- | }
| + | |
- | }
| + | |
- | | + | |
- | function p(c,a){
| + | |
- | a=(a==1)?0.99999:a;
| + | |
- | c.style.opacity=a;
| + | |
- | c.style.filter='alpha(opacity='+a*100+')';
| + | |
- | c.style.MozOpacity=a;
| + | |
- | c.style.KhtmlOpacity=a
| + | |
- | }
| + | |
- | | + | |
- | function z(c,a,b,d){
| + | |
- | this.elem=c||o.body;
| + | |
- | this.to=a!==undefined?a:1;
| + | |
- | var e=this.elem.style;
| + | |
- | this.from=(b===undefined?parseFloat(e.opacity):b);
| + | |
- | d=d||{};
| + | |
- | this.duration=d.duration||500;
| + | |
- | this.frameRate=d.frameRate||30;
| + | |
- | this.onFinish=d.onFinish;
| + | |
- | this.totalFrames=Math.ceil(this.duration/1000*this.frameRate);
| + | |
- | this.perFrame=(this.to-this.from)/this.totalFrames;
| + | |
- | this.frameNb=0;var f=this;
| + | |
- | this.next=function(){
| + | |
- | this.prog=setTimeout(function(){f.frame()},1000/this.frameRate)};
| + | |
- | this.frame=function(){
| + | |
- | p(this.elem,this.from+this.perFrame*this.frameNb);
| + | |
- | if(this.frameNb===this.totalFrames){
| + | |
- | p(this.elem,this.to);
| + | |
- | if(typeof this.onFinish=='function'){
| + | |
- | setTimeout(this.onFinish,1)
| + | |
- | }
| + | |
- | }else{
| + | |
- | this.frameNb++;
| + | |
- | this.next()
| + | |
- | }
| + | |
- | };
| + | |
- | this.next()
| + | |
- | } | + | |
- |
| + | |
- | function A(c,a,b){
| + | |
- | var d,e,f,j,k,l,i,g,h;
| + | |
- | b=b||{};
| + | |
- | d=b.max_w;
| + | |
- | e=b.min_w;
| + | |
- | f=b.max_h;
| + | |
- | j=b.max_h;
| + | |
- | k=b.round===undefined?1:b.round;
| + | |
- | l=c/a;
| + | |
- | i=a/c;
| + | |
- | g=a;
| + | |
- | h=c;
| + | |
- | if(h<e){
| + | |
- | h=e;
| + | |
- | g=h*i
| + | |
- | }
| + | |
- | if(g<j){
| + | |
- | g=j;
| + | |
- | h=g*l
| + | |
- | }
| + | |
- | if(d){
| + | |
- | if(h>d){
| + | |
- | h=d;
| + | |
- | g=h*i
| + | |
- | }
| + | |
- | }
| + | |
- | if(f){
| + | |
- | if(g>f){
| + | |
- | g=f;
| + | |
- | h=g*l
| + | |
- | }
| + | |
- | }
| + | |
- | h=h<0?0:h;
| + | |
- | g=g<0?0:g;
| + | |
- | return{w:k?Math.round(h):h,h:k?Math.round(g):g}
| + | |
- | }
| + | |
- | var q={
| + | |
- | defaults:{
| + | |
- | mode:'max',
| + | |
- | enlarge:1,
| + | |
- | reduce:1,
| + | |
- | ffHack:0,
| + | |
- | zIndex:-1,
| + | |
- | position:'absolute',
| + | |
- | align:'center',
| + | |
- | vertAlign:'top',
| + | |
- | fadeAfter:400,
| + | |
- | fadeOptions:{duration:1000,frameRate:25}
| + | |
- | },
| + | |
- | redim:function(){
| + | |
- | var c=q,a,b,d=w(),e,f,j,k,l,i,g,h,m,n;
| + | |
- | a=c.img;f=j=k=l='';
| + | |
- | b=c.opt;
| + | |
- | i=a.fileDim;
| + | |
- | if(i){
| + | |
- | if(b.mode=='full'){
| + | |
- | g=m=d.w;
| + | |
- | h=n=d.h;
| + | |
- | if(!b.enlarge){
| + | |
- | if(g>i.w){
| + | |
- | g=m=i.w
| + | |
- | }
| + | |
- | if(h>i.h){
| + | |
- | h=n=i.h
| + | |
- | }
| + | |
- | }
| + | |
- | if(!b.reduce){
| + | |
- | if(m<i.w){
| + | |
- | m=i.w;
| + | |
- | g=Math.max(m,g)
| + | |
- | }
| + | |
- | if(n<i.h){
| + | |
- | n=i.h;
| + | |
- | h=Math.max(n,h)
| + | |
- | }
| + | |
- | }
| + | |
- | }else{
| + | |
- | m=g=d.w;
| + | |
- | n=h=0;
| + | |
- | if(!b.reduce){
| + | |
- | g=0
| + | |
- | }
| + | |
- | }
| + | |
- | i=A(i.w,i.h,{min_w:m,win_h:n,max_w:g,max_h:h,round:1});
| + | |
- | a.width=i.w;
| + | |
- | a.height=i.h;
| + | |
- | if(!a.width){
| + | |
- | a.removeAttribute("width")
| + | |
- | }
| + | |
- | if(!a.height){
| + | |
- | a.removeAttribute("height")
| + | |
- | }
| + | |
- | switch(b.align){
| + | |
- | case'left':k='0px';
| + | |
- | break;
| + | |
- | case'right':l='0px';
| + | |
- | break;
| + | |
- | default:k=-Math.round((i.w-d.w)/2)+'px'
| + | |
- | }
| + | |
- | if(b.vertAlign=='bottom'){
| + | |
- | j='0px'
| + | |
- | }else if(b.vertAlign=='middle'){
| + | |
- | e=b.position=="fixed"?d.h:x().h;
| + | |
- | f=(-b.ffHack+(e-a.offsetHeight)/2)+"px"
| + | |
- | }else{
| + | |
- | f=a.hack||'0px'
| + | |
- | }
| + | |
- | s(a,{left:k,right:l,top:f,bottom:j})
| + | |
- | }
| + | |
- | }
| + | |
- | ,show:function(){
| + | |
- | var c=q,a;
| + | |
- | a=c.img;
| + | |
- | a.fileDim={
| + | |
- | w:a.naturalWidth||a.clientWidth,h:a.naturalHeight||a.clientHeight
| + | |
- | };
| + | |
- | c.redim();
| + | |
- | if(c.fadeIt){
| + | |
- | z(c.img,1,0,c.opt.fadeOptions)
| + | |
- | }else{
| + | |
- | p(a,1)
| + | |
- | }
| + | |
- | },
| + | |
- | init:function(c,a){
| + | |
- | var b=q,d=v('body')[0],e,f,j;
| + | |
- | a=u(a,this.defaults);
| + | |
- | if(t){
| + | |
- | if(t<7){
| + | |
- | a.position='absolute'
| + | |
- | }
| + | |
- | }
| + | |
- | b.opt=a;
| + | |
- | e=a.fadeAfter;
| + | |
- | f=b.img=o.createElement('img');
| + | |
- | f.id="bgMax";
| + | |
- | s(f,{zIndex:a.zIndex,position:a.position});
| + | |
- | j=navigator.userAgent.match(/Firefox.(\d+(\.\d+))/);
| + | |
- | if(j){
| + | |
- | if(parseFloat(j[1])<3){
| + | |
- | s(d,{zIndex:0,position:'relative',top:0,left:0});
| + | |
- | f.hack='-'+a.ffHack}d.insertBefore(f,d.childNodes[0]);
| + | |
- | f.onload=b.show;
| + | |
- | if(e!==false){
| + | |
- | p(f,0);
| + | |
- | if(e){
| + | |
- | setTimeout(function(){b.fadeIt=1},e)
| + | |
- | }else{
| + | |
- | b.fadeIt=1
| + | |
- | }
| + | |
- | }
| + | |
- | }
| + | |
- | y(r,'resize',b.redim);
| + | |
- | f.src=c
| + | |
- | }
| + | |
- | };
| + | |
- | r.bgMax=q
| + | |
- | })
| + | |
- | (window,document);
| + | |
- | | + | |
- | </script type="text/javascript">
| + | |
- | | + | |
- | <script>
| + | |
- | $(document).ready(
| + | |
- | function(){
| + | |
- | $("ul.subnav").parent().find("> a").append("<span> ↓</span>");
| + | |
- | $("ul.topnav li").hover(
| + | |
- | function() {
| + | |
- | // Hover over
| + | |
- | $(this).parent().find("ul.subnav").hide();
| + | |
- | $(this).find("ul.subnav").show();
| + | |
- | // Hover out
| + | |
- | $(this).hover(
| + | |
- | function() {
| + | |
- | },
| + | |
- | function(){
| + | |
- | $(this).find("ul.subnav").hide();
| + | |
- | }
| + | |
- | );
| + | |
- | },
| + | |
- | function(){
| + | |
- | $(this).find("ul.subnav").hide();
| + | |
- | }
| + | |
- | | + | |
- | );
| + | |
- | }
| + | |
- | );
| + | |
| </script> | | </script> |
- |
| |
| </html> | | </html> |