
function loadContent(elementSelector, sourceUrl){
	document.getElementById("personDetails").style.display = "block";	
	$(function()
		{
				reinitialiseScrollPane = function(){
		$(function(){$('#Scroller').jScrollPane({scrollbarWidth:6, scrollbarMargin:10});});
				}
				$("" + elementSelector + "").load(sourceUrl + "/index.html", reinitialiseScrollPane);			
		});	
	sIFR.activate(sifr);
}

function loadThickBox(elementSelector, sourceUrl){
	$(function()
	{
		 tb_show("", sourceUrl, "")
	});		
}


function require(fieldName,cachedError) {
	el = _CURRENT_FORM.elements[fieldName];

	// see if the field is an optionset
	if(el == null) {

		var descendants = _CURRENT_FORM.getElementsByTagName('*');

		el = $(fieldName);

		if(el == null)
			return true;

		if(Element.hasClassName(el, 'optionset')) {
			el.type = 'optionset';

			var options = el.getElementsByTagName('input');

			for(var i = 0; i < options.length; i++) {
				if(options[i].checked)
					if(el.value != null)
						el.value += ',' + options[i].value;
					else
						el.value = options[i].value;
			}
		}

	}


	if(el != null) {
		// Sets up radio and checkbox validation
		if(el.type == 'checkbox' || el.type == 'radio') {
			var set = el.checked;
		}//merged by nlou 23/08/2007, r#40674
		else if(el.type == 'select-one'){ 
			if(el.value == ''||el.value == '0'){ 
				var set = ''; 
			}else{ 
				var set = el.value; 
			} 
		}else{
			var set = el.value;
		}

		var baseEl;

		// Sometimes require events are triggered of
		// associative elements like labels ;-p
		if(el.type) {
			if(el.parentNode.className.indexOf('form') != -1) set = true;
			baseEl = el;

		} else {
			if(_CURRENT_FORM.elements[fieldName]) {
			//Some elements are nested and need to be "got"
				var i, hasValue = false;
				if(_CURRENT_FORM.elements[fieldName].length > 1) {
					for(i=0; i < el.length; i++) {
						if(el[i].checked && el[i].value) {
							hasValue = true;
							break;
						}
					}

					if(hasValue) set = true;
					else set = "";
					baseEl = el[0].parentNode.parentNode;

				} else {
					set = "";
					baseEl = el.parentNode;
				}

			} else {
				set = true;
			}
		}

		// This checks to see if the input has a value, and the field is not a readonly.
		if( ( typeof set == 'undefined' || (typeof(set) == 'string' && set.match(/^\s*$/)) ) ) {
			//fieldgroup validation
			var fieldLabel = findParentLabel(baseEl);
			var errorMessage ="";
			// Some fields do-not have labels, in
			// which case we need a blank one
			if(fieldLabel == null || fieldLabel == "") {
				fieldlabel = "this field";
			}
			else
			{
				fieldlabel = fieldLabel;
			}
			var firstchar = fieldlabel.substr(0,1);
			firstchar = firstchar.toLowerCase();
			
			if(firstchar == "a" || firstchar =="e" || firstchar=="i" || firstchar =="o" || firstchar=="u")
			 errorMessage = "Please enter an \"$FieldLabel\".";
			else
			 errorMessage = "Please enter a \"$FieldLabel\".";
			
			if(baseEl.requiredErrorMsg) errorMessage = baseEl.requiredErrorMsg;
			else if(_CURRENT_FORM.requiredErrorMsg) errorMessage = _CURRENT_FORM.requiredErrorMsg;

			validationError(baseEl, errorMessage.replace('$FieldLabel', fieldLabel),"required",cachedError);
			return false;

		} else {
			if(!hasHadFormError()) {
				clearErrorMessage(baseEl.parentNode);
			}
			return true;
		}
	}

	return true;
}
