/**
* SRAX Carousel v0.8 (build 7), 
* http://www.fullajax.ru
* Created by Ruslan Sinistkiy, 2008.
* Use is subject to license terms.
*/
if(!window.SRAX){SRAX={addEvent:function(C,A,B){if(C.attachEvent){C.attachEvent("on"+A,B)}else{C.addEventListener(A,B,false)}},delEvent:function(C,A,B){if(C.detachEvent){C.detachEvent("on"+A,B)}else{C.removeEventListener(A,B,false)}},get:function(A){return typeof A=="string"?document.getElementById(A):A}}}(function(A){if(!A.Carousel){A.Carousel=function(P){var L=P.img_dir||"",K=P.img_ext||"",U=P.img_width||100,Z=P.img_height||100,z=P.highlight||false,e=P.highlight_border_width||2,t=P.title_visible||false,H=P.title_color||["green","blue"],M=P.buttons_visible||false,y=P.always_scroll||false,k=P.speed==null?3:P.speed,T=P.mouse_accelerate||false,E=P.table_container||false;var x=SRAX.get(P.el),b=SRAX.get(P.container);function Q(){if(x){b.style.display="none";var h=(E?x.parentNode:x).clientWidth;b.style.width=h+"px";b.style.display="block"}}if(!b){if(x){b=x.appendChild(document.createElement("div"))}else{var c="id"+Math.ceil(Math.random()*100);document.write('<div id="'+c+'"></div>');b=A.get(c)}}P.container=b;b.className="carousel";var V=['<div class="container">'];if(M){V.push('<a class="cprev" href="#"></a>','<a class="cnext" href="#"></a>')}V.push('<div class="cbody'+(M?" btns_enable":"")+'"></div></div>');b.innerHTML=V.join("");var q,m,AB,r=b.getElementsByTagName("div")[1];function S(){Q();var AF=Math.ceil(b.offsetWidth/U)+4;if(AF%2!=0){AF++}V=['<table cellpadding="0" cellspacing="0"><tbody><tr>'];var AL=P.images;var w=AL.length;while(AL.length<AF){for(var AJ=0;AJ<w;AJ++){AL.push(AL[AJ])}}var AH=0,AG,AK;var AI="border-width:"+e+"px";var AN="width:"+U+"px;height:"+Z+"px";for(var AJ=0;AJ<AL.length;AJ++){var AE=AL[AJ];var h=L+AE.src+K;if(t){AG=H.join?H[AJ%2==AH%2?0:1]:H;AK="background:"+AG}var s=AE.href||AE.link||"#";var AM=(AE.title||AE.href||AE.link||"").split('"').join("&quot;");V.push('<td><a href="'+s+'" title="'+AM+'">','<div class="item"><img src="'+h+'" style="'+AN+'" alt="'+AM+'"/></div>',t?'<div class="title" style="'+AK+'"><span>'+AE.title+"</span></div>":"",(z?'<b style="'+AI+'" class="highlight"></b>':""),"</a></td>")}V.push("</tr></tbody></table>");r.innerHTML=V.join("");r.scrollLeft=2*U;q=r.scrollWidth-r.clientWidth;AB=b.getElementsByTagName("tr")[0];if(m){m.cancel()}m=new o(r,{duration:1,delta:10*k});if(y){m.start()}}if(z){var a=b.getElementsByTagName("b");var J=a[0].parentNode;var f=J.offsetWidth-2*e,v=J.offsetHeight-2*e;for(var u=0,p=a.length;u<p;u++){var j=a[u].style;j.width=f+"px";j.height=v+"px"}}var I=1,AD,R=0,g=0,B=0;function W(){if(!R&&!g){AD=setTimeout(function(){m.cancel(y?m.start:null)},10)}}function AA(i){var h=0,l=0;while(i=i.offsetParent){h+=i.offsetLeft;l+=i.offsetTop}return{x:h,y:l}}function O(h){return{x:h.pageX==null?h.clientX+document.body.scrollLeft:h.pageX,y:h.pageY==null?h.clientY+document.body.scrollTop:h.pageY}}var N=function(l){if(!l){l=window.event}var h=l.target?l.target:l.srcElement;if(!h||!h.className){return }var i=h.className;if(i.indexOf("cprev")>-1||i.indexOf("cnext")>-1){m.setSpeed(2.5);R=1;l.cancelBubble=true;if(l.stopPropagation){l.stopPropagation()}}};var d=function(h){if(R){m.setSpeed(1);R=0;W()}};var n=/webkit/.test(navigator.userAgent.toLowerCase());var Y=function(w){if(!w){w={}}var AF=new Date().getTime(),s=(w.duration?w.duration:1)*1000,l=w.timeout?w.timeout:(n?25:0);if(!w.fn){w.fn=[function(){}]}else{if(!(w.fn instanceof Array)){w.fn=[w.fn]}}var h=0,i=0;function AE(){var AH=(new Date().getTime()-AF)/s;if(AH>1){AH=1}for(var AG=0;AG<w.fn.length;AG++){w.fn[AG]({percent:AH,ops:w})}if(AH==1||h){if(w.callback){w.callback(w,i)}}else{setTimeout(AE,l)}}this.stop=function(AG){i=AG;h=1};this.isStoped=function(){return h};AE()};var o=function(w,s){if(!s){s={}}if(typeof w=="string"){w=SRAX.get(w)}if(!s.fn){s.fn=[]}var l=w.scrollLeft,AK=s.delta==null?100:s.delta,AJ=true,AF=-1,AI=-1,AH=w.scrollLeft,AE=1,AL;s.fn.push(function(AM){if(!AM.percent){return }var AN=AH+AK*AM.percent*AE*s.direction;if(!g){if(AF>-1&&AN>=AF){AN=AF}else{if(AI>-1&&AN<=AI){AN=AI}}}if(AN<0){AN=0}else{if(AN>q){AN=q}}if(AN<2*U){AB.insertBefore(AB.lastChild,AB.firstChild);AN+=U;AH+=U}else{if(AN>q-2*U){AN-=U;AH-=U;AB.appendChild(AB.firstChild)}}w.scrollLeft=AN;if(AJ||(AF>-1&&AN>=AF)||(AI>-1&&AN<=AI)){AJ=true;AG.stop(1);if(AL){AL()}AL=null;return }});s.callback=function(AN,AM){AH=w.scrollLeft;i();if(!AM){AG=new Y(AN)}};var i=function(){};function h(AN,AM){AJ=AM;i=function(){AE=AN};if(AG.isStoped()){AH=w.scrollLeft;i();s.direction=I;AG.stop(1);AG=new Y(s)}else{AG.stop()}}var AG={stop:function(){},isStoped:function(){return true}};this.start=function(AM){AL=null;if(!AJ&&AF==-1&&AI==-1){return }AF=-1;AI=-1;h(AM==null?1:AM,false)};this.cancel=function(AM){AL=AM;AJ=true};this.isStoped=function(){return AJ};this.setSpeed=function(AM){if(AE==AM){return }h(AM,AJ)}};this.pause=function(){B=1;m.cancel()};this.resume=function(){B=0;if(y){m.start()}};this.destroy=function(){m.cancel();A.delEvent(window,"resize",S);A.delEvent(b,"mousedown",N);A.delEvent(b,"mouseup",d);if(T){A.delEvent(document,"mousemove",G);A.delEvent(document,"mouseout",G)}b.parentNode.removeChild(b)};A.addEvent(window,"resize",S);S();A.addEvent(b,"mousedown",N);A.addEvent(b,"mouseup",d);if(M){var F=b.getElementsByTagName("a");var X=F[0],D=F[1];X.onmouseover=D.onmouseover=function(i){if(B){return }clearTimeout(AD);var h=this.className.indexOf("prev")>-1?-1:1;if(h==I&&!m.isStoped()){return false}I=h;g=1;m.cancel(m.start);return false};X.onmouseout=D.onmouseout=function(){g=0;W()};X.onmousedown=D.onmousedown=X.onselectstart=D.onselectstart=X.onclick=D.onclick=function(){return false}}if(T){var AC;var G=function(i){if(B){return }if(!i){i=window.event}var h=O(i);clearTimeout(AC);AC=setTimeout(function(){C(h)},10)};var C=function(s){var AE=AA(r),AH=s.x-AE.x,AF=s.y-AE.y,i=r.offsetWidth,AI=r.offsetHeight,h=i/5,AG=I,l=1;var w=0;if(AH>0&&AH<i&&AF>0&&AF<AI){l=0;if(AH<h||AH>4*h){AG=AH<h?-1:1;l=3.5}else{if(AH<2*h||AH>3*h){AG=AH<2*h?-1:1;l=2}}}else{w=1}if(!y&&w){m.cancel()}else{if(AG!=I){I=AG;m.cancel(function(){m.start(l)})}else{m.setSpeed(l);if(m.isStoped()){m.start()}}}};A.addEvent(document,"mousemove",G);A.addEvent(document,"mouseout",G)}}}})(SRAX);