﻿   //Udskrift funktion

var udskrift = false;
var gAutoPrint = true; // Flag for whether or not to automatically call the print function
var str_personid ="";
var str_angaaende ="";
var img;
var img_w;
var img_h;

//logo: billedsti - logo_w: bredde paa billedet - logo_h: hoejde paa billedet
function printSpecial(logo,logo_w,logo_h,copyr){
 
 if (document.getElementById != null){
  var html = '<HTML><HEAD>';

  if (document.getElementsByTagName != null){
   var headTags = document.getElementsByTagName("head");
   if (headTags.length > 0)
    html += headTags[0].innerHTML;
  }
  
  html += '</HE' + 'AD><BODY link="#" vlink="#" alink="#" bgcolor="#FFFFFF">';
  html += '<scr'+'ipt>va'+'r udskrift = tr'+'ue;<\/scr'+'ipt>';
  
  html += '<st'+'yle type="text/css">.mainpad {padding-left: 10px;padding-right: 20px;padding-top: 0px;padding-bottom: 25px}<\/sty'+'le>';
 html += '<st'+'yle type="text/css">.mainartikel {margin-left: 10px;margin-right: 20px;margin-top: 0px;margin-bottom: 25px}<\/sty'+'le>';
 html += '<st'+'yle type="text/css">#readyForPrint {display:none;}<\/sty'+'le>';
  html += '<ta'+'ble cellpadding="0" cellspacing="0" border="0" width="615"><t'+'r><t'+'d><im'+'g src="' + logo + '" width="' + logo_w + '" height="' + logo_h + '" alt="" bor'+'der="0"><\/t'+'d>';
    
  if(img){
   html += '<td style="padding-left: 10px;" align="right"><im'+'g src="/media/' + img + '" width="' + img_w + '" height="' + img_h + '" alt="" bor'+'der="0"><\/t'+'d>';
  }
  
  html += '<\/t'+'r><t'+'r><t'+'d height="20"><\/t'+'d><\/t'+'r><\/tab'+'le>';
  html += '<ta'+'ble cellpadding="0" cellspacing="0" border="0" width="615" class="section">';
    
  
  var printReadyElem = document.getElementById("printReady");
  
  if (printReadyElem != null){
   html += printReadyElem.innerHTML;  }
  else{
   alert("Sorry, Could not print this page");
   return;
  }
html += "<tr><td colspan=20 class=section style=font-size:10px><font face=verdana size=1 color=#000000>"+copyr+"<\/font><\/td><\/tr>";
html +="<\/table>";
/* html += '<scr'+'ipt language="JavaScript" type="text/javascript">var set_width = document.getElementsByTagName("IMG");var obj ="";for(i=0; i<set_width.length; i++){if(set_width[i].src.indexOf("/setup/1x1.gif") != -1 && set_width[i].id != "omega"){set_width[i].width= "";}}<\/s'+'cript>';*/

  html += '<\/BO' + 'DY><\/HT' + 'ML>';
  
  var printWin = window.open("","printSpecial");
  printWin.document.open();
  printWin.document.write(html);
  printWin.document.close();
  
  if (gAutoPrint)
   printWin.print();
 }
 else{
  alert("Sorry, the print ready feature is only available in modern browsers.");
 }
}

function InitHelpText(txt)
{
	var elm = Tangora.DOM.GetFirstCollectionMember("newSnippetContainer","input");
	elm.id = "searchBox";
	PlaceInputHelpText(elm.id,txt);
}

function PlaceInputHelpText(elmID,text)
{
	var elm = document.getElementById(elmID);

	SetHelpText(elm,text);
	Tangora.Events.AddHandler(elm,"onfocus",function() {RemoveHelpText(elm,text);});
	Tangora.Events.AddHandler(elm,"onblur",function() {SetHelpText(elm,text);});
}

function SetHelpText(elm,text)
{
	if(elm.value == '')
	{
		elm.value = text;
	}
}

function RemoveHelpText(elm,text)
{
	if(elm.value == text)
	{
		elm.value = '';
	}
}

function showBar(mo, do_or_dont){
if(do_or_dont){
document.getElementById(mo).style.display = "block";
}else{
document.getElementById(mo).style.display = "none";
}
}
