/*function stopError() {return true;}
window.onerror = stopError;*/
// DELAY PÅ SUBMENU
var menu1;var menu2;var foto;var dt = 350;
// SKRIVER TIL STATUS-BAREN
onload = function() {var d = new Date();byear = d.getFullYear();window.status = 'Buus Refrigeration ' + byear + '';tjek_gallery();blur_links();return true;}
// PLACERER STORT BILLEDE
function getScrollXY() {var scrOfY = 0;if( typeof( window.pageYOffset ) == 'number' ) {scrOfY = window.pageYOffset;} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {scrOfY = document.body.scrollTop;} else if( document.documentElement &&( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {scrOfY = document.documentElement.scrollTop;}return scrOfY +20;}
function getWidth() {if(document.getElementById) {bredde = document.getElementById('BILLEDER').offsetWidth;return bredde;}}
function placer() {hideLayer(load);showLayer(billeder);showLayer(bigfoto);moveLayerTo(billeder,getWinWidth()/2 - getWidth()/2,getScrollXY());}
// GENERERER STORT BILLEDE
function foto_big(T) {clearTimeout(foto);load = getLayerObj('LOAD');billeder = getLayerObj('BILLEDER');bigfoto = getLayerObj('BIGFOTO');placer_load();showLayer(load);hideLayer(bigfoto);hideLayer(billeder);var A = '<img src="media/fotos/';var B = '" border="0" onload="placer();" onclick="cut_big();" title="click to close" style="cursor:pointer;">';foto = setTimeout("setLayerHTML(bigfoto,'"+A+""+T+" "+B+"');",1);}
// PLACERER LOAD-SCREEN
function placer_load() {moveLayerTo(load,getWinWidth()/2 - 90,getScrollXY());}
// LUKKER STORT BILLEDE
function cut_big() {clearTimeout(foto);hideLayer(billeder);hideLayer(bigfoto);hideLayer(load);bigcut = setTimeout("setLayerHTML(bigfoto,'&nbsp;');",1);}
// SUBMENU
function menu_over_1() {submenu1 = getLayerObj('SUBMENU1');submenu2 = getLayerObj('SUBMENU2');clearTimeout(menu1);showLayer(submenu1);hideLayer(submenu2);}
function menu_out_1() {menu1 = setTimeout("hideLayer(submenu1);",dt);}
function menu_over_2() {submenu2 = getLayerObj('SUBMENU2');submenu1 = getLayerObj('SUBMENU1');clearTimeout(menu2);showLayer(submenu2);hideLayer(submenu1);}
function menu_out_2() {menu2 = setTimeout("hideLayer(submenu2);",dt);}
function cut() {submenu1 = getLayerObj('SUBMENU1');submenu2 = getLayerObj('SUBMENU2');hideLayer(submenu1);hideLayer(submenu2);}
// FØJER BUUS.DK TIL BROWSERENS FORETRUKNE
function addToFavorites(){if (document.all) {window.external.AddFavorite("http://www.buus.dk/","Buus Refrigeration");}else {alert('This feature is not supported by your browser');}}
// INDIKATOR PÅ FORMULAR-KNAPPER
function channelMouseOver(id) {id.style.backgroundColor='#0066cc';id.style.color='#ffffff';}
function channelMouseOut(id) {id.style.backgroundColor='#D5DEF1';id.style.color='#000000';}
// ÅBNER OG LUKKER HELP
function close_help() {help = getLayerObj('HELP');hideLayer(help);}
function open_help() {help = getLayerObj('HELP');showLayer(help);}
function blur_links(){if(document.getElementById){lnks=document.getElementsByTagName('a');for(i=0;i<lnks.length;i++){lnks[i].onfocus=new Function("if(this.blur)this.blur()");}}}
// RETURN TIL HOVEDSIDER EFTER GALLERI
function getCookieX(NameOfCookie)
{ if (document.cookie.length > 0) 
{ begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) 
{ begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 
}

function setCookieX(NameOfCookie, value, expiredays) 
{ var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
} 

function delCookieX (NameOfCookie) {
  if (getCookieX(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function tjek_gallery() {
dest = document.getElementById("backto");
reffra = document.referrer;
if (dest!=null && reffra!=null) {
back_gallery_one();
}
else {
javascript:void(0);
}
}

function back_gallery_one() {
tjcoo = getCookieX('loca');
if (tjcoo!=null) {
fff ='<a href="' + tjcoo + '">Return to your main site</a>';
document.getElementById("backto").innerHTML = fff;
}
else {
back_gallery_two();
}
}

function back_gallery_two() {
aaa = document.referrer;
bbb = "http://www.buus-hielo.es/to-galleries.htm";
ccc = "http://www.flakeice.com/login/to-galleries.htm";
ddd = "http://www.iceflakers.com/to-galleries.htm";
if ((aaa != null) && (aaa == bbb || aaa == ccc  || aaa == ddd)) {
setCookieX('loca',aaa,1);
setTimeout("doit();",1);
}
else {
javascript:void(0);//document.getElementById("backto").innerHTML = "<a href='http://www.buus.dk/'>Tilbage til hovedoversigten</a>";
}
}
function doit() {
eee = getCookieX('loca');
fff ='<a href="' + eee + '">Return to your main site</a>';
document.getElementById("backto").innerHTML = fff;
}
