// global.js
// Copyright © Thomas A. Osthege. All Rights Reserved.
// 6.9.2007

window.onError= null;

// init a control on the calling form via an INPUT tag
function initControl(index) {
	var siminput = document.body.getElementsByTagName('INPUT')[index];
	siminput.focus();
	siminput.click();
	siminput.disabled = true;
}

// Get param from browsers infoline (behind '?')
function getpar(paramname)
 {
  var searchval= window.location.search;

  searchval= unescape(searchval);
  searchval= '&' + searchval.substr(1, searchval.length - 1);

  var valpos= searchval.toLowerCase().indexOf('&' + paramname.toLowerCase() + '=');
  var valposstring= '';

  if (valpos > -1) 
  	valposstring= searchval.substring(valpos + paramname.length + 2, searchval.length);

  var endpos= valposstring.indexOf('&');
  var parval= '';
  
  if (endpos < 0) 
  	endpos= valposstring.length;

  if (endpos > 0) 
  	parval= valposstring.substring(0, endpos);

  return parval;
 }

function DisplayTheLastModifiedDate()
 {
  var LastModifiedDateAndTime = new Date(document.lastModified)
  var LastModifiedDay = LastModifiedDateAndTime.getDate()
  var LastModifiedMonth = (LastModifiedDateAndTime.getMonth() + 1) // You must add one because it returns the previous month.
  var LastModifiedYear = LastModifiedDateAndTime.getYear()
  var LastModifiedDate = ''
  if (LastModifiedDay < 10)
    LastModifiedDay = '0' + LastModifiedDateAndTime.getDate()
  if (LastModifiedMonth < 10)
    LastModifiedMonth = '0' + (LastModifiedDateAndTime.getMonth() + 1)
  if (LastModifiedYear < 100)
    LastModifiedYear = '20' + LastModifiedDateAndTime.getYear()
  LastModifiedDate = LastModifiedDay + '/' + LastModifiedMonth + '/' + LastModifiedYear
  document.write(LastModifiedDate)
 }

// Displays the URL of the current page (not frame page)
function DisplayTheDocumentNameAndPath()
 {
  var DocumentNameAndPath = new String(document.location)
  document.write(DocumentNameAndPath)
 }


function OpenPopupWindow(URL)
 {
//  window.open(URL,'PopupWindow','left=10,top=10,height=380,width=610,resizable=yes,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no');
  window.open(URL,'PopupWindow','resizable=yes,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no');
 }

function OpenHelpWindow(URL)
 {
  window.open(URL,'HelpWindow','left=110,top=110,height=380,width=280,resizable=no,scrollbars=yes,status=no,toolbar=no,directories=no,menubar=no,location=no');
 }

