// JavaScript Document
//#################################################################################
// HIDE LINK STATUS MESSAGES
status_text();
function status_text()
	{
	//window.status="http://www.software--engineer.com";
	setTimeout("status_text()",1);
	}
//#################################################################################
function clearField(field)
	{
	if(field.value == "");
		{
		field.value = "";
		}
	}
//#################################################################################
// LETTERS AND NBUMBERS ONLY VERIFICATION
function valid_char_only(form)
	{
	var str = form.value;
	var show_alert = 0;
	for(var position=0; position<str.length; position++) 
		{
		var chr = str.charAt(position)
		if(chr.search(/[a-zA-Z!?,@()_.\-\s]/) && ((chr < "0") || (chr > "9")))
			{
			show_alert = 1;
			break;
			}
		}
	if(show_alert)
		{
		alert("Enter numbers and letters only.\nCharacters not allowed: \"`'^~#$%&*+*=[]{}()<>/|\\;:,?!");
		form.value="";
		form.focus();
		return false;
		}
	}	
//#################################################################################
// REPLACE INVALID CHARS
function replace_invalid_char(form)
	{
	var str = form.value;
	for(var position=0; position<str.length; position++) 
		{
		str = str.replace(/[=\/<>"\\|';]/, " ");
		}
	form.value = str;
	}
//#################################################################################
function isNumber(form,field) 
	{
	var str = form.value;
	var show_alert = 0;
	for(var position=0; position<str.length; position++) 
		{
		var chr = str.charAt(position)
		if ((chr < "0") || (chr > "9"))
			{
			show_alert = 1;
			break;
			}
		}
	if(show_alert)
		{
		alert("Enter numbers only.");
		form.value="";
		form.focus();
		return false;
		}
	else
		{
		return true;
		}
	}
//#################################################################################
// LOADS A WINDOW WITH A SPESIFIC URL AND SIZE
var pWin = null
function portWin(url, x, y)
	{
    pWin = window.open (url, 'newWin', 'width=' + x + ',height=' + y + ',top=0,left=0,resizable=yes,scrollbars=yes,status=0,menubar=no')
    pWin.setTimeout('window.close()',60000);
    if (window.pWin) pWin.focus()
    }
//#################################################################################
// LOADS A CENTERED WINDOW
var pWin = null
function open_window(url, x, y)
	{
	var w = x, h = y;
	if (document.all || document.layers)
		{
		w = screen.availWidth;
		h = screen.availHeight;
		}
	var popW = x, popH = y;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	pWin = window.open(url,"content","width=" + popW + ",height=" + popH + ",top=0" + topPos + ",left=0" + leftPos+",resizable=no,scrollbars=auto,status=1,menubar=no");
	if (window.pWin) pWin.focus()
    }
//#####################################################################################
// FOCUS ON FIELD
function fon(x)
	{
	x.style.borderWidth = '2px';
	x.style.borderStyle = 'solid';
	x.style.borderColor = 'red';
	}
function foff(x)
	{
	x.style.borderWidth = '2px';
	x.style.borderStyle = 'inset';
	x.style.borderColor = '';
	}
//#####################################################################################
// COUNT DOWN CHARACTERS
function CheckLen(form,field)
	{
	var maxlength = "1000";  //die maximale Zeichenlänge
	StrLen=field.value.length;
	if (StrLen==1&&field.value.substring(0,1)==" ")
		{
		field.value=""; 
		StrLen=0;
		}
	if (StrLen>maxlength )
		{
		field.value=field.value.substring(0,maxlength);
		CharsLeft=0;
		}
	else
		{
		CharsLeft=maxlength-StrLen;
		}
	if(CharsLeft <= 100)
		{
		form.counter.style.fontWeight = 'bold';
		form.counter.style.color = 'red';
		form.counter.value=CharsLeft;
		}
	else
		{
		form.counter.style.fontWeight = 'normal';
		form.counter.style.color = 'black';
		form.counter.value=CharsLeft;
		}	
	}











