var slider;var flow_height=500;var url_input;var loaded=false;var conf_reflection_p=0.5;var conf_focus=10;var conf_slider_width=14;var conf_images_cursor="pointer";var conf_slider_cursor="default";var conf_imageflow="imageflow";var conf_loading="loading";var conf_images="images";var conf_captions="captions";var conf_scrollbar="scrollbar";var conf_slider="slider";var caption_id=0;var new_caption_id=0;var current=0;var target=0;var mem_target=0;var timer=0;var array_images=new Array();var new_slider_pos=0;var dragging=false;var dragobject=null;var dragx=0;var posx=0;var new_posx=0;var xstep=150;function step(){switch(target<current-1||target>current+1){case true:moveTo(current+(target-current)/3);window.setTimeout(step,50);timer=1;break;default:timer=0;break}}function glideTo(A,B){target=A;mem_target=A;if(timer==0){window.setTimeout(step,50);timer=1}caption_id=B;caption=img_div.childNodes.item(array_images[caption_id]).getAttribute("alt");if(caption==""){caption="&nbsp;"}caption_div.innerHTML=caption;if(dragging==false){new_slider_pos=(scrollbar_width*(-(A*100/((max-1)*xstep)))/100)-new_posx;slider_div.style.marginLeft=(new_slider_pos-conf_slider_width)+"px"}}function moveTo(K,A){current=K;var I=max;for(var F=0;F<max;F++){var D=img_div.childNodes.item(array_images[F]);var J=F*-xstep;if((J+max_conf_focus)<mem_target||(J-max_conf_focus)>mem_target){D.style.visibility="hidden";D.style.display="none"}else{var H=Math.sqrt(190000+K*K)+100;var B=K/H*size+size;D.style.display="block";var C=(D.h/D.w*D.pc)/H*size;switch(C>max_height){case false:var G=D.pc/H*size;break;default:C=max_height;var G=D.w*C/D.h;break}var E=(images_width*0.34-C)+images_top+((C/(conf_reflection_p+1))*conf_reflection_p);D.style.left=B-(D.pc/2)/H*size+images_left+"px";if(G&&C){D.style.height=C+"px";D.style.width=G+"px";D.style.top=E+"px"}if(A){D.style.visibility="hidden"}else{D.style.visibility="visible"}switch(K<0){case true:I++;break;default:I=I-1;break}switch(D.i==caption_id){case false:D.onclick=function(){glideTo(this.x_pos,this.i)};break;default:current_vid=D.vid;I=I+1;D.onclick=imgclick;break}D.style.zIndex=I}K+=xstep}}function refresh(D){if(!loaded){load()}url_input=document.getElementById("url");imageflow_div=document.getElementById(conf_imageflow);img_div=document.getElementById(conf_images);scrollbar_div=document.getElementById(conf_scrollbar);slider_div=document.getElementById(conf_slider);caption_div=document.getElementById(conf_captions);images_width=img_div.offsetWidth;images_top=imageflow_div.offsetTop-30;images_left=imageflow_div.offsetLeft;max_conf_focus=conf_focus*xstep;size=images_width*0.5;scrollbar_width=images_width*0.6;conf_slider_width=conf_slider_width*0.5;max_height=images_width*0.51;imageflow_div.style.height=max_height+"px";img_div.style.height=images_width*0.3+"px";caption_div.style.width=images_width+"px";caption_div.style.marginTop=images_width*0.03+"px";scrollbar_div.style.marginTop=images_width*0.02+"px";scrollbar_div.style.marginLeft=images_width*0.2+"px";scrollbar_div.style.width=scrollbar_width+"px";slider_div.onmousedown=function(){dragstart(this)};slider_div.style.cursor=conf_slider_cursor;max=img_div.childNodes.length;var B=0;for(var A=0;A<max;A++){var C=img_div.childNodes.item(A);if(C.nodeType==1){array_images[B]=A;C.onclick=function(){glideTo(this.x_pos,this.i)};C.x_pos=(-B*xstep);C.i=B;if(D==true){C.w=C.width;C.h=C.height}switch((C.w+1)>(C.h/(conf_reflection_p+1))){case true:C.pc=118;break;default:C.pc=100;break}C.url=C.getAttribute("longdesc");C.ondblclick=imgclick;C.vid=C.getAttribute("vid");C.style.cursor=conf_images_cursor;B++}}max=array_images.length;moveTo(current,D);glideTo(current,caption_id);if(D){for(var A=0;A<max/2;A++){handle(-1)}}}window.onunload=function(){document=null};function show(B){var A=document.getElementById(B);A.style.visibility="visible"}function hide(B){var A=document.getElementById(B);A.style.visibility="hidden";A.style.display="none"}function toggleflow(){slider.toggle()}function showflow(){if(!slider.open){slider.toggle()}}function hideflow(){slider.hide()}function load(){if(document.getElementById(conf_imageflow)){show(conf_imageflow);hide(conf_loading);refresh(true);show(conf_images);show(conf_scrollbar);initMouseWheel();initMouseDrag();slider=new Fx.Slide(conf_imageflow,{duration:2000,wait:false,transition:Fx.Transitions.Expo.easeOut});slider.hide();$("bottomtab").addEvent("click",toggleflow);$("closebtn").addEvent("click",toggleflow);$("probarbtn").addEvent("click",imgclick)}}window.onload=function(){loaded=true;load()};window.onresize=function(){if(document.getElementById(conf_imageflow)&&slider.open){refresh()}};function handle(B){var A=false;switch(B>0){case true:if(caption_id>=1){target=target+xstep;new_caption_id=caption_id-1;A=true}break;default:if(caption_id<(max-1)){target=target-xstep;new_caption_id=caption_id+1;A=true}break}if(A==true){glideTo(target,new_caption_id)}}function wheel(A){var B=0;if(!A){A=window.event}if(A.wheelDelta){B=A.wheelDelta/120}else{if(A.detail){B=-A.detail/3}}if(B){handle(B)}if(A.preventDefault){A.preventDefault()}A.returnValue=false}function initMouseWheel(){if(window.addEventListener){imageflow_div.addEventListener("DOMMouseScroll",wheel,false)}imageflow_div.onmousewheel=wheel}function dragstart(A){dragobject=A;dragx=posx-dragobject.offsetLeft+new_slider_pos}function dragstop(A){dragobject=null;dragging=false}function drag(F){posx=document.all?window.event.clientX:F.pageX;if(dragobject!=null){dragging=true;new_posx=(posx-dragx)+conf_slider_width;if(new_posx<(-new_slider_pos)){new_posx=-new_slider_pos}if(new_posx>(scrollbar_width-new_slider_pos)){new_posx=scrollbar_width-new_slider_pos}var B=(new_posx+new_slider_pos);var E=B/((scrollbar_width)/(max-1));var D=Math.round(E);var A=(D)*-xstep;var C=D;dragobject.style.left=new_posx+"px";glideTo(A,C)}}function initMouseDrag(){document.onmousemove=drag;document.onmouseup=dragstop;document.onselectstart=function(){if(dragging==true){return false}else{return true}}}function getKeyCode(A){A=A||window.event;return A.keyCode}document.onkeydown=function(B){var A=getKeyCode(B);var B=new Event(B);switch(A){case 39:handle(-1);B.stop();break;case 37:handle(1);B.stop();break;case 38:case 40:B.stop();break}};function imgclick(){document.location="demo2.php?url="+url_input.value+"&videoid="+current_vid}
