//JS file
var showedCycles = 0;
var currentImageIndex = 0;
var lengthOfImages = 0;
var isStopped = true;
var isWaitForSetDefault = false;
var isBlocked = false;
var leftPos = 0;
var hoverContainer = "";


function showImage(){
     $("div#"+sliderContainer).css({"z-index":frontIndex-1});
     currentImageIndex++;
     if(currentImageIndex >= lengthOfImages){ currentImageIndex =0;}
     var prevImg = sliderContainer;
     sliderContainer = arrSlides[currentImageIndex];
     $("div#"+sliderContainer).css({"opacity":"0","display":"block","z-index":frontIndex});     $("div#"+sliderContainer).animate({"opacity":"1"},duration,function(){			$("div#"+prevImg).css({"display":"none"});
			setTimeout("showImage()",showedTime*1000);
     });}

$(document).ready(function(){    if ($.browser.opera) {
    	$.support.opacity = true;
	}

    $("div.hl").hide();


    var w = $("div.header_img_block").width();
    $("div.header_img_block").css({"position":"relative","overflow":"hidden"});
    $("div.slider_block").css({"top":"0px","left":"0px","width":w+"px"});

    leftPos = $("div.header_img_block").width()+20;
	$("div.corner_block").css({"position":"absolute","top":"0px","left":leftPos+"px","width":w+"px","display":"block","z-index":frontIndex+100});
 	if(arrSlides){
 		lengthOfImages = arrSlides.length;  		if(sliderContainer=="") sliderContainer = arrSlides[0];
        $("div#"+sliderContainer).css({"display":"block","z-index":frontIndex});

        var checkLoaded = setInterval(function(){
        	var isLoaded = false;
			var toLoadObjs = $("img.slider_img");
			if(toLoadObjs.length <=0) clearInterval(checkLoaded);
			for (var i = 0; i < toLoadObjs.length; i++)
									isLoaded = toLoadObjs[i].complete;
			if(isLoaded == true){					clearInterval(checkLoaded);
					setTimeout("showImage()",showedTime*1000);
			}        },1000);

        ///if(animateCycles>=0){setTimeout("showImage()",showedTime*1000);} 	}

 	 if(arrImages){
 	 $("div.header_links_anch_cont").hover(
        		function(){
        			if(isStopped==true){
        			 isStopped = false;
        			 var key = $(this).attr("id");
        			 hoverContainer = arrImages[key][0];
        			 //if(isWaitForSetDefault == false){$("div#"+arrImages[key][1]).show();}
        			 $("div#"+hoverContainer).animate({"left": "0"},durationOn,function(){
        			    isStopped = true;
     				 });
     				}
        		}
        	   ,function(){
                    if(isWaitForSetDefault==false){
                    isStopped = false;
                    isWaitForSetDefault = true;
                    $("div#"+hoverContainer).stop();
        			  var key = $(this).attr("id");
                      hoverContainer =arrImages[key][0];
        	   		  $("div#"+hoverContainer).animate({"left": leftPos},durationOff,function(){
                      //$("div.hl").hide();
                      isStopped = true;  isWaitForSetDefault = false;
     				});
                 }
        	   }
        );
   }
 	//});
