		function checkForm() {
			var error="";
			resetFields();
			if(!checkLength(1,null,document.form_kontakt.subject.value)) {
			 	document.form_kontakt.subject.className="contactInputLong_error";
			 	error += document.getElementById('subjectError').value + "\n";
			}
			if(!checkLength(1,null,document.form_kontakt.familyName.value)) {
			 	document.form_kontakt.familyName.className="contactInput_error";
			 	error += document.getElementById('familyNameError').value + "\n";
			}
			if(!checkLength(1,null,document.form_kontakt.preName.value)) {
			 	document.form_kontakt.preName.className="contactInput_error";
			 	error += document.getElementById('preNameError').value + "\n";
			}
			if(!checkEmail(document.form_kontakt.email.value)) {
				document.form_kontakt.email.className="contactInput_error";
			 	error += document.getElementById('emailError').value + "\n";
			}
			if (error) {
				/*document.form_kontakt.Name.focus();*/
				alert(error);
				return false;
			}
			else {
				return true;
				//document.form_kontakt.submit();
			}
		}

		function checkEmail(value) {
			 var proto  = "(mailto:)?";
			 var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
			 var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
			 var regex  = "^" + proto + "?" + usr + "\@" + domain + "$";

			 var rgx    = new RegExp(regex);
			 return rgx.exec(value) ? true : false;
		}

		function checkLength(min,max,value) {
			 result=true;
			 if (min!=null) {
				  if (value.length < min) result=false;
			 }
			 if (max!=null) {
				  if(value.length > max) result=false;
			 }
			 return result;
		}

		function resetFields() {
			document.form_kontakt.subject.className="contactInputLong";
			document.form_kontakt.familyName.className="contactInput";
			document.form_kontakt.preName.className="contactInput";
			document.form_kontakt.email.className="contactInput";
		}




		function utf8_decode(utftext) {
			var string = "";
			var i = 0;
			var c = c1 = c2 = 0;

			while ( i < utftext.length ) {

				c = utftext.charCodeAt(i);

				if (c < 128) {
					string += String.fromCharCode(c);
					i++;
				}
				else if((c > 191) && (c < 224)) {
					c2 = utftext.charCodeAt(i+1);
					string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
					i += 2;
				}
				else {
					c2 = utftext.charCodeAt(i+1);
					c3 = utftext.charCodeAt(i+2);
					string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
					i += 3;
				}

			}

			return string;
		}


		function gup(name) {
		    var results = (new RegExp("[\\?&]"+name+"=([^&#]*)")).exec(window.location.href);
		    if ( results == null ) {
		    	return "";
		    } else {
		    	return results[1];
		    }
	    };







function showPicBaseInBox(pic){
	document.getElementById('picBaseDiv').innerHTML = pic;
}

