var domain = 'http://www.heinakuu.com';

function startList() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

function getWindowHeight() {
  var windowHeight=0;
  if (typeof(window.innerHeight)=='number') {
    windowHeight=window.innerHeight;
  }
  else {
    if (document.documentElement&&document.documentElement.clientHeight) {
      windowHeight=document.documentElement.clientHeight;
    }
    else {
      if (document.body&&document.body.clientHeight) {
        windowHeight=document.body.clientHeight;
      }
    }
  }
  return windowHeight;
}

function getWindowWidth() {
  var windowWidth=0;
  if (typeof(window.innerWidth)=='number') {
    windowWidth=window.innerWidth;
  }
  else {
    if (document.documentElement&&document.documentElement.clientWidth) {
      windowWidth=document.documentElement.clientWidth;
    }
    else {
      if (document.body&&document.body.clientWidth) {
        windowWidth=document.body.clientWidth;
      }
    }
  }
  return windowWidth;
}

function setHeight() {
  if (document.getElementById) {
	var windowWidth=getWindowWidth();
	if (windowWidth>0) {
	  var masterDiv=document.getElementById('masterdiv');
	  var masterWidth=document.getElementById('footer').offsetWidth;
	  
      if (windowWidth < masterWidth) {
        masterDiv.style.left = '0px';
		masterDiv.style.marginLeft = '0px';
      } else {
		masterDiv.style.left = '50%';
		masterDiv.style.marginLeft = -507+'px';
	  }  
    } 	
  }
}
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
} 

window.onload = function() {
			setHeight();
			externalLinks();
			startList();
}
window.onresize = function() {
			setHeight();
}