/**
 * Set focus on the element of the given id.
 * 
 * @param id
 *            The id of the element to set focus on.
 */

jQuery.noConflict();

function showToolTips() {
	// see http://jquery.bassistance.de/tooltip/demo/
	jQuery('*').tooltip();
	// alert('hier');
}

function setFocus(id) {
	var element = document.getElementById(id);
	if (element && element.focus) {
		element.focus();
	}
}

function showTooltip(e, id) {
	
	var element = document.getElementById(e.form.id+":"+id);
	 //alert(e.form.id+":"+id);
	if (element.innerHTML != '') {
		element.style.visibility = 'visible';
		// Jean's code - please check louis
		var newWidth = element.innerHTML.length * 6;
		element.style.width = newWidth+6;
		
	}

}

function hideTooltip(e, id) {
	// alert('hide');
	var element = document.getElementById(e.form.id+":"+id);
	element.style.visibility = 'hidden';

}

/**
 * Set highlight on the elements of the given ids. It basically sets the
 * classname of the elements to 'highlight'. This require at least a CSS style
 * class '.highlight'.
 * 
 * @param ids
 *            The ids of the elements to be highlighted, comma separated.
 */
function setHighlight(ids) {
	var idsArray = ids.split(",");
	for ( var i = 0; i < idsArray.length; i++) {
		var element = document.getElementById(idsArray[i]);
		if (element) {
			element.className = 'invalidFillIn';
		}
	}
}
/**
 * 
 * Linking all the headings to the home page
 */
function homepage() {
	location.href = ('home.jsp?f=home');
}

function register() {
	location.href = ('registration.jsp?f=register');
}

function termsandconditions() {
	location.href = ('registration.jsp?z=1&f=help&p1=terms_and_conditions');
}

function registrationHelp() {
	/* location.href = ('registration.jsp?z=1&f=help&p1=registration_help'); */
	location.href = ('registration.jsp?z=1&f=help&p1=registration_help');
}

