dojo.require("dojox.image._base");
isIE6 = false;
if (/MSIE 6/i.test(navigator.userAgent)){ 
  isIE6 = true;
}
isIE = false;
if (/MSIE/i.test(navigator.userAgent)){ 
  isIE = true;
}
function toggleContent(keyword) {
 dojo.query("#content .yh-container").style("display", "none");
 dojo.query("#content ."+keyword).style("display", "block");
}
function checkLocation(element){
  if (dojo.attr(element, 'href') != window.location.hash.substring(0,window.location.hash.length)) {
  var link = dojo.attr(element, 'href')
  var container = link.substring(1,link.length);
  toggleContent(container);
  window.location.hash = dojo.attr(element, 'href');
  }
}
var images = new Array();

dojo.addOnLoad(function(){
	dojox.image.preload(images);	
	if(window.location.pathname.indexOf("yhteystiedot") > -1){ 
   
    if(window.location.hash == ''){
      window.location.hash = dojo.attr(dojo.query("#submenu a")[0], 'href');
    }
    dojo.style(dojo.byId("submenu"), "display", "block");
    //init
    toggleContent(window.location.hash.substring(1,window.location.hash.length));
    dojo.query("#submenu a").onclick(function() {
      checkLocation(this);
    });  
    dojo.query("#toplinks a").onclick(function(){
      if(window.location.hash != ''){
        var location = dojo.attr(this, 'href').split("#");
        toggleContent(location[1]);
      }
    });
  }
});