function showSitemapSubmenu(element, elemtype) {
	elem = element+elemtype;

	if(document.getElementById(elem).style.display == 'block'){
		document.getElementById(elem).style.display='none';
		document.getElementById('arrowSitemap'+elemtype+element).innerHTML = '<input height="9" width="9" type="image" onclick="showSitemapSubmenu(\''+element+'\', \''+elemtype+'\');" src="/webdesign/osnabrueck/cms/pix/elements/arrow_closed.gif"/>';
	}
	else if(document.getElementById(elem).style.display == 'none') {
		document.getElementById(elem).style.display='block';
		document.getElementById('arrowSitemap'+elemtype+element).innerHTML = '<input height="9" width="9" type="image" onclick="showSitemapSubmenu(\''+element+'\', \''+elemtype+'\');" src="/webdesign/osnabrueck/cms/pix/elements/arrow_open.gif"/>';
	}


}
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 showDivBox(szDivID, iState) {

  	//NN4+
    if(document.layers)	 {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    //gecko(NN6) + IE 5+
    else if(document.getElementById)	 {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
        obj.style.display = iState ? "block" : "none";
    }
    // IE 4
    else if(document.all) {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

//
// parentElem	= 	Container zur Aufnahme des neuen Elements
// type			= 	Typ des neuen Elements
// name			= 	Name des neuen Elements
// value		= 	Wert des neuen Elements
// clickEvent	= 	onclick event des neuen Elements
//
function generateElement(parentElem, type, name, value, clickEvent) {

	var check = document.createElement('input');
	check.type = type;
	check.name = name;
	check.id = name;
	check.value = value;
	check.onclick = clickEvent;

	parentElem.appendChild(check);
}

function checkAll(box) {
	for (i = 0; i < box.length; i++)
		box[i].checked = true ;
	}

function uncheckAll(box){
	for (i = 0; i < box.length; i++)
		box[i].checked = false ;
}


function searchByEnterKey(event) {

	 if (!event)
				event = window.event;

	if(event.keyCode==13){
		showDivBox('searchDiv',1);
		xajax_nextPage(document.getElementById('suchen').value, 0); return true;
	}

}

function popup(url, w, h) {
	window.open(url,"game","height="+h+",width="+w+",left=100,top=150");
}


function saveCheckedBoxes(elem){

	// Wenn checkbox ausgewaehlt wird
	var sel = document.getElementById(elem);
	if (sel) {
		// Wurde das Element ausgewaehlt.
		if(sel.checked)  {

			// Geht auch kurzer lkreimeyer 08.06.2009
			/*if(document.pdfForm.pagesToPDF.value!='') 	{
				// Wurde das Element gefunden
				if(document.pdfForm.pagesToPDF.value.lastIndexOf(sel.value+',') == -1 ){
					document.pdfForm.pagesToPDF.value = document.pdfForm.pagesToPDF.value + sel.value + ',';
				}
			}
			else 	{
				document.pdfForm.pagesToPDF.value = sel.value + ',';
			}*/
			document.pdfForm.pagesToPDF.value += sel.value + ',';
		}
		// Wenn checkbox abgewaehlt wird
		else  {

			if(document.pdfForm.pagesToPDF.value!='') {
				if(document.pdfForm.pagesToPDF.value.lastIndexOf(sel.value+',') != -1){
					tmp = str_replace(sel.value+',', '', document.pdfForm.pagesToPDF.value);
					document.pdfForm.pagesToPDF.value = tmp;
				}
			}
		}
	}

}

function openPDFPopup(link,w,h,pdfList) {
	link += document.getElementById("js_menu_id").value;
	link += '&flagPdf=show';
	link += '&pdfList='+pdfList;
	var popupWindow = window.open(link,'','width='+w+',height='+h+',scrollbars=yes');
}

function str_replace(search, replace, subject) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Gabriel Paderni
    // +   improved by: Philip Peterson
    // +   improved by: Simon Willison (http://simonwillison.net)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   bugfixed by: Anton Ongson
    // +      input by: Onno Marsman
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    tweaked by: Onno Marsman
    // +      input by: Brett Zamir (http://brettz9.blogspot.com)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: str_replace(' ', '.', 'Kevin van Zonneveld');
    // *     returns 1: 'Kevin.van.Zonneveld'
    // *     example 2: str_replace(['{name}', 'l'], ['hello', 'm'], '{name}, lars');
    // *     returns 2: 'hemmo, mars'

    var s = subject;
    var ra = r instanceof Array, sa = s instanceof Array;
    var f = [].concat(search);
    var r = [].concat(replace);
    var i = (s = [].concat(s)).length;
    var j = 0;

    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
        }
    }

    return sa ? s : s[0];
}



function change_video_div(type,src) {
	if (type == 'youtube') {
		document.getElementById('videoDiv').innerHTML=
		"<table cellspacing=\"0\" cellpadding=\"0\" class=\"videoTable\" style=\"background: url(./pix/elements/iscope_head_youtube_back.gif) no-repeat scroll -10px 21px #FFFFFF\">" +
			"<tr>" +
				"<td colspan=\"3\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr style=\"background-color: rgb(227, 227, 227);\"><td width=\"100%\"></td><td style=\"vertical-align: bottom; text-align: right;\"><input type=\"image\" onclick=\"showDivBox('videoDiv',0);\" src=\"/webdesign/osnabrueck/cms/pix/buttons/close.gif\" style=\"border-left: 1px solid rgb(255, 255, 255); border-right: medium none;\"></td></tr></table></td>" +
			"</tr>" +
			"<tr height=\"60\">" +
				"<td class=\"top\" colspan=\"3\"></td>" +
			"</tr>" +
			"<tr>" +
				"<td valign=\"top\" class=\"mid\" colspan=\"3\">" +
					"<center>" +
					"<object width=\"640\" height=\"385\">" +
						"<param name=\"movie\" value=\"http://www.youtube.com/v/"+ src +"?fs=1&amp;hl=de_DE&amp;rel=0\"></param>" +
						"<param name=\"allowFullScreen\" value=\"true\"></param>" +
						"<param name=\"allowscriptaccess\" value=\"always\"></param>" +
						"<embed src=\"http://www.youtube.com/v/"+ src +"?fs=1&amp;hl=de_DE&amp;rel=0\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"640\" height=\"385\"></embed>" +
					"</object>" +
					"</center>" +
				"</td>" +
			"</tr>" +
			"<tr height=\"60\">" +
				"<td class=\"top\" colspan=\"3\"></td>" +
			"</tr>" +
			"<tr>" +
				"<td colspan=\"3\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr style=\"background-color: rgb(227, 227, 227);\"><td width=\"100%\"></td><td style=\"vertical-align: bottom; text-align: right;\"><input type=\"image\" onclick=\"showDivBox('videoDiv',0);\" src=\"/webdesign/osnabrueck/cms/pix/buttons/close.gif\" style=\"border-left: 1px solid rgb(255, 255, 255); border-right: medium none;\"></td></tr></table></td>" +
			"</tr>" +
		"</table>";
	}
}












function communicate(sDom, sUser){
  return("mail"+"to:"+sUser+"@"+sDom.replace(/%23/g,"."));
}
