var bodyHeight; 

function setBodyHeight() {
  sH = document.body.scrollHeight;
  //alert(document.body.clientHeight);
  cH = 551;
  if(cH>sH)
    bodyHeight = cH;
  else
    bodyHeight = sH;
}

function setFooter() {
  footerHeight = 60;
  if(bodyHeight > document.body.clientHeight-footerHeight) {
    document.getElementById("FOOTER").style.top = bodyHeight;
  } else {
    document.getElementById("FOOTER").style.top = document.body.clientHeight-footerHeight;
  }
  document.getElementById("FOOTER").style.visibility = 'visible';
}

function init() {
  if(document.getElementById) {
    setBodyHeight();
    setFooter();
  }
  initPage();
}

function initPage() {
  // to be overwriten by the page
}

function changeNav(el, on) {
  if(on) {
    el.style.backgroundColor = '#091E61';
    el.children[0].style.color = "#FFFFFF";
    el.style.cursor = 'hand';
  } else {
    el.style.backgroundColor = '#FFFFFF';
    el.children[0].style.color = "#333333";
  }
}


function toggleImg(img) {
  src = img.src;
  if(src.indexOf('_off') != -1)
    img.src = src.replace('_off', '_on');
  else if(src.indexOf('_on') != -1)
    img.src = src.replace('_on', '_off');
}

function preloadImg(img) {
  src = img.src;
  document.onImg = new Image();
  document.onImg.src = src.replace('_off', '_on');
}

function openPopupWindow(url, width, height, scrolling) {
  if (!width) width = 350;
  if (!height) height = 350;
  if (!scrolling) scrolling = "no"; 
  features = "width="+width+","
           + "height="+height+","
           + "toolbar=no,"
           + "location=no,"
           + "status=no,"
           + "menubar=no,"
           + "scrollbars="+scrolling+","
           + "top="+(window.screen.height-height)/2+","
           + "left="+(window.screen.width-width)/2;
  window.open(url,"win"+Math.round(Math.random()*1000),features);
}

function openFullImg(id) {
  width = 600;
  height = 500;
 scrolling = "no"; 
  features = "width="+width+","
           + "height="+height+","
           + "toolbar=no,"
           + "location=no,"
           + "status=no,"
           + "menubar=no,"
           + "scrollbars="+scrolling+","
           + "top="+(window.screen.height-height)/2+","
           + "left="+(window.screen.width-width)/2;
  window.open("/includes/full_img.jsp?id="+id,"winFull",features);
}

function openNormImg(fname) {
  width = 800;
  height = 700;
 scrolling = "no"; 
  features = "width="+width+","
           + "height="+height+","
           + "toolbar=no,"
           + "location=no,"
           + "status=no,"
           + "menubar=no,"
           + "scrollbars="+scrolling+","
           + "top="+(window.screen.height-height)/2+","
           + "left="+(window.screen.width-width)/2;
  window.open("/includes/img.jsp?file_name="+fname,"winFull",features);
}

function openImg(fname) {
  width = 600;
  height = 600;
 scrolling = "no"; 
  features = "width="+width+","
           + "height="+height+","
           + "toolbar=no,"
           + "location=no,"
           + "status=no,"
           + "menubar=no,"
           + "scrollbars="+scrolling+","
           + "top="+(window.screen.height-height)/2+","
           + "left="+(window.screen.width-width)/2;
  window.open("/includes/img.jsp?file_name=/images/lodge-floor-plans/"+fname,"winFull",features);
}


function doOver(el,num) {
	var clr,fnt;
	if(num==0){clr='5DAF02';fnt='FFFFFF';}
	if(num==1){clr='F6B014';fnt='000000';}
	if(num==2){clr='E340A9';fnt='FFFFFF';}
	if(num==3){clr='670065';fnt='FFFFFF';}
  document.getElementById(el).style.backgroundColor = clr;
  document.getElementById(el).style.color = fnt;
  document.getElementById(el).style.cursor = "hand";
}

function doOut(el) {
    document.getElementById(el).style.backgroundColor = '#CCE5FD';
	document.getElementById(el).style.color = '000000';
  document.getElementById(el).style.cursor = "auto";
}