window.onload=init;function init(){EFFECTS.init();setRoleAttr();SLIDER.init();CHANGER.init()}function myPreload(img_src){var d=document;if(d.images){if(!d.p){d.p=new Array()}var key=d.p.length;d.p[key]=new Image;d.p[key].src=img_src}}function preloadImages(){var a=preloadImages.arguments;for(i=0;i<a.length;i++){if(a[i].indexOf("#")!=0){myPreload(a[i])}}}function w$(id){return document.getElementById(id)}function setRoleAttr(){if(w$('header')){w$('header').setAttribute('role','banner')}if(w$('navi')){w$('navi').setAttribute('role','navigation')}if(w$('col1')){w$('col1').setAttribute('role','complementary')}if(w$('col2')){w$('col2').setAttribute('role','complementary')}if(w$('col3')){w$('col3').setAttribute('role','main')}if(w$('footer')){w$('footer').setAttribute('role','contentinfo')}}function c$(c){var tag="*";if(arguments[1]!=""){tag=arguments[1]}var els=document.getElementsByTagName(tag);var pattern=new RegExp('(^|\\s)'+c+'(\\s|$)');var returnEls=[];for(var i in els){if(pattern.test(els[i].className)){returnEls.push(els[i])}}return returnEls}var EFFECTS={init:function(){EFFECTS.initOnOver();if(w$('pic')){EFFECTS.initOnClick();EFFECTS.initArrows();EFFECTS.pic_src=w$('pic').src}},initOnOver:function(){var data=c$('onOver','img');for(var x=0;x<data.length;x++){var orig_src=data[x].src;var over_src=orig_src.replace(/.jpg/,"_hover.jpg");over_src=over_src.replace(/.gif/,"_hover.gif");over_src=over_src.replace(/.png/,"_hover.png");data[x].onmouseover=new Function("this.src ='"+over_src+"'");data[x].onmouseout=new Function("this.src ='"+orig_src+"'");myPreload(over_src)}},pic_nr:1,initOnClick:function(){var data=c$('onClick','img');for(var x=0;x<data.length;x++){var new_src=w$('pic').src.replace(/01/,"0"+(x+1));data[x].onclick=new Function("w$('pic').src='"+new_src+"'; EFFECTS.setCurrentImg("+x+"); EFFECTS.pic_nr="+(x+1));myPreload(new_src)}if(data.length>0){EFFECTS.setCurrentImg(0)}},setCurrentImg:function(x){var data=c$('onClick','img');for(y=0;y<data.length;y++){data[y].className=data[y].className.replace("onCurrent","")}data[x].className+=" onCurrent"},initArrows:function(){if(w$('arrowMinus')){w$('arrowMinus').onclick=new Function("EFFECTS.minusArrow();")}if(w$('arrowPlus')){w$('arrowPlus').onclick=new Function("EFFECTS.plusArrow();")}},minusArrow:function(){var pic_count=c$('onClick','img').length;var minus=EFFECTS.pic_nr-1;if(minus==0){minus=pic_count}var new_src=EFFECTS.pic_src.replace(/01/,"0"+minus);w$('pic').src=new_src;EFFECTS.pic_nr=minus;EFFECTS.setCurrentImg((minus-1))},plusArrow:function(){var pic_count=c$('onClick','img').length;var plus=EFFECTS.pic_nr+1;if(plus==(pic_count+1)){plus=1}var new_src=EFFECTS.pic_src.replace(/01/,"0"+plus);w$('pic').src=new_src;EFFECTS.pic_nr=plus;EFFECTS.setCurrentImg((plus-1));}};var SLIDER={init:function(){var data=c$('toSlide','*');for(var x in data){if(data[x].parentNode&&data[x].style){if(data[x].style.display=='none'){data[x].parentNode.style.height='1px';data[x].slideDown=true;data[x].style.display='block';data[x].scheduleHeight=data[x].offsetHeight;data[x].style.display=='none';data[x].style.marginTop='1px'}else{data[x].scheduleHeight=data[x].offsetHeight;data[x].style.marginTop='1px'}data[x].parentNode.style.overflow='hidden'}}},slide:function(id){var data=c$('toSlide','*');SLIDER.stepLength=25;timeOt=50;SLIDER.element=w$(id);if(arguments[1]==true){for(var x in data){if(data[x].id!=id&&data[x].slideDown!=true){SLIDER.toSwitch((data[x].id))}}}SLIDER.toSwitch(id)},toSwitch:function(id){SLIDER.element=w$(id);if(SLIDER.element.slideDown){if(parseInt(SLIDER.element.scheduleHeight)-parseInt(SLIDER.element.parentNode.style.height)<=SLIDER.stepLength){SLIDER.stepLength=parseInt(SLIDER.element.scheduleHeight)-parseInt(SLIDER.element.parentNode.style.height)}SLIDER.element.parentNode.style.height=parseInt(SLIDER.element.parentNode.offsetHeight)+SLIDER.stepLength+"px";if(parseInt(SLIDER.element.parentNode.style.height)>=parseInt(SLIDER.element.scheduleHeight)){return SLIDER.element.slideDown=false}setTimeout("SLIDER.toSwitch('"+id+"')",timeOt)}else{if(parseInt(SLIDER.element.parentNode.style.height)<=SLIDER.stepLength){SLIDER.stepLength=parseInt(SLIDER.element.parentNode.style.height)-1}SLIDER.element.parentNode.style.height=parseInt(SLIDER.element.parentNode.offsetHeight)-SLIDER.stepLength+"px";if(parseInt(SLIDER.element.parentNode.style.height)<=2){return SLIDER.element.slideDown=true}setTimeout("SLIDER.toSwitch('"+id+"')",timeOt)}}};var url="includes/newsbox_klicks.php?param=";function handleHttpResponse(){if(http.readyState==4){results=http.responseText.split(",");alert(results[0])}}function cntNc(id){http.open("GET",url+id,true);http.send(null)}function getHTTPObject(){var xmlhttp;/*@cc_on@if(@_jscript_version>=5)try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(E){xmlhttp=false}}@else xmlhttp=false;@end@*/if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest()}catch(e){xmlhttp=false}}return xmlhttp}var http=getHTTPObject();


