// Åpner bilde 
function popUp(tImg,name,w,h,extra){
   var tRef = location.href;
   var pos = tRef.indexOf(".no/");

   str="height="+h+",width="+w+","+extra;
   if(parseInt(navigator.appVersion)>3)
      str+=",left="+(screen.width -w)/2+",top="+parseInt((screen.height -h)/2);
   
   tUrl = tRef.substr(0,pos + 3) + "/~jt-marku" + tImg;
   window.open(tUrl,name,str);
}

function popImg(tImg,tWidth,tHeight){
	popUp(tImg,'Bilde',tWidth,tHeight,'resizable=1,scrollbars=1')
}

function disable() {
   if (event.button == 2)
   {
      alert("Sorry! Høyreklikk ikke tillatt!");
   }
}

function nyttbokmerke()
{
	bokmerkeurl="http://www.jontrygve.com";
	bokmerketittel="Jon Trygve's Tog og Modelljernbane";
	if (document.all){
		window.external.AddFavorite(bokmerkeurl,bokmerketittel);
	}
} 

function chgLogo()
{
   var str = window.location.href;
  
   if (str.search("/stog") > 0){
	  document.headerimg.src="../../images/Header_stog.jpg";
   }
   else if (str.search("/mtog") > 0){
      document.headerimg.src="../../images/Header_mtog.jpg";
   }
   else if (str.search("/htog") > 0){
      document.headerimg.src="../../images/Header_htog.jpg";
   }
}

// share link on facebook
function fbs()
{
   var tRef = location.href;
   var pos = tRef.indexOf(".no/");
   var h = 400;
   var w = 550;

   str="height=" + h + ",width=" + w + ", resizable=1,scrollbars=1";
   if(parseInt(navigator.appVersion)>3)
      str+=",left="+(screen.width - w)/2+",top="+parseInt((screen.height - h)/2);
   
   tUrl = "http://www.facebook.com/sharer.php?u=" + tRef;
   window.open(tUrl,name,str);
}