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 for expanding or collapsing a chosen tag in the XSL template
function expand(thistag) {
  if(document.getElementById(thistag)){
    styleObj = document.getElementById(thistag).style;
    if (styleObj.display=='none') {styleObj.display = '';styleObj.marginLeft = '20px';}
  else {styleObj.display = 'none';}
  }
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function addTag(myValue1, myValue2) {
  myField = document.getElementById("body");
  //IE
  if (document.selection) {
    myField.focus();
    sel = document.selection.createRange();
    sel.text = myValue1+sel.text+myValue2;
    myField.focus();
  }
  //MOZILLA/NETSCAPE
  else if (myField.selectionStart || myField.selectionStart == '0') {
    var startPos = myField.selectionStart;
    var endPos = myField.selectionEnd;
    myField.value = myField.value.substring(0, startPos)
    + myValue1 + myField.value.substring(myField.selectionStart, myField.selectionEnd)
    + myValue2 +myField.value.substring(endPos, myField.value.length);
    //myField.selectionStart = startPos+3;
    //myField.selectionEnd = endPos + myValue1.length + startPos;
    myField.focus();
  } else {
    myField.value += myValue1+myValue2;
  }
}

/*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 playVideo(binary,height) {
                  
	if (swfobject.hasFlashPlayerVersion("6.0.0")) {
		var fn = function() {
			var att = { data:"http://www.retura.no/_public/flash/videoplayer.swf", width: 500, height: height };
			var par = { flashvars:"content=http://www.retura.no/_binary/"+binary+"/file?ext=.flv&skin=http://www.retura.no/_public/flash/SteelExternalAll.swf&autoPlay=true&width=500&height="+height, params: "wmode=opaque"};
			//var par = { flashvars:"content=binary/"+binary+"/file?ext=.flv&skin=_public/flash/SteelExternalAll.swf&autoPlay=true", params: "wmode=opaque"};
			var id = "flash-video";
			swfobject.createSWF(att, par, id);
		};
		swfobject.addDomLoadEvent(fn);
	}  //if
};