var $$=function(id){return typeof id=='string'?document.getElementById(id):id;}
var getElementsByClassName=function(className,tagName,element){tagName=tagName||'*';var node=element&&document.getElementById(element)||document;var elements=node.getElementsByTagName(tagName);var returnElements=[];className=className.replace(/\-/g,'\\-');var regExp=new RegExp('(^|\\s)'+className+'(\\s|$)');var element;for(var i=0,j=elements.length;i<j;i++){element=elements[i];if(regExp.test(element.className)){returnElements[returnElements.length]=element;}}return returnElements;};var getTagName=function(tagName,element){tagName=tagName||'*';var node=element&&document.getElementById(element)||document;var elements=node.getElementsByTagName(tagName);return elements;}
var extend=function(destination,source){for(var property in source){destination[property]=source[property];}return destination;};var each=function(objects,handler){if(objects)for(var i=0,leng=objects.length;i<leng;i++)handler.call(objects[i],i,objects);};var bind=function(object,handler){var args=Array.prototype.slice.call(arguments).slice(2);return function(){return handler.apply(object,args.concat(Array.prototype.slice.call(arguments)));}};var camel=function(string){return string.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});};var addClassName=function(element,name){if(element&&!new RegExp("(^|\\s)"+name+"(\\s|$)").test(element.className)){if(element.className)element.className+=' '+name;else element.className=name;};return element.className;};var removeClassName=function(element,name){var rep=element.className.match(' '+name)?' '+name:name;element.className=element.className.replace(rep,'');return element.className;};var addEvent=function(element,type,handler){if(element.addEventListener){element.addEventListener(type,handler,false);}else if(element.attachEvent){element.attachEvent("on"+type,handler);}else{element['on'+type]=handler;}};var removeEvent=function(element,type,handler){if(element.removeEventListener){element.removeEventListener(type,handler,false);}else if(element.detachEvent){element.detachEvent("on"+type,handler);}else{element["on"+type]=null;}};var getEvent=function(event){return event?event:window.event;};var getTarget=function(event){event=event?event:window.event;return event.target||event.srcElement;};var getStyle=function(element,styleName){return element.currentStyle?element.currentStyle[camel(styleName)]:document.defaultView.getComputedStyle(element,null)[camel(styleName)];};var browser=(function(ua){var b={msie:/msie/.test(ua)&&!/opera/.test(ua),opera:/opera/.test(ua),safari:/webkit/.test(ua)&&!/chrome/.test(ua),firefox:/firefox/.test(ua),chrome:/chrome/.test(ua)};var vMark="";for(var i in b){if(b[i]){vMark="safari"==i?"version":i;break;}}b.version=vMark&&RegExp("(?:"+vMark+")[\\/: ]([\\d.]+)").test(ua)?RegExp.$1:"0";b.ie=b.msie;b.ie6=b.msie&&parseInt(b.version,10)==6;b.ie7=b.msie&&parseInt(b.version,10)==7;b.ie8=b.msie&&parseInt(b.version,10)==8;return b;})(window.navigator.userAgent.toLowerCase());var trim=function(string){return string.replace(/(^\s*)/g,'').replace(/(\s*$)/g,'');};var lTrim=function(string){return string.replace(/(^\s*)/g,'');};var rTrim=function(string){return string.replace(/(\s*$)/g,'');};var index=function(current,objects){for(var i=0,j=objects.length;i<j;i++){if(objects[i]==current){return i;}}};var Tween={Linear:function(t,b,c,d){return c*t/d+b;},Quad:{easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;}},Cubic:{easeIn:function(t,b,c,d){return c*(t/=d)*t*t+b;},easeOut:function(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;}},Quart:{easeIn:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOut:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;}},Quint:{easeIn:function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOut:function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;}},Sine:{easeIn:function(t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOut:function(t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOut:function(t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;}},Expo:{easeIn:function(t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOut:function(t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOut:function(t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;}},Circ:{easeIn:function(t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOut:function(t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOut:function(t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;}},Elastic:{easeIn:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOut:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return(a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b);},easeInOut:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;}},Back:{easeIn:function(t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOut:function(t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOut:function(t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;}},Bounce:{easeIn:function(t,b,c,d){return c-Tween.Bounce.easeOut(d-t,0,c,d)+b;},easeOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOut:function(t,b,c,d){if(t<d/2)return Tween.Bounce.easeIn(t*2,0,c,d)*.5+b;else return Tween.Bounce.easeOut(t*2-d,0,c,d)*.5+c*.5+b;}}};var LazyLoad=function(options){this.setOptions(options);this.Images=this.options.Images;this.LoadGif=this.options.LoadGif;this.Attribute=this.options.Attribute;this.Delay=this.options.Delay;this.Threshold=this.options.Threshold;this._timer=null;this._index=0;this._count=0;this.init();};LazyLoad.prototype={setOptions:function(options){this.options={Images:undefined,LoadGif:'images/loading.gif',Attribute:'lazysrc',Delay:100,Threshold:200};extend(this.options,options||{});},getElementPos:function(element){if(element.parentNode===null||getStyle(element,'display')=='none'){return false;}
var parent=null;var pos=[];var box;if(element.getBoundingClientRect){box=element.getBoundingClientRect();var scrollTop=Math.max(document.documentElement.scrollTop,document.body.scrollTop);var scrollLeft=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft);return{x:box.left+scrollLeft,y:box.top+scrollTop};}else if(document.getBoxObjectFor){box=document.getBoxObjectFor(element);var borderLeft=getStyle(element,'borderLeftWidth')?parseInt(getStyle(element,'borderLeftWidth')):0;var borderTop=getStyle(element,'borderTopWidth')?parseInt(getStyle(element,'borderTopWidth')):0;pos=[box.x-borderLeft,box.y-borderTop];}else{pos=[element.offsetLeft,element.offsetTop];parent=element.offsetParent;if(parent!=element){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}}
if(browser.opera||(browser.safari&&getStyle(element,'position')=='absolute')){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}
if(element.parentNode){parent=element.parentNode;}
else{parent=null;}
while(parent&&parent.tagName!='BODY'&&parent.tagName!='HTML'){pos[0]-=parent.scrollLeft;pos[1]-=parent.scrollTop;if(parent.parentNode){parent=element.parentNode;}else{parent=null;}}
return{x:pos[0],y:pos[1]};},init:function(){this.Images=this.Images||document.getElementsByTagName('img');this.Images=this.filter(this.Images,this.Attribute);this._count=this.Images.length;this._Container=document.compatMode=='CSS1Compat'?document.documentElement:document.body;this._load=bind(this,this.load);addEvent(window,'scroll',this._load);addEvent(window,'resize',this._load);this.load();},filter:function(imgs,attr){var This=this,imgsFilter=[];each(imgs,function(i){if(this.hasAttribute){if(this.hasAttribute(attr)){imgsFilter[imgsFilter.length]=this;}}else{if(attr in this){imgsFilter[imgsFilter.length]=this;}}});return imgsFilter;},load:function(){var This=this;if(this._index==this._count)this.dispose();if(this._timer)clearTimeout(this._timer);this._range={top:this._Container.scrollTop,bottom:parseInt(this._Container.scrollTop+this._Container.clientHeight),left:this._Container.scrollLeft,right:parseInt(this._Container.scrollLeft+this._Container.clientWidth)};if(browser.chrome||browser.safari){this._range.bottom=parseInt(this._Container.scrollTop+document.body.scrollTop+this._Container.clientHeight);this._range.right=parseInt(this._Container.scrollLeft+document.body.scrollLeft+this._Container.clientWidth);}
each(this.Images,function(){if(parseInt(This.getElementPos(this).y-This.Threshold)<=This._range.bottom&&parseInt(This.getElementPos(this).x+this.offsetWidth+This.Threshold)>=This._range.left){This.show(this);}});},show:function(img){var This=this;this._timer=setTimeout(function(){if(parseInt(This.getElementPos(img).y+img.offsetHeight+This.Threshold)>=This._range.top&&parseInt(This.getElementPos(img).x-This.Threshold)<=This._range.right){if(img.getAttribute(This.Attribute)){img.style.background='url('+This.LoadGif+') no-repeat scroll center center transparent';img.setAttribute('src',img.getAttribute(This.Attribute));img.onreadystatechange=function(){if(img.readyState=='complete'||img.readyState=='loaded'){img.removeAttribute('style');}}
img.onload=function(){img.removeAttribute('style');}
img.removeAttribute(This.Attribute);This._index++;}}},this.Delay);},dispose:function(){var This=this;each(this.Images,function(){This.show(this);});removeEvent(window,'scroll',this._load);removeEvent(window,'resize',this._load);this.Images=null;}};var SlideTrans=function(container,slider,count,options){this._container=$$(container);this._slider=$$(slider);this._count=Math.abs(count);this._timer=null;this._target=0;this._t=this._b=this._c=0;this.Index=0;this.setOptions(options);this.Auto=this.options.Auto;this.Direction=!!this.options.Direction?'left':'top';this.Duration=this.options.Duration;this.Pause=this.options.Pause;this.Time=this.options.Time;this.Tween=this.options.Tween;this.OnStart=this.options.OnStart;this.OnFinish=this.options.OnFinish;this._change=this._container[this.options.Direction?'offsetWidth':'offsetHeight'];};SlideTrans.prototype={setOptions:function(options){this.options={Auto:true,Direction:true,Duration:100,Pause:2000,Time:10,Tween:Tween.Quart.easeOut,OnStart:function(){},OnFinish:function(){}};extend(this.options,options||{});},run:function(index){index==undefined&&(index=this.Index);index<0&&(index=this._count-1)||index>=this._count&&(index=0)
this._target=-Math.abs(this._change)*(this.Index=index);this._t=0;this._b=parseInt(getStyle(this._slider,this.options.Direction?'left':'top'));this._c=this._target-this._b;this.OnStart();this.move();this.OnFinish();},move:function(){clearTimeout(this._timer);if(this._c&&this._t<this.Duration){this.moveTo(Math.round(this.Tween(this._t++,this._b,this._c,this.Duration)));this._timer=setTimeout(bind(this,this.move),this.Time);}else{this.moveTo(this._target);this.Auto&&(this._timer=setTimeout(bind(this,this.next),this.Pause));}},moveTo:function(i){this._slider.style[this.Direction]=i+'px';},next:function(){this.run(++this.Index);},previous:function(){this.run(--this.Index);},stop:function(){clearTimeout(this._timer);this.moveTo(this._target);}};var TabTrans=function(tab,options){this._tab=tab;this._timer=null;this.Index=0;this.setOptions(options);this.CurrentClass=this.options.CurrentClass;this.Trigger=this.options.Trigger;this.Auto=this.options.Auto;this.Pause=this.options.Pause;this.TabMenus=getElementsByClassName(this.options.TabMenus,'*',this._tab);this.TabContents=getElementsByClassName(this.options.TabContents,'*',this._tab);this.OnStart=this.options.OnStart;this.OnFinish=this.options.OnFinish;this.init();};TabTrans.prototype={setOptions:function(options){this.options={CurrentClass:null,Trigger:'click',Auto:false,Pause:3000,TabMenus:'f-tab-menu',TabContents:'f-tab-content',OnStart:function(){},OnFinish:function(){}};extend(this.options,options||{});},init:function(index){for(var i=0,j=this.TabMenus.length;i<j;i++){(function(i,This){addEvent(This.TabMenus[i],This.Trigger,function(){This.Index=i;This.show(This.Index);});})(i,this)}
this.run();},run:function(){this.Auto&&(setInterval(bind(this,this.auto),this.Pause));},show:function(index){this.OnStart();var This=this;setTimeout(function(){if(This.CurrentClass){for(var i=0,j=This.TabMenus.length;i<j;i++){removeClassName(This.TabMenus[i],This.CurrentClass);}
addClassName(This.TabMenus[index],This.CurrentClass);}
for(var i=0,j=This.TabContents.length;i<j;i++){This.TabContents[i].style.display='none';}
This.TabContents[index].style.display='block';This.OnFinish();},200);},auto:function(){this.Index++;if(this.Index>=this.TabMenus.length||this.Index>=this.TabContents.length){this.Index=0;}
this.show(this.Index);}};
