// JavaScript Document
function validateTel(source, args) {
	if(args.Value.length < 7) {
		source.errormessage = 'Die von Ihnen Angegebene Telefonnummer ist zu kurz';
		args.IsValid=false;
	}
	var allowedChars = new Array('0','1','2','3','4','5','6','7','8','9','+','-','/',' ','(',')');
	var myMatch = true;
	for(i=0; i<args.Value.length; i++) {
		myMatch = false;
		for (j=0; j<allowedChars.length; j++) {
			if (args.Value.substr(i,1) == allowedChars[j]) myMatch = true;
		}
		if (myMatch == false) {
			source.errormessage = 'Ihre Telefonnummer verwendet nicht erlaubte Zeichen';
			args.IsValid=false;
		}
	}
}
function doLoadFlash(parent, source, myWidth, myHeight) {
	if (document.getElementById(parent)) {
		var myFlashCode = '';
		if (!myWidth) var myWidth = 555;	
		if (!myHeight) var myHeight = 190;
		myFlashCode+='<object \n';
		myFlashCode+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
		myFlashCode+='codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \n';
		myFlashCode+='width="'+myWidth+'" \n';
		myFlashCode+='height="'+myHeight+'" \n';
		myFlashCode+='id="myflash" \n';
		myFlashCode+='align="middle"> \n';
		myFlashCode+='<param name="allowScriptAccess" value="sameDomain" /> \n';
		myFlashCode+='<param name="movie" value="'+source+'" /> \n';
		myFlashCode+='<param name="quality" value="high" /> \n';
		myFlashCode+='<param name="bgcolor" value="#ffffff" /> \n';
		myFlashCode+='<param name="wmode" value="transparent" /> \n';
		myFlashCode+='<embed \n';
		myFlashCode+='src="'+source+'" \n';
		myFlashCode+='wmode="transparent" \n';
		myFlashCode+='quality="high" \n';
		myFlashCode+='bgcolor="#ffffff" \n';
		myFlashCode+='width="'+myWidth+'" \n';
		myFlashCode+='height="'+myHeight+'" \n';
		myFlashCode+='name="unternehmen" \n';
		myFlashCode+='align="middle" \n';
		myFlashCode+='allowScriptAccess="sameDomain" \n';
		myFlashCode+='type="application/x-shockwave-flash" \n';
		myFlashCode+='pluginspage="http://www.macromedia.com/go/getflashplayer" /> \n';
		myFlashCode+='</object> \n';
		document.getElementById(parent).innerHTML=myFlashCode;
	}
}
function setToActive(host, aspect) {
	host.className+=' active'
}
function setToInActive(host) {
	host.className=host.className.substring(0, host.className.indexOf('active'));
}
function setAllChecks() {
	var checkSum = false;
	for (i=0; i<checkBoxes.length; i++) {
		checkSum += checkBoxes[i].checked;
	}
	if (checkSum == 0) {
		for (i=0; i<checkBoxes.length; i++) {
			checkBoxes[i].checked = true;
		}
	};
}

function measureImage(host, aspect) {
	if (host.offsetWidth/host.offsetHeight > aspect) {
		host.style.width = "100%";
		host.style.height = 'auto';
		host.style.marginTop = (host.parentNode.offsetHeight - host.offsetHeight -5)/2+"px";
	} else {
		host.style.height = "100%";
		host.style.width = 'auto';
	}
}
function checkCategory(DefaultCategory) {
	var Category = location.search;
	Category = (Category != '') ? Category.substring(1, Category.length) : DefaultCategory;
	
	if (document.getElementById('Eckdaten')) document.getElementById('Eckdaten').style.display='none';
	if (document.getElementById('Beschreibung')) document.getElementById('Beschreibung').style.display='none';
	if (document.getElementById('Bilder')) document.getElementById('Bilder').style.display='none';
	if (document.getElementById('Anfrage')) document.getElementById('Anfrage').style.display='none';
	if (document.getElementById('Empfehlen')) document.getElementById('Empfehlen').style.display='none';
	if (document.getElementById('Downloads')) document.getElementById('Downloads').style.display='none';
	
	if (document.getElementById(Category)) {
		document.getElementById(Category).style.display='block';
		document.getElementById(Category+'Link').className='active';
	}
}

