function win_open(href, width, height)
{
	if ((width == '') &&  (height == ''))  
	{
		window.open(href, '_blank', 'toolbar=no,location=no,status=no,menubar=no,personalbar=no,scrollbars=yes,resizable=yes,screenx=50,left=50,screenY=50,top=50');
	} 
	else
	{
		window.open(href, '_blank', 'toolbar=no,location=no,status=no,menubar=no,personalbar=no,scrollbars=no,width=' + width + ',height=' + height + ',resizable=yes,screenx=50,left=50,screenY=50,top=50')
	}
}

function windowOpen(sUrl, iWidth, iHeight, sScrollbars) {

	var oWindow = window.open(sUrl, "_blank", "toolbar=no,location=no,status=yes,menubar=no,personalbar=no,scrollbars=" + sScrollbars + ",width=" + iWidth + ",height=" + iHeight + ",resizable=yes,screenx=75,left=75,screenY=75,top=75")
	oWindow.resizeTo(iWidth, iHeight);
}

function windowOpenLnk(sHref, sParams) {
	window.open(sHref, '_blank', sParams);
}


function changeLanguage(sUrl) {

	var oForm = document.globalForm;
	oForm.action = sUrl;
	oForm.target = "_self";
	oForm.method = "post";
	oForm.submit();
}

function printPage(sUrl) {

	var iWidth = 700;
	var iHeight = 500;
	var oWindow = window.open("", "printWindow", "toolbar=no,location=no,status=no,menubar=no,personalbar=no,scrollbars=no,width=" + iWidth + ",height=" + iHeight + ",resizable=yes,screenx=50,left=50,screenY=50,top=50");
	oWindow.resizeTo(iWidth, iHeight);
	
	var oForm = document.globalForm;
	oForm.action = sUrl;
	oForm.method = "post";
	oForm.target = "printWindow";
	
	oForm.submit();
}

function recommendPage(sPageUrl) {

	var sUrl = window.location.href;
	windowOpen(sPageUrl + '?url=' + escape(sUrl), 700, 600, 'no');
}

function getTwoDigits(iItem) {

	var sItem = new String(iItem);

	if (sItem.length == 1) {
		sItem = "0" + sItem;
	}

	return sItem;
}

function goTo(sUrl) {

	if (Check.String(sUrl)) {
		window.location.href = sUrl;
	}
}

function getElement(sId) {

	var oReturn;
	
	if (Check.String(sId)) {
		oReturn = document.getElementById(sId);
	}
	
	return oReturn;
}

function checkMandatoryFields(oForm) {

	var bReturn = true;
	
	var i, j;
	var bCheck;
	var oElement;
	var sElementName, sElementType;
	
	for (i = 0; i < oForm.elements.length; i++) {
		
		oElement = oForm.elements[i];
		sElementName = oElement.name;
		sElementType = oElement.type;
		sElementClassName = " " + oElement.className + " ";

		if (Check.String(sElementClassName)) {
			
			if (sElementClassName.indexOf(" mf ") != -1) {

				switch (sElementType) {
				
					case "text":
						
						if (! Check.String(oElement.value)) {

							oElement.focus();
							bReturn = false;
						}
						
						break;
						
					case "password":
						
						if (! Check.String(oElement.value)) {

							oElement.focus();
							bReturn = false;
						}
						
						break;
						
					case "textarea":
						
						if (! Check.String(oElement.value)) {

							oElement.focus();
							bReturn = false;
						}
						
						break;
						
					case "file":
						
						if (! Check.String(oElement.value)) {

							oElement.focus();
							bReturn = false;
						}
						
						break;
						
					case "select-one":
					
						if (oElement.length > 0) {
						
							if (! Check.String(oElement[oElement.selectedIndex].value) ||
								oElement[oElement.selectedIndex].value == "null") {
								
								oElement.focus();
								bReturn = false;
							}
						}
						else {
						
							oElement.focus();
							bReturn = false;
						}
						
						break;
						
					case "select-multiple":

						bCheck = false;

						for (j = 0; j < oElement.options.length; j++) {
						
							if (oElement.options[j].selected) {
							
								bCheck = true;
								break;
							}
						}

						if (! bCheck) {

							oElement.focus();
							bReturn = false;
						}
						
						break;
				
					case "hidden":

						if (! Check.String(oElement.value)) {
							bReturn = false;
						}
						
						break;
				}
			}
		}

		if (! bReturn) {
			break;
		}
	}

	if (! bReturn) {
		alert("Bitte fuellen Sie alle markierten Felder aus!");
	}

	return bReturn;
}

function getRadioListValue(oElement) {

	var sReturn = "";
	
	if (oElement) {
	
		for (var i = 0; i < oElement.length; i++) {
		
			if (oElement[i].checked) {
				
				sReturn = oElement[i].value;
				break;
			}
		}
	}
	
	return sReturn;
}

function checkDelete(sUrl) {

	if (Check.String(sUrl)) {
	
		if (confirm("Wollen sie diesen Eintrag wirklich löschen?")) {
			window.location.href = sUrl;		
		}
	}
}

