var newWin = null;
function popUp(strURL, strType, strHeight, strWidth) {
	if (newWin != null && !newWin.closed)
		newWin.close();
		var strOptions="";
	if (strType=="popup")
		strOptions="location=0,menubar=1,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,height="+strHeight+",width="+strWidth;
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}

function playVideo(binary,height) {
      var so = new SWFObject("http://www.jernia.no/flash/videoplayer.swf", "videoplayer", 350, height, 7, "#ffffff");

      //so.addVariable("content", "binary/" + binary + "/file/video.flv");
      so.addVariable("content", "binary/" + binary + "/file?ext=.flv");
      so.addVariable("skin", "http://www.jernia.no/flash/SteelExternalAll.swf");
      so.addVariable("width", 350);
      so.addVariable("height", height);
      so.addVariable("autoPlay","true");
      so.write("flash-video"+binary);
}

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";
		}
	}
}

function launchApplication(url){
	var popUpWin = 0;
	if(screen.availWidth > 1024){
		var aw = 1024 - 10;
		var ah = 768 - 35;
	} else { 
		var aw = screen.availWidth - 10;
		var ah = screen.availHeight - 35;
	}
	var tURL = url + "&AvailWidth=" + aw + "&AvailHeight=" + ah;
	popUpWin = open(tURL, 'appWin', 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbar=0, 	resizable=0, scrolling=0, width='+aw+', height='+ah+', left=0, top=0, screenX=0, screenY=0');
}
function validateTipsVenn(form){
   if (form.to.value == ''){
      alert('Fyll inn epost-adresse');
      return false;
   }else if(form.from_name.value == ''){
      alert('Fyll inn ditt navn');
      return false;
   }else
      return true;
}
function validateSendRequest(form){
   if (form.from_email.value == ''){
      alert('Fyll inn epost-adresse');
      return false;
   }else if(form.from_name.value == ''){
      alert('Fyll inn ditt navn');
      return false;
   }else if(form.message.value == ''){
      alert('Fyll inn ditt tekst om hvorfor du søker');
      return false;
   }else
      return true;
}
