


/**
 * ermittelt den keycode des entsprechenden Keyboard-Events
 */
function getKeyboardKey(e) {
	//IE
	if(!e && isIE) e = window.event;
	var asciiValue = e.which;
	if(!asciiValue) asciiValue = e.keyCode;

	return asciiValue;
}


/**
 * schickt eine Form ab, wenn das entsprechende Event e den KeyCode 13 (enter) aufweist
 * diese Form wird nur dann abgeschickt, wenn sie sich >>in der Startmaske<< befindet
 */
function submitViaEnterStart(e) {

	var frm = document.getElementsByName("myForm")[0];

	if(frm != null) {
		var keyCode = getKeyboardKey(e);
		if(keyCode == 13) {
			redirectToGeocode();
		}
	}

}




/**
 * schickt eine Form ab, wenn das entsprechende Event e den KeyCode 13 (enter) aufweist
 * diese Form wird nur dann abgeschickt, wenn sie sich >>unterhalb der Karte<< befindet
 */
function submitViaEnterMap(e) {

	var frm = document.getElementsByName("myForm")[0];

	if(frm != null) {
		var keyCode = getKeyboardKey(e);
		if(keyCode == 13) {
			redirectToGeocode();
		}
	}

}

/**
 *schickt eine Form ab oder leitet weiter zu einer anderen Seite
 *Dabei erfolgt diese Aktion im NEUEN Fenster
 */
function redirectToGeocode() {

	var frm = document.getElementsByName("myForm")[0];
	var ctriso = document.getElementsByName("CTRISO")[0];
	var val = ctriso.value;

	//neues fenster laden
	var newName = "mapwindow";
	var options = "width=1045,height=830,left=0,top=0,resizable=1,scrollbars=1,status=1";
	var targetWindow = window.open("", newName, options);
	targetWindow.focus();

	frm.target = newName;
	frm.action = "a_geocoder30.php5";
	frm.submit();
}





function setToolbarFunctions( htmlCall ) {

	var linkPrint = document.getElementById('link_print');
	if( linkPrint != null ) {

		linkPrint.onclick = function() {


			//neues fenster laden
			var newName = "htmlwindow";
			if(this.name == "htmlwindow") newName = "_blank";
			var options = "width=1045,height=830,left=0,top=0,resizable=1,scrollbars=1,status=1,menubar=1,location=1,toolbar=1,directories=1";
			var targetWindow = window.open("html/nextdoor.php5" + getParamsForHtmlView("PRINT"), newName, options);
			targetWindow.focus();


		}

	}


	var linkMail = document.getElementById('link_mail');
	if( linkMail != null ) {

		/**
		 * mailFormParams
		 */
		mailForm = null;
		linkMail.onclick = function(e) {

			if( mailFormParams != null ) {

				try {
					if( mailForm == null ) mailForm = new MailForm(mailFormParams);

				} catch(e) {

					mailForm = new MailForm(mailFormParams);

				}

				//-- pdf call setzen
				mailForm.setHtmlCall( WGGHtmlUtils.buildURLFromCurrentPath( htmlCall + getParamsForHtmlView("MAIL") + "&PURPOSE=MAIL" ) );

				//-- form anzeigen
				mailForm.setVisible( true );

				var pos = WGGGUIUtils.getClientCoordinates( ((!e) ? window.event : e) );

				mailForm.setPosition( pos.x, pos.y );
				//mailForm.setPosition( 163, 394 );
				//mailForm.setPosition( 710,168 );

			}

		}

	}

}



function setToolbarFunctionsPrintPage() {

	var linkPrint = document.getElementById('link_print');
	if( linkPrint != null ) {

		linkPrint.onclick = function() {

			window.print();

		}

	}

}



function showInputForm(clickObj, id, lngText) {
	var obj = document.getElementById(id);
	if(obj==null) return;
	if(obj.tagName != "DIV") return;

	var visibility = obj.style.visibility;
	clickObj.innerHTML = lngText;


	if(visibility == "hidden") {
		obj.style.visibility = "visible";
	} else {
		obj.style.visibility = "hidden";
	}
}

function sendFeedback(url){

	window.open(url,ILngSource.lng_feedback,"width=745,height=929,left=0,top=0,resizable=0,scrollbars=0,status=1,menubar=0,location=0,toolbar=0,directories=0");

}



