// JavaScript Document
$(document).ready(function()
{
   

    
   //----------------------------------------IMGCONTAINER
    $('#close_img').click(function(){
        $('#img_container').hide();
    
    });
    $('#next_img').hover(
        function(){
            $('#next_arrow_over').show();
            $('#next_arrow').hide();
        },
        function(){
            $('#next_arrow_over').hide();
            $('#next_arrow').show();
    });
    $('#prev_img').hover(
        function(){
            $('#prev_arrow_over').show();
            $('#prev_arrow').hide();
        },
        function(){
            $('#prev_arrow_over').hide();
            $('#prev_arrow').show();
    });
    function setArrowsPos(){
        var posy=175-12+parseInt(img_height_array[current_index])/2;
            //alert(posy+"px");
            $('.img_cont_next').css('top',(posy)+"px");
            $('.img_cont_prev').css('top',(posy)+"px");
    }
    $('#next_img').click(function(){
        
        var next_index= parseInt(current_index)+1;
        
        if(next_index<img_array.length){
            current_index=next_index;
            $('#img_holder').css('min-height',img_height_array[next_index]+"px");
            $('#img_holder').html(img_array[next_index]);
            check_img_nav();
        }
    });
    $('#prev_img').click(function(){
       
        var prev_index=parseInt(current_index)-1;
        
        if(prev_index>=0){
            current_index=prev_index;
            $('#img_holder').css('min-height',img_height_array[prev_index]+"px");
            
            $('#img_holder').html(img_array[prev_index]);
        }
        check_img_nav();
    });
    function check_img_nav(){
        $('#prev_img').show();
        $('#next_img').show();
        $('#next_img_off').hide();
        $('#prev_img_off').hide();
        if(current_index==0){
            $('#prev_img').hide();
            $('#prev_img_off').show();
        }
        if(current_index==(img_array.length-1)){
            $('#next_img').hide();
            $('#next_img_off').show();
        }
        setArrowsPos();
    
    }
    $('.img_switch').hover(
        function(){
            $(this).children('.img_hover').show();
            $(this).children('.img_standard').hide();
        },
        function(){
            $(this).children('.img_hover').hide();
            $(this).children('.img_standard').show();
    });
    $(document).everyTime( 7000, function(){ 
			//alert("hi");
            
            //alert(current_img+"-1="+(current_img-1));
            
			if(current_img<1){
               
				current_img=img_array.length-1;
                 var id=img_array[current_img];
                //alert(current_img);
                $(id).fadeIn(1200,function(){
                    $(".slideshow_image").show();
                });
                current_img=img_array.length;
				
			}else{
                var id=img_array[current_img];
                $(id).fadeOut(1200);
            }
            current_img--;
			
			
	});
    

//setArrowsPos();
jQuery.each(jQuery.browser, function(i, val) {
     if (i=='msie'&&val==true){
     $("#img_container").css('position','absolute');
      $(document).everyTime( 1, function(){ 
             $("#footer").css('position','absolute');  
            var top=$(window).height()-$("#footer").height()+$(this).scrollTop(); 
        $("#footer").css('top',top+'px');  
        }); 
    }
    });
});
