function objectWA(object) {
	document.write(object);
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function mousePos(e) {
	var x = (document.all) ? window.event.x + document.documentElement.scrollLeft : e.pageX;
	var y = (document.all) ? window.event.y + document.documentElement.scrollTop  : e.pageY;
	if (toolTip != null) {
		toolTip.style.left = (x + 6) + "px";
		toolTip.style.top = (y + 18) + "px";
		if (toolTip.style.display != 'block') toolTip.style.display = 'block';
	}
}

function showImage(path, origin) {
  //alert(findPosX(document.getElementById(origin)));
  //alert(findPosY(document.getElementById(origin)));
	//document.documentElement.clientWidth
	var selects = document.getElementsByTagName('select');
	for (i=0;i<selects.length;i++) {
		selects[i].style.visibility = 'hidden';
	}
	var PH = document.getElementById('imagePlaceholder');
	PH.innerHTML = '<img src="'+path+'" onclick="hideImage();" style="display: block; cursor: pointer;" alt="" title="klicken Sie um das Bild zu schließen" /><img src="images/close_icon.gif" width="24" height="24" alt="" style="position: absolute; right: 0px; top: 0px; cursor: pointer;" title="klicken Sie um das Bild zu schließen" onclick="hideImage();" />';
	PH.style.left = '147px';
	PH.style.top = '168px';
	PH.style.border = '1px solid black';
	PH.style.display = 'block';
}

function hideImage() {
	var selects = document.getElementsByTagName('select');
	for (i=0;i<selects.length;i++) {
		selects[i].style.visibility = '';
	}
	var PH = document.getElementById('imagePlaceholder');
 	PH.style.display = 'none';
}

function checkKontaktForm() {
	var missingText = '';
	if (document.getElementById('kName').value == '') missingText += '- Your name\n';
	if (document.getElementById('kEmail').value == '') missingText += '- Your e-mail address\n';
	if (document.getElementById('kAnfrage').value == '') missingText += '- Your request\n';

	if (missingText != '') {
		missingText = 'Please fill out the following fields:\n\n' + missingText;
		alert(missingText);
		return false;
	} else {
		return true;
	}
}

function checkInfopostForm() {
	var missingText = '';
	if (document.getElementById('ipName').value == '') missingText += '- Your name\n';
	if (document.getElementById('ipStrasse').value == '') missingText += '- Your street\n';
	if (document.getElementById('ipPLZ').value == '') missingText += '- Your postal code\n';
	if (document.getElementById('ipOrt').value == '') missingText += '- Your city\n';

	if (missingText != '') {
		missingText = 'Please fill out the following fields:\n\n' + missingText;
		alert(missingText);
		return false;
	} else {
		return true;
	}
}

function checkCallbackForm() {
	var missingText = '';
	if (document.getElementById('cbName').value == '') missingText += '- Your name\n';
	if (document.getElementById('cbTel').value == '') missingText += '- Your telephonenumber\n';
	if (document.getElementById('cbDate').value == '') missingText += '- Your prefered call date:\n';
	if (document.getElementById('cbTime').value == '') missingText += '- Your prefered time\n';

	if (missingText != '') {
		missingText = 'Please fill out the following fields:\n\n' + missingText;
		alert(missingText);
		return false;
	} else {
		return true;
	}
}

function checkBuchungForm() {
	var missingText = '';
	if (document.getElementById('Firma').value == '') missingText += '- Your company\n';
	if (document.getElementById('Name').value == '') missingText += '- Your name\n';
	if (document.getElementById('Strasse_Hausnummer').value == '') missingText += '- Your street and housenumber\n';
	if (document.getElementById('Ort').value == '') missingText += '- Your city\n';
	if (document.getElementById('Land').value == '') missingText += '- Your country\n';
	if (document.getElementById('email').value == '') missingText += '- Your email address\n';
	if (document.getElementById('Hinweis').checked == false) missingText += '- please accept the conditions\n';

	if (missingText != '') {
		missingText = 'Please fill out the following fields:\n\n' + missingText;
		alert(missingText);
		return false;
	} else {
		return true;
	}
}

function new_win(target, width, height, wname) {
  var wc;
  wc = "status=0,scrollbars=1,resizable=1,width=" + width + ",height=" + height;
  var win = window.open(target, wname, wc);
}

function showTOInfo(id) {
 	toolTip = document.getElementById('toolTip');
	var title = '';
	switch (id) {
		case 'ts_arena':
		  title = 'Arena Trier';
		  break;
		case 'ts_messepark':
		  title = 'Messepark Trier';
		  break;
		case 'ts_europahalle':
		  title = 'Europahalle Trier';
		  break;
		case 'ts_uni':
		  title = 'Uni Trier';
		  break;
		case 'ts_fh':
		  title = 'FH Trier';
		  break;
		case 'ts_ihk':
		  title = 'IHK Tagungszentrum';
		  break;
		case 'ts_era':
		  title = 'ERA Congress Centre';
		  break;
		case 'ts_casino':
		  title = 'Bürgersaal im Casino';
		  break;
		case 'ts_sportakademie':
		  title = 'Europ. Sportakademie';
		  break;
		case 'th_robertschuman':
		  title = 'Robert-Schuman-Haus';
		  break;
		case 'th_nh':
		  title = 'NH Hotel';
		  break;
		case 'th_parkplaza':
		  title = 'Park Plaza Trier';
		  break;
		case 'th_mercureporta':
		  title = 'Mercure Porta Nigra';
		  break;
		case 'th_deutscherhof':
		  title = 'Hotel Deutscher Hof';
		  break;
		case 'th_penta':
		  title = 'penta hotel trier-europahalle';
		  break;
		case 'th_goldentulip':
		  title = 'Golden Tulip Hotel';
		  break;
		case 'th_nellspark':
		  title = 'Nells Park Hotel';
		  break;
		case 'ht_kunstakademie':
		  title = 'Europ. Kunstakademie';
		  break;
		case 'ht_viehmarktthermen':
		  title = 'Viehmarktthermen';
		  break;
		case 'ht_orangerie':
		  title = 'Orangerie im Nells Park';
		  break;
		case 'ht_palais':
		  title = 'Kurfürstliches Palais';
		  break;
		case 'ht_landesmuseum':
		  title = 'Landesmuseum';
		  break;
	}
	toolTip.innerHTML = title;
}

function hideTOInfo() {
	toolTip.innerHTML = '';
	toolTip.style.display = 'none';
	toolTip = null;
}

function loadVid(vid) {
	if (vid > 24)
		top.VideoFrame.location.href = 'http://www.trier-info.de/video/play.php?vid='+vid+'&lang=en&tagungen=2';
	else
		top.VideoFrame.location.href = 'http://www.trier-info.de/video/play.php?vid='+vid+'&lang=en&tagungen=1';
}

toolTip = null;
document.onmousemove = mousePos;