
function methodToFixLayout() {
    var winHeight = jQuery(window).height();
    var winWidth = jQuery(window).width();
    
if (winHeight/winWidth <=  0.5 ) { 
jQuery("#backgr").width(winWidth); 
jQuery("#backgr").height(winWidth * 0.5); 
} else {
jQuery("#backgr").width(winHeight * 2); 
jQuery("#backgr").height(winHeight); 
}
} 

jQuery(document).ready(function ($) {
methodToFixLayout();
$(window).bind("resize", methodToFixLayout);

current="#foto1";
});

function move_thumbs(direction){
thumb_height=jQuery('#thumbmenu').height(); 

 topmargin= parseInt(jQuery("#thumbmenu").css("marginTop"));
 var moveTo=0;
if(direction=="down") moveTo=topmargin+558;
else if(direction=="up")  moveTo=topmargin-558;

if( (thumb_height + topmargin >558 && direction=="up") || ( topmargin <=-558 && direction=="down")){
jQuery("#thumbmenu").animate({
marginTop: moveTo }, 2000, function() {

  });
  }
}

function show_pic(thumb_name,koll_name){
jQuery(':animated').stop();
var active_class="."+thumb_name;
jQuery('.koll_thumb').removeClass('active');
jQuery(active_class).addClass('active');


if (current=="#foto1") { jQuery("#f2").attr("src",eval(thumb_name).src); newdiv="#foto2"; }
else if (current=="#foto2") { jQuery("#f1").attr("src",eval(thumb_name).src);  newdiv="#foto1"; }


// eval(newfoto).src=eval(thumb_name).src;


jQuery(current).animate({ opacity: 0 }, 1000);
jQuery(newdiv).animate({ opacity: 1 }, 1000);
jQuery(newdiv).fadeIn("slow");
current = newdiv;
}
