﻿

// function to open a popupwindow contains:
// URL, Name, pos. left, pos. top, width, height
// <a HREF="#" onClick="popupPage('/printpage.aspx','print','100','100','600','550');">
function popupPage(url, name, width, height, scroll) {
  if (scroll== null) scroll = "no";
  var windowprops ="height="+height+",width="+width+",location=no,scrollbars="+ scroll +",menubars=no,toolbars=no,status=yes,resizable=no";
  if(parseInt(navigator.appVersion)>3)
  {
    var top = Math.max(0,parseInt((screen.height -height)/2));
    windowprops+=",left="+(screen.width -width)/2+",top="+top;
  }
  var win = window.open(url, name, windowprops);
  win.focus();
}


function printPage(popupAspx)
{
  popupPage(popupAspx,'print','600','550','yes')
}


// function to retrieve data from open a popupwindow contains:
// This function retrieves data from the main window and send it  into the Printsection on the popup window
function getDataAndPrint(printcontrol) {
  try  {
    var html = opener.document.getElementById(printcontrol).innerHTML;
    html = html.replace(/\.\.\/App_Themes/gi,"App_Themes");
    document.getElementById("printSection").innerHTML = html
     
    window.setTimeout('window.print();',100);  	
  }
  catch(e)
  {
    // catch what ? 
  }
}

function Print(printcontrol) {
  try  {  
    document.getElementById("printSection").innerHTML = printcontrol
    
    window.setTimeout('window.print();',100);  	
  }
  catch(e)
  {
    // catch what ? 
  }
}

function resizeWinTo(imageID) {
  var IE5=NN4=NN6=false
  if(document.all)  
    IE5=true;
  else if(document.getElementById)
    NN6=true
  else if(document.layers)
    NN4=true
  
  var img = document.getElementById(imageID);

  if(IE5) 
    self.resizeTo(img.width+12,img.height+138)
	else if(NN6) 
	  self.sizeToContent()
	else 
	  top.window.resizeTo(img.width,img.height+138)
	self.focus()
}


function setRowFocus(sender)
{
  sender.parentNode.parentNode.className = 'rowHighLight';
}

function removeRowFocus(sender)
{
  sender.parentNode.parentNode.className = '';
}

/* Copy Right Protection */

// Disable the posibility to select text.
window.onload = setFormStyleTag;

function setFormStyleTag()
{
  var obj = null;
  for ( i=0; i < document.forms[0].length;i++)
  {
    obj = document.forms[0].elements[i]
    switch (obj.type)
    {
      case "submit": 
      case "button": 
        if (obj.className == null || obj.className == "")
        obj.className = "button"
        break;
      default: 
      break;
 }
  }
}





