
var position=0;var style=0;var anz=0;var maxClick=0;var scroller=document.viewport.getScrollOffsets()[1];function adjustElement(width){if(!$('gallery'))return false;if(!width){width=713;}
scroller=document.viewport.getScrollOffsets()[1];var window_width=document.viewport.getWidth();var margin_left=(window_width-width)*.5;var window_height=window.innerHeight;if(!window.innerHeight){window_height=document.documentElement.clientHeight;}
var margin_top=(window_height-650)*.5;if(margin_top<10){margin_top=10;}
$('gallery').style.marginLeft=margin_left+"px";$('gallery').style.marginTop=scroller+margin_top+"px";}
function openForm(){if(!$('gallery')){return false;}
adjustElement(590);$('gallery').setStyle({'height':'590px'})
$('gallery').show();$('overlay').show();$('smashingform').reset();$('textframe').hide();$('formcontent').show();$('submitbutton').show();$('successcontent').hide();}
function makeGallery(id,thumbs){if(!$('gallery')){return false;}
adjustElement();position=0;anz=0;style=0;var str="";$$("object").each(function(elem){elem.setStyle("visibility:hidden;");});$$("EMBED").each(function(elem){elem.setStyle("visibility:hidden;");});if(thumbs==false){$('images_mask').hide();$('gallery').setStyle({'height':'500px','overflow':'hidden'});}
for(var i=0;i<gallery[id].length;i++){imgclass='';if(i==0){imgclass='active';}
str+='<img src="'+gallery[id][i]["imgSmall"]+'" class="'+imgclass+'" alt="pic" onclick="showBigImg('+id+','+i+', this)" />';anz++;}
maxClick=Math.ceil(anz/9);showBigImg(id,0);$('images_sm').setStyle("left:0px;");$('images_sm').innerHTML="";$('images_sm').insert(str);$('gallery').show();$('overlay').show();}
function showBigImg(id,i,thumbelem){$$('#images_sm img').each(function(elem){elem.removeClassName('active');});if(typeof(thumbelem)!='undefined'){thumbelem.addClassName('active');}
var str='<img src="'+gallery[id][i]["imgBig"]+'" alt="pic" />';$('img_holder').innerHTML="";$('img_holder').insert(str);$('desc').innerHTML="";$('desc').insert(gallery[id][i]["imgDesc"]);}
function nextImg(){if(position<maxClick-1){position++;style=(position*666);}
$('images_sm').setStyle("left:-"+style+"px;");}
function prevImg(){if(position<maxClick&&position>0){position--;style=(position*666);}
$('images_sm').setStyle("left:-"+style+"px;");}
function closeGallery(){$('gallery').hide();$('overlay').hide();$$("object").each(function(elem){elem.setStyle("visibility:visible;");});$$("EMBED").each(function(elem){elem.setStyle("visibility:visible;");});}
var position=0;var countImg=0;if($$('#slider li')){var countImg=$$('#slider li').length;var limit=countImg-1;}
function slideNext(width,slider){if(slider=='splashnews'){limit=countImg-3;}
if(!$('slider')){return false;}
if(position<limit){position++;style=-(position*width);}else{position=0;style=0;}
new Effect.Move('slider',{x:style,y:0,mode:'absolute',duration:0.4});}
function slidePrev(width){if(!$('slider')){return false;}
if(position<countImg&&position>0){position--;style=(position*width);}
new Effect.Move('slider',{x:-style,y:0,mode:'absolute',duration:0.4});}
Event.observe(window,"resize",adjustElement);