var SC={e:null,f:null,c:null,srcs:'',thumbs:'',curr_pic:1,speed:2500,timeout:2000,timeout_first:null,timeout_second:null,stop_by_click:false,Init:function(changer,pic,sources,thumbs,prev,next,speed,timeout,stopByClick){if($(changer)&&$(pic)&&sources.length>1){SC.e=$(pic);SC.srcs=sources;SC.thumbs=$(thumbs);SC.c=$(changer);if(speed>0)SC.speed=speed;if(timeout>0)SC.timeout=timeout;if(stopByClick==true){SC.stop_by_click=true}SC.f=SC.e.clone();for(var x=2;x<SC.srcs.length;x++){SC.Preload(SC.srcs[x])}if($(prev)){$(prev).click(function(){SC.GoPrev();return false})}if($(next)){$(next).click(function(){SC.GoNext();return false})}SC.InitThumbs();SC.StartChange()}},StartChange:function(){if(SC.e[0]&&SC.e[0].complete==true){SC.c.css({width:SC.e.width(),height:SC.e.height()});SC.e.css({position:'absolute',zIndex:5});SC.f.css({position:'absolute',zIndex:0});SC.c.append(SC.f);SC.f.attr('src',SC.srcs[SC.curr_pic]+'?'+(new Date()).getSeconds());SC.timeout_first=setTimeout("SC.ChangeFirst()",SC.timeout)}else{setTimeout("SC.StartChange()",200)}},ChangeFirst:function(){SC.e.fadeOut(SC.speed,function(){SC.e.css({display:'inline',zIndex:0});SC.f.css({zIndex:5});SC.c.append(SC.f);SC.e.attr('src',SC.srcs[SC.GetCurrentPic()]);SC.timeout_first=setTimeout("SC.ChangeSecond()",SC.timeout)});SC.SetCurrentClass(SC.curr_pic)},ChangeSecond:function(){SC.f.fadeOut(SC.speed,function(){SC.f.css({display:'inline',zIndex:0});SC.e.css({zIndex:5});SC.c.append(SC.e);SC.f.attr('src',SC.srcs[SC.GetCurrentPic()]);SC.timeout_second=setTimeout("SC.ChangeFirst()",SC.timeout)});SC.SetCurrentClass(SC.curr_pic)},GetCurrentPic:function(){SC.curr_pic++;if(SC.curr_pic==SC.srcs.length){SC.curr_pic=0}return SC.curr_pic},GoNext:function(){var current=SC.GetCurrentPicIndex();var to_set=current+1;if(to_set==SC.srcs.length){to_set=0}SC.SetPic(to_set)},GoPrev:function(){var current=SC.GetCurrentPicIndex();if(current==0){current=SC.srcs.length}SC.SetPic(current-1)},GetCurrentPicIndex:function(){var z=SC.e.css('z-index');var o=SC.e.css('opacity');if(z>0&&o>0.51){var src=SC.e.attr('src')}else{var src=SC.f.attr('src')}for(var x=0;x<SC.srcs.length;x++){if(SC.srcs[x]==src){return x}}},SetPic:function(x){SC.e.attr('src',SC.srcs[x]);SC.f.attr('src',SC.srcs[x]);SC.SetCurrentClass(x);SC.curr_pic=x;SC.StopChange()},SetCurrentClass:function(index){SC.thumbs.each(function(i){$(this).removeClass('current')});SC.thumbs.eq(index).addClass('current')},InitThumbs:function(){SC.thumbs.each(function(i){$(this).click(function(){SC.SetPic(i);return false})});SC.SetCurrentClass(0)},Preload:function(img_src){var d=document;if(d.images){if(!d.p){d.p=new Array()}var key=d.p.length;d.p[key]=new Image;d.p[key].src=img_src}},StopChange:function(){if(SC.stop_by_click){clearTimeout(SC.timeout_first);clearTimeout(SC.timeout_second)}}}

$(document).ready(function() {
    //Params: changer_wrap, changer img, array of sources, thumbs to click on, prev-button, next-button, speed in millis(if other than default), timeout in millis(if other than default, stop change by click on thumbs or prev/next button)
    SC.Init('#sc_changer','#sc_pic',sc_srcs,'#sc_thumbs .click','','',0,0, false);
});

