function NewWinForPrint(objpath)
{
	window.open(objpath,"_blank","toolbar=no,location=no,scrollbars=yes,resizable=no,width=800,height=700,top=0,left=0");
}

function NewWinIpix(objpath)
{
	window.open(objpath,"_blank","toolbar=no,location=no,scrollbars=auto,resizable=no,width=410,height=362,top=0,left=0");
}

function NewWinPrintformular(objpath)
{
	window.open(objpath,"_blank","toolbar=no,location=no,scrollbars=auto,resizable=no,width=410,height=390,top=0,left=0");
}

function relocate(adr) 
{
    if(adr!="")
    	newWindow = window.open(adr,'_blank');
}

function relocate2(adr) 
{
    if (adr != "")
	    newWindow = window.open(adr,'_self');
}

function openWindow( url, width, height )
{
	winname = "popup"
	var trails = "width=" + width + ",height=" + height + ",toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no";
	newWindow = window.open( url, winname, trails)
}


function CheckFlash(minVersion)
{
	var flashVersionMajor = swfobject.getFlashPlayerVersion().major;
	if(flashVersionMajor >= minVersion)
		return true;
	else
		return false;
}

function ShowFlash(id, flashpath, name, width, height, version, bgcolor, language, offerInstall, wmode, videoPath, videoPathLarge, defaulttype, defaulturl, xml_file, thumbnailWidth, thumbnailHeight, imageHeight)
{
    var redirectUrl = null;

	if(offerInstall)
		redirectUrl = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";		

	if(flashpath.indexOf("?")>-1)
	  flashpath += "&withoutAttach=true";
	else
	  flashpath += "?withoutAttach=true";

	var flashVars = {};	

	if(wmode.length>0)	
  	    flashVars["wmode"] = wmode;
    else
        flashVars["wmode"] = "transparent";

  	if(language.length>0)
  		flashVars["language"] = language;	

  	if(videoPath.length>0)
  		flashVars["video_url"] = videoPath;

  	if(videoPathLarge.length>0)
  		flashVars["video_url_large"] = videoPathLarge;

  	if(defaulttype.length>0)
      flashVars["defaulttype"] = defaulttype;

  	if(defaulturl.length>0)
      flashVars["defaulturl"] = defaulturl;

    if (xml_file.length > 0) {
      flashVars["xml_file"] = xml_file;//*** Testimonials ***
      flashVars["xmlurl"] = xml_file;//*** Flash PlayList ***
    }

    if (thumbnailWidth != null && thumbnailWidth.length > 0)
        flashVars["thumbnail_width"] = thumbnailWidth;

    if (thumbnailHeight != null && thumbnailHeight.length > 0)
        flashVars["thumbnail_height"] = thumbnailHeight;

    if (imageHeight != null && imageHeight.length > 0)
        flashVars["image_height"] = imageHeight;                

    flashpath = flashpath.replace(/&amp;/g, "&");

	swfobject.embedSWF(flashpath, id, width, height, version, redirectUrl, flashVars);
}

function openPopup(mypage, myname, w, h, scroll,toolbar) 
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var d = new Date();
	mypage += "&#38;ts=" + d.getYear() + d.getMonth() + d.getDate() + d.getHours() + d.getMinutes() + d.getSeconds() + d.getMilliseconds();
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=false,toolbar=' + toolbar;
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) 
	{ 
		win.window.focus(); 
	}
}

function OpenNoMenu(url, width, height)
{
	window.open(url, 'nomenu', 'width=' + width + ',height=' + height + ',resizable=yes,copyhistory=0,top='+(((screen.height-600)/2)-50) +',left='+(((screen.width-800)/2)-5) +',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no');
	return false;
} 

function sort_haendler()
{
		document.sorting.submit(); 
}

function edb_sort_haendler()
{
		document.selection.submit(); 
}

function cdb_sort_haendler()
{
		document.selection.submit(); 
}			

function addEntries()
{
	document.entries.submit();
}

function removeEntries()
{
	document.entries.submit();
}

function removeAllEntries()
{
	document.allentries.submit();
}

function clearSearchText()
{
  if(event.srcElement!=null && event.srcElement.value.length>0)
    event.srcElement.value = "";
}

function StartPositioning()
{
	try
	{
		if(window.innerHeight || document.body.clientHeight)
			document.inter = window.setInterval('SetPosition();',10);
	}
	catch(ex)
	{
	}
}

function StopPositioning()
{
  try
  {
    window.clearInterval(document.inter);
  }
  catch(ex)
  {
  }
}

function SetPosition()
{
  try
  {
		var enddiv = document.getElementById('enddiv');
		var icondiv = document.getElementById('icondiv');
		var iconheight = document.getElementById('iconenddiv').offsetTop - document.getElementById('iconstartdiv').offsetTop;
		var calcTop = 0;

		if(window.innerHeight)
			calcTop = window.innerHeight - iconheight + window.pageYOffset - 16;
		else
			calcTop = document.body.clientHeight - iconheight + document.body.scrollTop - 16;

		if(enddiv.offsetTop < calcTop)
			icondiv.style.top = calcTop;
		else
			icondiv.style.top = enddiv.offsetTop;
	}
	catch(ex)
	{
	}
}

function PrintPage() 
{
	if(self.print)
	{
		self.print();
	}       
	else if((navigator.appName.search("Microsoft") != -1) && (navigator.appVersion.search("4.0") != -1))
	{
		var OLECMDEXECOPT_PROMPTUSER = 1;
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6,2);
		WebBrowser1.outerHTML = '';
	}
	else 
	{
		alert("Ihr Browser kann leider nicht automatisch drucken. Bitte benutzen Sie STRG + P")
	}
}

