
/* GF */
  var randomNumber = Math.ceil(Math.random()*8);

  function showPortrait() { document.write("<img src=/images/smaa_"+[randomNumber]+".jpg>");}

function openPopup(PopupTarget, PopupWindowName, PWidth, PHeight) {
	win = window.open(PopupTarget,target=PopupWindowName,'resizable=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,width='+ PWidth+',height='+PHeight+', top=200, left=200');
	return win;
}

function openPopupXY(PopupTarget, PopupWindowName, PWidth, PHeight, xcoor, ycoor) {
	win = window.open(PopupTarget,target=PopupWindowName,'resizable=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,width='+ PWidth+',height='+PHeight+', top='+xcoor+', left='+ycoor);
	return win;
}

function openPopupOrigo(PopupTarget, PopupWindowName, PWidth, PHeight) {
	win = window.open(PopupTarget,target=PopupWindowName,'resizable=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,width='+ PWidth+',height='+PHeight+', top=0, left=0');
	return win;
}

function mailToFriend() {
       document.write('<a href="mailto:?subject=Info hos Grænseforeningen&body=Du er blevet tippet af en ven til at se følgende adresse: ' + document.URL + '" class="bold">Send til en ven</a>' );
}

function showArticle(id, link) {
       var counter = 1;

       document.getElementById('content').style.overflow = "auto";

       while (true) {
           if (document.getElementById(counter) != null) {
               document.getElementById(counter).style.visibility = "hidden";
               counter++;
           } else {
               break;
           }
       }
       document.getElementById('contentright').style.visibility = "visible";
       document.getElementById(id).style.position = "absolute";
       document.getElementById(id).style.top = document.getElementById(link).offsetTop;
       document.getElementById(id).style.visibility = "visible";
       document.getElementById(id).focus();
}

function showhide(szDivID, iState) // 1 visible, 0 hidden
{
   if(document.layers)	//NN4+
   { document.layers[szDivID].visibility = iState ? "show" : "hide"; }
   else if(document.getElementById) //gecko(NN6) + IE 5+
   { 
     var temp = document.getElementById("content");
     if (iState) {
	  temp.style.overflow = "hidden";
     } else {
     	  temp.style.overflow = "auto";
     }

     var obj = document.getElementById(szDivID);
     obj.style.visibility = iState ? "visible" : "hidden"; }
   else if(document.all) // IE 4
   { document.all[szDivID].style.visibility = iState ? "visible" : "hidden"; }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
 if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
   document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
 else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);


function print() {
       var gAutoPrint = true; // Flag for whether or not to automatically call the print function
	if (document.getElementById != null) {
		var printReadyElem = document.getElementById("gfcontent");
/*
               if (!printReadyElem)
                 printReadyElem = document.getElementById("contentleft3-4");
               if (!printReadyElem)
                 printReadyElem = document.getElementById("contentleft2-3");
               if (!printReadyElem)
                 printReadyElem = document.getElementById("contentfull");
               if (!printReadyElem)
                 printReadyElem = document.getElementById("content");
*/
		var html = '<HTML>\n<HEAD>\n';
		if (document.getElementsByTagName != null) {
		  var headTags = document.getElementsByTagName("head");
                 var scriptTags = document.getElementsByTagName("script");
		  if (headTags.length > 0)
		    html += headTags[0].innerHTML; 
                 }		
		 html += '\n<style type="text/css">#gfprintcontent {	top: 50px;	left: 50px;	width: 510px;	background-color: white;	text-align: left;}</style>\n'; 
		html += '\n</HE' + 'AD>\n<BODY style="background:white;" >\n';
		if (printReadyElem != null) {
		  html += '<DIV id="gfprintcontent" >';
		  html += '<img src="/images/7_gf.gif" alt="" width="81" height="33" border="0" align="right"><BR><BR>'
		  html += printReadyElem.innerHTML;
		} else { /* alert("Kunne ikke danne printside.");  return; */ }	
               html += '\n</DIV>';
               html += '\n<script language="JavaScript" type="text/javascript">\n<!--\n print();\n// -->\n</script>';
               html += '</BO' + 'DY>\n</HT' + 'ML>';
		var printWin = openPopup("", "Print", 700, 600) 
		printWin.document.open();
		printWin.document.write(html);
		printWin.document.close();
		/* if (gAutoPrint) printWin.print(); */
               /* printWin.close();*/
	} else { /* alert("Sorry, the print ready feature is only available in modern browsers."); */ }
}