function mark(tr) {
		tr.className = 'trFarve';
}

function unmark(tr) {
		tr.className = '';
}

function classChange(obj, clName) {
		obj.className = clName;
}

function VReset(cur,fName){
	cur[fName].style.background='';
	cur['e_'+fName].src = 'ill/blank.gif';
}

function VFault(cur,fName){
	cur[fName].focus();
	cur[fName].style.background='Yellow';
	cur['e_'+fName].src = 'ill/ErrArrowLeft.gif';
}

function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}


// Mail validation
function validateEmail(obj){
	if (obj.indexOf("@") == -1 || obj.length < 6 || obj.indexOf(".") == -1){
		return true;
	}
    else
    {
      return false;
    }		
}

// String not Null validation
function validateNull(obj,fName,errMsg){
	if (trimString(obj[fName].value).length < 1){
	  if (trimString(errMsg).length > 0){
	  	alert(errMsg);
	  }
	    VFault(obj,fName);
		return true;
	}
    else
    {
   	  VReset(obj,fName);
	  return false;
    }		
}

// Number not String validation
function validateIsNumeric(obj){			
    if (isNaN(obj)){
   		return true;
    }
	else
    {
      return false;
    }		
}

// Is Like validation
function validateLike(obj,obj2){			
    if (obj == obj2){
   		return false;
    }
	else
    {
      return true;
    }		
}

// Standart Print Function
DA = (document.all) ? 1 : 0
function Print() {
		if(DA){
			print();
		}
		else
		{
			window.print();
		}
}	

// Length Validation use -1 to exclude parameter
function validateLength(obj,minLength,preciseLength,maxLength){
	var tmpminLength,tmpmaxLength; 
		tmpminLength = false;
		tmpmaxLength = false;
	if (preciseLength != -1){
		if (obj.length == preciseLength){
		  return false;
		}
		else
		{
		  return true;
		}
	}
	else
	{
		if (minLength != -1){
		  if (obj.length >= minLength){
		   // tmpminLength = false;
		  }
		  else
		  {
		    tmpminLength = true;
		  }
		}
		if (maxLength != -1){
		  if (obj.length <= maxLength){
		    tmpmaxLength = false;
		  }
		  else
		  {
		    tmpmaxLength = true;
		  }
		}
		if (tmpminLength || tmpmaxLength){
		  return true;
		}
	}
}


function lockOut() 
{
	parent.location.replace('../timeoutHandler.asp')
}

// History med Browsercheck 
function lib_bwcheck()
{
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6||this.ie7
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)	
}
var bw=new lib_bwcheck()

function goBack() 
{
	if (bw.ns6 || bw.ns4  ) {
		history.go(-1);
	}
	else
	{
		history.back(-1);	
	}
}

function OpenNewWin(url, width, height)    
{
	var leftLocation, topLocation, windowWidth, windowHeight;
	leftLocation = 100;
	topLocation = 75;

  if (window.screen) 
	{
  	windowWidth = window.screen.availWidth;
		windowHeight = window.screen.availHeight;
		leftLocation = windowWidth - ((windowWidth/2) + (width/2));
		topLocation = windowHeight - ((windowHeight/2) + (height/2));
  }
	
  window.open(url,'_blank','width=' + width + ',height=' + height + ', status=no,toolbar=no, location=no,scrollbars=yes screenX='+leftLocation+',screenY='+topLocation+',top='+topLocation+',left='+leftLocation+'');    
}

function check_date(field,errMsg){
var checkstr = "0123456789";
var DateField = field;
var Datevalue = "";
var DateTemp = "";
var seperator = ".";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var dateErrMsg = errMsg;
var i;
   err = 0;
   DateValue = DateField.value;
   /* Delete all chars except 0..9 */
   for (i = 0; i < DateValue.length; i++) {
	  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
	     DateTemp = DateTemp + DateValue.substr(i,1);
	  }
   }
   DateValue = DateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(2,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(0,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   if (err == 0) {
      DateField.value = day + seperator + month + seperator + year;
   }
   /* Error-message if err != 0 */
   else {
      alert(dateErrMsg.value);
      return false;
	  //DateField.select();
	  //DateField.focus();
   }
}

function setDateInField()    
{
	var selDate
	var selMonth
	var selYear
	selDate = document.all['MM_Day'].value;
	selMonth = document.all['MM_Month'].value;
	selYear = document.all['MM_Year'].value;
	document.MM_datecheck.MM_testdate.value = selDate + selMonth + selYear;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/***********************************************
* Tab Content script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Set tab to intially be selected when page loads:
//[which tab (1=first tab), ID of tab content to display]:
var initialtab=[1, "sc1"]

////////Stop editting////////////////

function cascadedstyle(el, cssproperty, csspropertyNS){
if (el.currentStyle)
return el.currentStyle[cssproperty]
else if (window.getComputedStyle){
var elstyle=window.getComputedStyle(el, "")
return elstyle.getPropertyValue(csspropertyNS)
}
}

var previoustab=""

function expandcontent(cid, aobject){
if (document.getElementById){
highlighttab(aobject)
detectSourceindex(aobject)
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
document.getElementById(cid).style.display="block"
previoustab=cid
if (aobject.blur)
aobject.blur()
return false
}
else
return true
}

function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collecttablinks()
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].style.backgroundColor=initTabcolor
var themecolor=aobject.getAttribute("theme")? aobject.getAttribute("theme") : initTabpostcolor
aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.backgroundColor=themecolor
}

function collecttablinks(){
var tabobj=document.getElementById("tablist")
tabobjlinks=tabobj.getElementsByTagName("A")
}

function detectSourceindex(aobject){
for (i=0; i<tabobjlinks.length; i++){
if (aobject==tabobjlinks[i]){
tabsourceindex=i //source index of tab bar relative to other tabs
break
}
}
}

function do_onload(){
var cookiename=(persisttype=="sitewide")? "tabcontent" : window.location.pathname
var cookiecheck=window.get_cookie && get_cookie(cookiename).indexOf("|")!=-1
collecttablinks()
initTabcolor=cascadedstyle(tabobjlinks[1], "backgroundColor", "background-color")
initTabpostcolor=cascadedstyle(tabobjlinks[0], "backgroundColor", "background-color")
if (typeof enablepersistence!="undefined" && enablepersistence && cookiecheck){
var cookieparse=get_cookie(cookiename).split("|")
var whichtab=cookieparse[0]
var tabcontentid=cookieparse[1]
expandcontent(tabcontentid, tabobjlinks[whichtab])
}
else
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}


//Dynamicdrive.com persistence feature add-on

var enablepersistence=true //true to enable persistence, false to turn off (or simply remove this entire script block).
var persisttype="local" //enter "sitewide" for Tab content order to persist across site, "local" for this page only

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function savetabstate(){
var cookiename=(persisttype=="sitewide")? "tabcontent" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? tabsourceindex+"|"+previoustab+";path=/" : tabsourceindex+"|"+previoustab
document.cookie=cookiename+"="+cookievalue
}