function init_almers()
{
    bg_img_attr = {
        natural_width: 1600,
		natural_height: 1080
    };
    
	$(window).resize(bg_crop);
	bg_crop();
	
	
}

function bg_crop()
{
    var img = $(".bgPageImg");
    if (img)
    {
        var window_width = $(window).width();
        var window_height = $(window).height();
        ratio_window = window_height / window_width;
        ratio_img = bg_img_attr.natural_height / bg_img_attr.natural_width;

        if (ratio_window > ratio_img)
        {
            new_width = window_height / ratio_img;
            img.css("height", window_height + "px");
            img.css("width", "auto");
            img.css("left", "-" + parseInt((new_width - window_width)/2) + "px");
        }
        else
        {
            img.css("width", "100%");
            img.css("height", "auto");
            img.css("left", "0");
        }
    }
}




$(function () {
    init_almers();
});









function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function switchMenu(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function openMenu(obj) {
	var el = document.getElementById(obj);
	
		el.style.display = '';
	
}

function killMenu(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'none';
	}
}


                



function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function MM_setTextOfLayer(objId,x,newText) { //v9.0
  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
    with (obj) innerHTML = unescape(newText);
}


function MM_setTextOfTextfield(objId,x,newText) { //v9.0
  with (document){ if (getElementById){
    var obj = getElementById(objId);} if (obj) obj.value = newText;
  }
}


function unselect()
{
  //document.forms[0].Pris[index].checked = false;
  
  var cBoxes = document.forms[0].Pris;
for(var i=0, n=cBoxes.length; i<n; ++i){
cBoxes[i].checked = false;
}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
