/**
 * opens target in a popUp window (for service navigation)
 * @author Vietduc Nguyen (Vietduc.Nguyen@dmc.de)
 * @param width: width of window
 * @param height: height of window
 * @param URL: content of window
 */
function OpenPopUp(width,height,URL) {
	open(URL,"","width="+width+",height="+height+",resizable=yes, toolbar=no,locationbar=no,directories=no,scrollbars=yes,status=yes,menubar=no,resizable=no");
}

/**
 * Log in and pass "letzteSeite" (current location) to the log in process.
 */
function letzteSeiteSubmit() {
	$("#letzteSeiteForm input[name='letzteSeite']").val(window.location.href);
	$("#letzteSeiteForm").submit();
	return false;
}

/**
 * Blesses .nci_loginLetzteSeite links.
 */
function enableLoginLetzteSeite() {
	$('.nci_loginLetzteSeite').click(letzteSeiteSubmit);
}

/**
 * update Layercontent (for popups with formulars and validation)
 * @author Vietduc Nguyen (Vietduc.Nguyen@dmc.de)
 * @param containerID: id of container which will be replaced
 */
function updateLayerContent(containerID) {
	var container 	= $("#"+containerID); 
	var formEle		= $(container).find("form:first");
	var params 		= $(formEle).serializeArray();
	
	// make them queryable
	var queryParams = $.param(params);
	
	// post request
	var targetURL  	= $(formEle).attr('action');
	
	$.ajax({ 
		url: targetURL, 
		data: queryParams, 
		dataType: "html",
		success: function(layercontent){
			$(container).replaceWith( layercontent );
			$.layer.recalculatePosition();
		}
	});
}

