var NS = (navigator.appName == "Netscape");
var forbiddenExtensions = Array("php","asp","asa","asax","exe","com","pif","scr","htm","html","cfm","cfml","inc","php3","php4","php5","htaccess","js","jsp","aspx","pl","css");
var allowedExtensionsPic = Array("jpg","jpeg","gif");



// Print function
function printIt() {
if (NS) {
window.print();
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" />';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 1); //Use a 1 vs. a 2 for a prompting dialog box
WebBrowser1.outerHTML = "";
}
}

// Link function
function jumpTo(page) {
window.location = page;
return true;
}


// check if text contains alpha-characters only
function isAlpha(text)
{
	if (text.length == 0) return true;
	var re = /^[a-zA-Z\s]+$/;
	return re.test(text);
}

// check if text contains numbers only
function isInt(text)
{
	if (text.length == 0) return true;
	var re = /^[0-9]+$/;
	return re.test(text);
}

// check if text contains numbers only
function num(text)
{
	if (text.length == 0) return true;
	text = text.replace(/,/,".");				// replace "," (JS needs "." to recognize FP)
	//var re = /^[0-9,\.]+$/;
	return !isNaN(text);//re.test(text);
}

// check if text contains alpha-characters and/or numbers only
function isAlphaNum(text)
{
	if (text.length == 0) return true;
	var re = /^[a-zA-Z0-9\s\u00E4\u00F6\u00FC\u00DF\u00C4\u00D6\u00DC\/]+$/;
	return re.test(text);
}

// check if text contains alpha-characters and/or numbers and/or some special chars only
function isAlphaNumSpecial(text)
{
	if (text.length == 0) return true;
	var re = /^[a-zA-Z0-9\(\)\$\%\&\s,\.\\\/\-\+\\\'\\\"\u00E4\u00F6\u00FC\u00DF\u00C4\u00D6\u00DC]+$/;
	return re.test(text);
}

function showPic(imageURL) {
  if (imageURL != "") {
    window.open('image_popup.html?'+imageURL,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=100,height=100');
  }
}

function hasAllowedExtension(filename, isPicture) {
  filenameParts = new Array();
  noExtension   = 1;
  forbiddenExtension = 2;
  
  filenameParts = filename.split('.');
  if (filenameParts.length < 2) {
    return noExtension;
  }
  // extension ermitteln
  extension = filenameParts[filenameParts.length-1].toLowerCase();
  // bild?
  if (isPicture) {
    for (i=0; i<allowedExtensionsPic.length; i++) {
      if (allowedExtensionsPic[i].toLowerCase() == extension) {
        return 0;
      }
    }
    return forbiddenExtension;
  }
  // sonstiges file?
  else {
    for (i=0; i<forbiddenExtensions.length; i++) {
      if (forbiddenExtensions[i].toLowerCase() == extension) {
        return forbiddenExtension;
      }
    }
    return 0;
  }
}


function popupUL() {
  nwin = window.open('upload_popup.html','','width=400,height=200');
  nwin.moveTo(screen.width/2-200, screen.height/2-100);
  nwin.opener = window;
}