function CheckFormItem(formName, elementName, elementValue, conditionElement)
{
	if(document.forms[formName]!=null && document.forms[formName].elements[elementName]!=null)
	{
		if(conditionElement==null || (document.forms[formName].elements[conditionElement]!=null && document.forms[formName].elements[conditionElement].value!=""))
		{
			for(var i=0; i<document.forms[formName].elements[elementName].length; i++)
			{
				if(elementValue==null || elementValue==document.forms[formName].elements[elementName][i].value)
					document.forms[formName].elements[elementName][i].checked=true;
			}
		}
	}
}

function ShowSpecialPopup()
{
	var divText = document.getElementById("specialpopup");
	if(divText!=null)
	{
    var index = document.cookie.indexOf("specialpopup=");
    if(index>=0)
			divText.style.display = "none";
	}
}

function mobileServiceCheckFieldsIn()
{
	var compulsoryFieldsIn=new Array();
	compulsoryFieldsIn[0]='stdIn0';
	compulsoryFieldsIn[1]='stdIn1';
	compulsoryFieldsIn[2]='stdIn3';
	compulsoryFieldsIn[3]='stdIn18';
	compulsoryFieldsIn[4]='extIn4';

	var checkOK=true;

	for (var i=0; i<compulsoryFieldsIn.length; i++)
	{
		var cfObj=document.getElementById(compulsoryFieldsIn[i]);
		if (cfObj!=null)
		{
			if (cfObj.type.toLowerCase()=='text')
			{
				if (cfObj.value.match(/^\s*$/)) checkOK=false;
			}
			else if (cfObj.type.toLowerCase()=='radio' || cfObj.type.toLowerCase()=='checkbox')
			{
				var tmpObj=document.getElementsByName(cfObj.name);
				var tmpCheck=false;
				for (var j=0; j<tmpObj.length; j++)
				{
					if (tmpObj[j].checked==true)
					{
						tmpCheck=true;
						break;
					}
				}
				checkOK=tmpCheck;
			}
			else if (cfObj.type.toLowerCase().indexOf('select')>=0)
			{
				if (compulsoryFieldsIn[i]=='stdIn12' && cfObj.selectedIndex==0)
					checkOK=false;
			}
		}
	
		if (!checkOK) 
			break;
	}
	
	if (checkOK)
	 document.getElementById('subscribe').submit();
	else 
		window.alert("Bitte fuellen Sie alle mit einem * markierten Felder aus.");
}
	
function mobileServiceCheckFieldsOut ()
{
	var checkOK=true;
	if (document.getElementById('stdOut3').value.match(/^\s*$/))
		checkOK=false;
	
	if (checkOK) 
		document.getElementById('unsubscribe').submit();
	else
	 window.alert('Bitte fuellen Sie das E-Mail Feld aus.');
}

function showBlock(id)
{
	var elem = document.getElementById(id);
	if(elem!=null)
	{
		elem.style.display = "block";
	}
}

function showInline(id)
{
	var elem = document.getElementById(id);
	if(elem!=null)
	{
		elem.style.display = "inline";
	}
}

function showNone(id)
{
	var elem = document.getElementById(id);
	if(elem!=null)
	{
		elem.style.display = "none";
	}
}

function onLoad1()
{
	showInline('showbackbutton');
	showInline('showbackbuttonTop');
}

function onLoad2()
{
	showInline('showbackbutton');
	showInline('showbackbuttonTop');	
}

function onLoad3()
{
	showInline('showbackbutton');
	showInline('showbackbuttonTop');	
}

function ZoomImageShow(containerDivID, imageDivID, zoomuri, title, subtitle)
{	
	var divContainer = document.getElementById(containerDivID)
	var divImage = document.getElementById(imageDivID)

	if(divContainer==null || divImage==null)
	{
		//alert("<div> \"" + containerDivID + "\" oder \"" + imageDivID + " nicht gefunden ");
		return;
	}

	divImage.innerHTML = "";
	
	var zoomImageElem = document.createElement("img");
	zoomImageElem.setAttribute("src", zoomuri);
	zoomImageElem.setAttribute("alt", title);
	var zoomImageSubtitle = document.getElementById("ZoomImageSubtitle");
	zoomImageSubtitle.innerHTML = subtitle;

	divImage.appendChild(zoomImageElem);
	
	divContainer.style.display = "block";
}

function ZoomImageHide(containerDivID)
{
	var divContainer = document.getElementById(containerDivID)
	
	if(divContainer==null)
		return;
		
	divContainer.style.display = "none";
}

function cp_CheckAll(nameForm, nameCheckbox, checked) 
{
    for (var i = 0; i < document.forms[nameForm].elements.length; i++)
    {
        var elem = document.forms[nameForm].elements[i];
        if (elem.name == nameCheckbox) 
        {
            elem.checked = checked;
        }
    }
}

function doubleConfirm(message1, message2)
{
    var ok = confirm(message1);
    if (ok)
    {
        ok = confirm(message2);
    }

    return ok;
}

function RotateImages(imageID, imageNumber, timerMilliSeconds, arrayVariable) 
{
    var image = document.getElementById(imageID);
    if (image != null) 
    {
        eval("var imageArray = " + arrayVariable);

        if (imageNumber >= imageArray.length) 
        {
            imageNumber = 0;
        }

        //alert(imageNumber + "\r\n" + imageArray[imageNumber].replace(/&amp;/g, "&"));

        image.src = imageArray[imageNumber].replace(/&amp;/g, "&");
        imageNumber++;

        window.setTimeout("RotateImages('" + imageID + "', " + imageNumber + ", " + timerMilliSeconds + ", '" + arrayVariable + "')", timerMilliSeconds);
    }
}

//*** Erzeugt eine Zufallsganzzahl, min & max sind als Werte möglich ***
function RandomNumber(min, max)
{
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