function getXMLObject() {

	var oXmlHttp = null;
	var e1, e2, e3, e4;
	
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
		try {
			oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP")
		}
		catch (e1) {
			
			try {
				oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e2) {
				oXmlHttp = null;
			}
		}
	@else
		try {
			oXmlHttp = new XMLHttpRequest();
		}
		catch (e3) {
			oXmlHttp = null;
		}
	@end @*/
	
	if (! oXmlHttp) {
		
		try {
			oXmlHttp = new XMLHttpRequest();
		}
		catch (e4) {
			oXmlHttp = null;
		}
	}

	return oXmlHttp;
}

function setDisplay(sId, sValue) {

	var oElement = getElement(sId);
	
	if (oElement) {
		oElement.style.display = sValue;
	}
}

function setContent(sTarget, sContent) {

	var oTarget = document.getElementById(sTarget);

	if (oTarget) {
		
		oTarget.innerHTML = sContent;
	}
}

function sendRequest(sUrl, sTarget) {

	if (Check.String(sUrl)) {
	
		var oXMLHttp = getXMLObject();
	
		if (oXMLHttp) {
	
			oXMLHttp.open("GET", sUrl, true);
	
			oXMLHttp.onreadystatechange = function() {
	
				if (oXMLHttp.readyState == 4) {
				
					setContent(sTarget, oXMLHttp.responseText);
				}
			}
	
			oXMLHttp.send(null);
		}
		else {
	
			var oIframe = document.getElementById("requestIframe" + sTarget);
			
			if (oIframe) {
				oIframe.src = sUrl;
			}
			else {
				document.write("<iframe name=\"requestIframe" + sTarget + "\" id=\"requestIframe" + sTarget + "\" src=\"" + sUrl + "\" width=\"0\" height=\"0\" frameborder=\"0\" onload=\"setContent('" + sTarget + "', this.contentWindow.document.body.innerHTML);\"></iframe>");
			}
		}
	}
}


//Check
var Check = new Object();

Check.String = function(sValue) {

	var bReturn = false;

	if ((sValue && sValue != "") || sValue == "0") {
		bReturn = true;
	}

	return bReturn; 
}

Check.Float = function(sValue) {

	var bReturn = false;

	if (sValue || sValue == "0") {

		if (sValue.length != 0 && ! isNaN(sValue)) {
			bReturn = true;
		}
	}

	return bReturn; 
}

Check.Integer = function(sValue) {

	var bReturn = false;

	if (this.Float(sValue)) {

		if (parseInt(sValue) == parseFloat(sValue)) {
			bReturn = true;
		}
	}

	return bReturn; 
}

Check.ValidId = function(sValue) {

	var bReturn = false;

	if (this.Integer(sValue)) {

		if (parseInt(sValue) > 0) {
			bReturn = true;
		}
	}

	return bReturn; 
}

Check.Navigator = function(sNavigator) {

	var bReturn = false;
	var sAgent = navigator.userAgent.toLowerCase();

	switch (sNavigator) {

		case "msie":

			if (sAgent.indexOf("msie") > -1 && ! window.opera) {
				bReturn = true;
			}

			break;

		case "firefox":

			if (sAgent.indexOf("firefox") > -1 && ! window.opera) {
				bReturn = true;
			}

			break;
	}

	return bReturn;
}

Check.NavigatorVersion = function(sVersion) {

	var bReturn = false;
	var sAgent = navigator.userAgent.toLowerCase();
	var sAgentVersion = "";

	if (Check.Navigator("firefox")) {

		sAgentVersion = sAgent.substring(sAgent.lastIndexOf("/") + 1, sAgent.length);

		if (sAgentVersion == sVersion) {
			bReturn = true;
		}
	}
	else if (Check.Navigator("msie")) {

		sAgentVersion = sAgent.substring(sAgent.indexOf("msie ") + 5, sAgent.length);
		sAgentVersion = sAgentVersion.substring(0, sAgentVersion.indexOf(";"));

		if (sAgentVersion == sVersion) {
			bReturn = true;
		}
	}

	return bReturn;
}

function newPopup(surl,iwidth,iheight,sdetails)
{
	var iscreenheigth;
	var iscreenwidth;
	var ipositiontop;
	var ipositionleft;
	
	iscreenwidth = screen.availwidth;
	iscreenheigth = screen.availHeight;

	ipositiontop = ((iscreenheigth - iheight) / 2);
	ipositionleft = ((iscreenwidth - iwidth) / 2);

	if(sdetails == '')
	{
		window.open(surl, "title", "width=" + iwidth + ",height=" + iheight + ",top=" + ipositiontop + ",left=" + ipositionleft + ", resizable=yes");	
	}
	else
	{
		prs_details = ", " + sdetails;
		//window.open(surl, "title", "top=" + ipositiontop + ",left=" + ipositionleft + ", resizable=yes" + sdetails);
	}
}

function jumpToSite(param) {
	window.location.href = param;
}

function showDivInit() {

	hideDiv('divr39636;39635d');
	hideDiv('divr29876;39637d');
		
	hideDiv('divunten39636;39635d');
	hideDiv('divunten29876;39637d');
	hideDiv('divunten39634;32250d');
}
 function showDiv(name) { 
 	document.getElementById(name).style.display="block"; 
	if(name == "divr39636;39635d" || name == "divr29876;39637d") {
		document.getElementById('divinfo').style.display="block"; 
	} 
	if(name == "divunten39634;32250d") {
		document.getElementById('divinfo').style.display="none"; 
	}
 } 
 
 function hideDiv(name) { 
 	document.getElementById(name).style.display="none"; 
 }
 
