// item-6332 - reordering of "all" in relocate select boxes
function reorderRelocateSelect(el, preserveSelection) {
	var select;
	
	if (!el) return false;
	
	el = $(el), select = el.next("select[name^=relocateLocale]");
	
	if (select.children().length > 1) {	
		// remove "all" option and reappend to bottom
		select.find("option[value=0]").remove().appendTo(select);

		// add 'Select region' option
		$("<option/>").val("").text(iCity_value[0][0]).prependTo(select);

		// select the (new) first item in the list
		if (!preserveSelection) select.attr("selectedIndex", 0);
	}
	
}

/* open close div javascript function Used by DB - IP  REMOVE ON GO LIVE */
	function toggleSectionVisibility(sectionName){

    	// toggle the visibility of the html content

        toggleDisplay(document.getElementById(sectionName));

    }

	

    /* toggles the display property of a particular object in the page */

    function toggleDisplay(objectId) {

		//alert(objectId.style.display);

        if ( objectId.style.display == 'block' ){

            objectId.style.display = 'none';

        } else {

            objectId.style.display = 'block';

        }

    }

	

	function toggleArrow(whichOne) {

        if(document.getElementById('notesDropDownArrow'  + whichOne).className == 'noteOpen') {

			document.getElementById('notesDropDownArrow' + whichOne).className = 'noteClosed';

		} else {

			document.getElementById('notesDropDownArrow' + whichOne).className = 'noteOpen';

		}

    }
/* END open close div javascript function Used by DB - IP  REMOVE ON GO LIVE */

function toggleLayer(whichLayer) {
	if (document.getElementById) {
		if (!document.getElementById(whichLayer)) {return false;}
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display == 'block'? "none":"block";
	}
	else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display == 'block'? "none":"block";
	}
	else if (document.layers) {
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display == 'block'? "none":"block";
	}
}

// check whether the textField is with empty value
function isEmpty(fieldName) {
	if ((fieldName == null) || (fieldName.length == 0)) {
		return true;
	}
	else {	return false;	}
}

/* emergency e-mail validator which allows apostrophes */
function isValidEmail(email, required) {
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            return false;
        }
        return true;
    }
    if (email.length==0) {  
        if (required) {
            return false;
        }
        return true;
    }
    if (! allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        return false;
    } else if (email.indexOf("..") >= 0) { // two periods in a row is not valid
	return false;
    } else if (email.indexOf(".") == email.length) {  // . must not be the last character
	return false;
    }
    return true;
}

function allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_&'";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}
/* emergency e-mail validator which allows apostrophes */

//function to open a pop up window
function popupURL(url,winWidth,winHeight,resizable) {
	if(winWidth == null){winWidth = '530';}
	if(winHeight == null){winHeight = '600';}
	if(resizable == null){resizable = 'yes';}
	myWindow=window.open(url,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=' + resizable + ',copyhistory=yes,width=' + winWidth + ',height=' + winHeight);
	myWindow.focus();
}

function submitForm(formName, actionPage){
	// Adjust the action page
	if(actionPage){
		document[formName].action = actionPage;
	}
	document[formName].submit();
}

function toggleLayerOn(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "block";
	}
	else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "block";
	}
	else if (document.layers) {
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "block";
	}
}
function toggleLayerOff(whichLayer) {
	if (document.getElementById) {
		// this is the way the standards work
		if (!document.getElementById(whichLayer)) {return false;}
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "none";
	}
	else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "none";
	}
	else if (document.layers) {
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "none";
	}
}

function checkEmail(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(str)){ return true; }
	return false;
}

function populateSelectBox(selectBoxObj,optionsValueArray,optionsIdArray){
	selectBoxObj.length = optionsValueArray.length;
	for(var i=0; i < optionsValueArray.length; i++){
		selectBoxObj.options[i] = new Option(optionsValueArray[i],optionsIdArray[i]);
	}
}

function setSelectBoxDefault(selectBoxObj,defaultArray){
	//alert(selectBoxObj + ', ' + defaultArray);
	//Loop over the array of selected items
	for(var i = 0; i < defaultArray.length; i++){
		var thisSelection = defaultArray[i];
		//alert('thisSelection = ' + thisSelection);
		//Loop over all items in the list and see if any value matches thisSelection
		for(var j = 0; j < selectBoxObj.length; j++){
			if(selectBoxObj.options[j].value == thisSelection){
				selectBoxObj.options[j].selected = true;
				break;
			}
		}
	}
}

function trim(myString)
{
	myString=myString.replace(/^\s*(.*)/, "$1");
	myString=myString.replace(/(.*?)\s*$/, "$1");
	return myString;
}

/*
Function Name:	doCount
Description:	Requires 3 inputs. Counts the number of words in a form textarea.
*/
function doCount(formField, formFieldWordCounter, wordLimit)	{
	var wordArray = formField.value.split(/\s+/g);	// split on spaces to put words into an array, thus getting number of words
	formFieldWordCounter.value = wordLimit - wordArray.length;
	var warningName = formField.name + "WordWarning";

	if(wordArray.length > wordLimit)	{			// word limit exceeded
		document.getElementById(warningName).style.visibility = "visible";	// display warning message
	}
	else{
		document.getElementById(warningName).style.visibility = "hidden";	// hide warning message
	}
}

function doCountUsingInnerHtml(formField, divID, formFieldWordCounter, wordLimit)	{
	var wordArray = formField.value.split(/\s+/g);	// split on spaces to put words into an array, thus getting number of words
	document.getElementById(divID).innerHTML = wordLimit - wordArray.length;
	formFieldWordCounter.value = wordLimit - wordArray.length;
	var warningName = formField.name + "WordWarning";

	if(wordArray.length > wordLimit)	{			// word limit exceeded
		document.getElementById(warningName).style.visibility = "visible";	// display warning message
	}
	else{
		document.getElementById(warningName).style.visibility = "hidden";	// hide warning message
	}
}

Array.find = function(ary, element){
    for(var i=0; i<ary.length; i++){
        if(ary[i] == element){
            return i;
        }
    }
    return -1;
}



/* ********************************************************************************************************
BEGIN : FUNCTIONS TO FIND NUMBER OF CITITES FOR A COUNTRYID PASSED
At the moment the countCitiesForCountry function is used by v2/js/coldfusionJs/jobApplyValidationJS.cfm
* Note: It uses the iCountry_id and iCity_id arrays which is generated 
by v2/includes/locationAndSectorJavascript.cfm in v2/views/wrappers/contentwrapper.cfm
Added by Gitesh on 17-April-2008 to fix the problem related to ticket4230
********************************************************************************************************* */
function countCitiesForCountry(countryId) {
	//Default values if countryId is not passed
	var countryID = 0;
	var numberOfCities = 0;
	for(i=0; i <= iCountry_id.length; i++)	{
		// checks if the passed country id is matched with the one of the value in iCountry_id array
		if(iCountry_id[i] == countryId)	{
			if(iCity_id[i].length > 1) {
				numberOfCities = iCity_id[i].length;
				break;
			}	
			else	{
				numberOfCities = 0;
				break;
			}	
		}
	}	
	return numberOfCities;
}
/* ********************************************************************************************************
 END : FUNCTIONS TO FIND NUMBER OF CITITES FOR A COUNTRYID PASSED
********************************************************************************************************* */


/* sg stuff - hacks that go here will eventually be cleaned and moved to static.efinancialcareers */
if (typeof jQuery != "undefined") {
	$(function () {

		// auto focus username input on login/register pages
		var el = $("#efcHolder #efcContent #efcSiteLayoutT42.loginOrRegister #efcContentLayoutMiddleCol2 #userLoginMod input#username1,#efcHolder #efcContent #efcSiteLayoutT33.jobApplyLoginOrRegister #efcContentLayoutMiddleCol2 #jobViewLoginMod input#username").focus()
	
	})
}



 $(document).ready(function() {

	// item-6332 - reordering of "all" in relocate select boxes
	if ($("div#divRelationOptions select#relocateCountry1").length) {
		$("select[name^=relocateCountry]").each(function () {
			var el = $(this), region = el.next("select[name^=relocateLocale]");

			reorderRelocateSelect(this, true);	// 2nd param indicates this is being called from page startup (preserve 'all' selections)
		});
	}
	

  	/* FUCTION ON CLICK OPEN A NEW WINDOW (Privace Policy / Sample)
 	 * substitution onclick="window.open
	************************************/
	$("a[rel='pop-up']").click(function () {
  		    var features = "width=690, height=656,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no";
  		    newwindow=window.open(this.href, 'Preview', features);
  		    return false;
		});	
		
 	/* FUCTION ON CLICK JOBSEARCH BUTTON
 	 * substitution href="javascript:finaliseSearch(document.jobsearch);"
	************************************/
	$("div.homepage a#JobSearchBtn, div.jobs a#JobSearchBtn").click(function () { 
	  finaliseSearch(document.jobsearch);
	  return false;
    });
	
	/* FUNCTION ONSUBMIT form JOBSEARCH
	 * substitution onsubmit="finaliseSearch(this);"
	 * Is it happens at some point?...we don't have submit button in the form or any onsubmit event.
	 ************************************/		
	$('div.homepage #formJobSearch').submit(function() {
		finaliseSearch(this);
	});	
	
 	/* FUCTION ON CLICK CHANGE COUNTRY 
 	 * substitution href="javascript:toggleLayer('countryPickerPanel');toggleLayerOff('currentCountry');"
	************************************/	
	$("#currentCountry a.selectCountry").click(function () { 
	  toggleLayer('countryPickerPanel');
	  toggleLayerOff('currentCountry');
	  return false;
    });
	
 	/* FUCTION ON CLICK CLOSE SELECTION COUNTRIES 
 	 * substitution href="javascript:toggleLayer('countryPickerPanel');toggleLayerOn('currentCountry');"
	************************************/	
	$("#countryPickerPanel a.selectCountry").click(function () { 
	  toggleLayer('countryPickerPanel');
	  toggleLayerOn('currentCountry');
	  return false;
    });
	
	/* FUNCTION ONCLICK JOBSEARCH KEYWORD TEXTBOX 
	 * substitution onclick="if(this.value == '#request.objTranslation.getById(3515,request.translationId,request)#') this.value = '';"
	 ************************************/
	var textBoxKeyword = $('.homepage .searchContainer input#keyword').val(); 
	$(".searchContainer input#keyword").click(function () { 	
	  if ($('.searchContainer input#keyword').val() == textBoxKeyword ) {
	  	$('.searchContainer input#keyword').val('');
	  };
    });	
	
	/* FUNCTION ONCHANGE JOBSEARCH SELECT COUNTRY 
	 * substitution onChange="if(this.value != 39) {updateSelectBoxLocation(this.form.iCity,this.selectedIndex);}isUSSelected(this.value);"
	 ************************************/
	$(".searchContainer select.form180select[name=iCountry]").change(function () { 	/* USA */
		if (this.value != 39){
			updateSelectBoxLocation(this.form.iCity,this.selectedIndex);
		}
		isUSSelected(this.value);
    });	
	$("form#formJobSearch select.location").change(function () { 	/* NO USA */
		updateSelectBoxLocation(this.form.iCity,this.selectedIndex);
    });
	
	/* FUNCTION ONKEYUP, ONFOCUS & ONBLUR JOBSEARCH City & State or Zip
	 * substitution onkeyup="bHasFocusFreetext=true; iAjaxElem = -1; objAjaxElem = this;" 
	 * 		onfocus="if(this.value == '#request.objTranslation.getById(3737,request.translationId,request)#') this.value = ''; bHasFocusFreetext=true; iAjaxElem = -1; objAjaxElem = this;" 
	 * 		onblur="bHasFocusFreetext=false; if(this.value == '') this.value = '#attributes.sRadiusLocation#';"
	 ************************************/	
	$("#JobSearch_US input#idRadiusLocation").keyup(function () { 	
		bHasFocusFreetext=true;
		iAjaxElem = -1;
		objAjaxElem = this;
    });		
	var HometextBoxCitystate = $('#JobSearch_US input#idRadiusLocation').val(); //Initial value textbox
	$("#JobSearch_US input#idRadiusLocation").focus(function () { 
		if ($('#JobSearch_US input#idRadiusLocation').val() == HometextBoxCitystate){
			$('#JobSearch_US input#idRadiusLocation').val('')
		}
		bHasFocusFreetext=true;
		iAjaxElem = -1;
		objAjaxElem = this;
    });		
	$("#JobSearch_US input#idRadiusLocation").blur(function () { 	
		bHasFocusFreetext=false;
		if ($('#JobSearch_US input#idRadiusLocation').val() == ''){
			$('#JobSearch_US input#idRadiusLocation').val(HometextBoxCitystate)
		}
    });	
	
	/* FUNCTION ONCLICK Location Choices JOBSEARCH
	 * substitution of onclick="doSetValue(formName.sRadiusLocation, -1, this.options[this.selectedIndex].value);"
	 ************************************/	
	$("#JobSearch_US select#idLocationChoices").click(function () { 
		doSetValue(formName.sRadiusLocation, -1, this.options[this.selectedIndex].value);
    });		 
	
/* **************************************************
 BEGIN : FUNCTIONS TO CONTROL THE TOP HORIZONTAL NAV
*************************************************** */

var ddtgt = 'dropdown'

$('li.'+ddtgt).mouseover(function() {$(this).children('ul').show();});

$('li.'+ddtgt).mouseout(function() {$(this).children('ul').hide();});

$('li.'+ddtgt+' ul').mouseover(function() {$(this).show();});

$('li.'+ddtgt+' ul').mouseout(function() {$(this).hide();});
	
/* *************************************************
 END : FUNCTIONS TO CONTROL THE TOP HORIZONTAL NAV
************************************************** */



 
  	/* FUCTION ON CLICK OPEN A NEW WINDOW JOB NEWS & VIEWS (Email the editor)
 	 * substitution onclick="popupURL
	************************************/
	$("a[rel='email-editor']").click(function () {
  		    var features = "width=530, height=450,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no";
  		    newwindow=window.open(this.href, 'eFC', features);
  		    return false;
	});

  	/* FUCTION ON CLICK JOB NEWS & VIEWS (Pop-Up Close & Send Buttons)
 	 * substitution href="javascript: checkSuggestForm();" & href="javascript: window.close();"
	************************************/
	$("a#PopUpEmailEditorSend").click(function () {
		checkSuggestForm();
		return false;
	});
	$("a#PopUpEmailEditorClose").click(function () {
		window.close();
		return false;
	});

  	/* FUCTION ON CLICK JOB NEWS & VIEWS (Tab-Nav Latest-MostPopular)
 	 * substitution href="Javascript:toggleLayerOff('LatestDiv');toggleLayerOn('mostPopularDiv');" &
 	 * 				href="Javascript:toggleLayerOff('mostPopularDiv');toggleLayerOn('LatestDiv');"
	************************************/
	$("div.NewsAndViews div#LatestDiv li#tabCtrl02 a").click(function () {
		toggleLayerOff('LatestDiv');
		toggleLayerOn('mostPopularDiv');
		return false;
	});
	$("div.NewsAndViews div#mostPopularDiv li#tabCtrl02 a").click(function () {
		toggleLayerOff('mostPopularDiv');
		toggleLayerOn('LatestDiv');
		return false;
	});
 
 	/* FUNCTION ONCLICK Jobseekers registration
	 * substitution onclick="doSetValue(formName.sRadiusLocation, -1, this.options[this.selectedIndex].value);"
	 ************************************/	
	$("span.select1 select#idLocationChoices").click(function () { 
		doSetValue(formName.sRadiusLocation, -1, this.options[this.selectedIndex].value);
    });	
	
	/* FUNCTION ONKEYUP, ONFOCUS & ONBLUR Jobseekeers registration City & State or Zip
	 * substitution onkeyup="bHasFocusFreetext=true; iAjaxElem = -1; objAjaxElem = this;"
	 * 		onfocus="if(this.value == '#request.objTranslation.getById(3737,request.translationId,request)#') this.value = ''; bHasFocusFreetext=true; iAjaxElem = -1; objAjaxElem = this;"  
	 * 		onblur="bHasFocusFreetext=false; if(this.value == '') this.value = '#request.objTranslation.getById(3737,request.translationId,request)#';")
	 ************************************/	
	$("div#idUSLocationRow input#idRadiusLocation").keyup(function () { 	
		bHasFocusFreetext=true;
		iAjaxElem = -1;
		objAjaxElem = this;
    });	
	var textBoxCitystate = $('div#idUSLocationRow input#idRadiusLocation').val(); //Initial value textbox
	$("div#idUSLocationRow input#idRadiusLocation").focus(function () { 
		if ($('div#idUSLocationRow input#idRadiusLocation').val == textBoxCitystate) {
			$('div#idUSLocationRow input#idRadiusLocation').val('');
		}
		bHasFocusFreetext=true;
		iAjaxElem = -1;
		objAjaxElem = this;
    });		
	$("div#idUSLocationRow input#idRadiusLocation").blur(function () { 	
		bHasFocusFreetext=false;
		if ($('div#idUSLocationRow input#idRadiusLocation').val() == ''){
			$('div#idUSLocationRow input#idRadiusLocation').val(textBoxCitystate);
		}
    });	

	/* FUNCTION ONCLICK Jobseekers registration
	 * substitution onclick="window.history.go(-1);" 
	 ************************************/	
 	$("div#registrationSubmits button.efcButtonCancel").click(function () { 
		window.history.go(-1);
    });	

	/* FUNCTION ONCLICK Jobseekers registration
	 * substitution onclick="this.form.pageAction.value='registerComplete';"
	 ************************************/		
 	$("div#registrationSubmits button.efcButtonAction").click(function () { 
		this.form.pageAction.value='registerComplete';
    });	
	
	/* FUNCTION ONCLICK Jobseekers registration
	 * substitution onChange="if(this.value != 39) {updateSelectBoxLocation(document.#attributes.sRegisterFormName#.city,this.selectedIndex);}isUSSelected(this.value);"
	 ************************************/
 	$("form[name=myEfcRegisterForm] div#JobSearch_US select.shortened").change(function () { 
		var docRef = eFC.data.efcRegisterForm, docElem = $("form[name=" + docRef + "]");
		if(this.value != 39) {
			updateSelectBoxLocation(docElem.find("[name=city]")[0], this.selectedIndex);
			}
		isUSSelected(this.value);	
    });

 	/* FUNCTION ONCLICK Answers Page Form
	 * substitution href="javascript: document.formNewsSearch.submit();" class="btn btnBlueOnWhite"
	 ************************************/
	$('a#NewsSearchBtn').click(function() {
	  if (eFC.data.efcIdAnswersForm == undefined) {
		$(this).closest('form').submit();
	  } else {
	  	var IdForm = "document." + eFC.data.efcIdAnswersForm;
	  	eval(IdForm).submit();
	  }
	  return false;
	});

	/* FUNCTION ONSUBMIT Answers Page Form
	 * substitution onSubmit="return validateNewsSearchForm(this);"
	 ************************************/	
	 $('form#formNewsSearch').submit(function() {
	   validateNewsSearchForm(this);
	   return;
	 });

	/* FUNCTION ONCLICK Answers Page Form
	 * substitution href="javascript:validateQuestionForm();"
	 ************************************/		
	$('a#NewsPostBtn').click(function() {	
		validateQuestionForm();
		return false;
	});	 

	/* FUNCTION ONCLICK Answers Page Form
	 * substitution href="Javascript:toggleLayerOff('openQuestionsDiv');toggleLayerOn('resolvedQuestionsDiv');
	 * 				href="Javascript:toggleLayerOff('resolvedQuestionsDiv');toggleLayerOn('openQuestionsDiv');
	 ************************************/	 
	$('div.answersHomepage div#openQuestionsDiv ul li#tabCtrl02 a').click(function() {	
		toggleLayerOff('openQuestionsDiv');
		toggleLayerOn('resolvedQuestionsDiv');
		return false;
	});	
	$('div.answersHomepage div#resolvedQuestionsDiv ul li#tabCtrl02 a').click(function() {	
		toggleLayerOff('resolvedQuestionsDiv');
		toggleLayerOn('openQuestionsDiv');
		return false;
	});
 
  	/* FUCTION ON CLICK OPEN A NEW WINDOW Answers Page Detail
 	 * substitution onClick="popupURL('http://#request.newsUrl#/newsArticleEmailFriend.htm/pageAction-newsArticleEmailFriend-subSectionName-#attributes.sPageAction#-id-#attributes.iItemId#',winWidth='530',winHeight='420',resizable='no');return false;"
	************************************/
	$("a[rel='send-popup']").click(function () {
  		    var features = "width=530, height=485,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no";
  		    newwindow=window.open(this.href, 'eFC', features);
  		    return false;
	});	

 	/* FUCTION ONCLICK Answers Page Detail (Alert moderator link)
 	 * substitution href="javascript: alertModerator_OnClick('http://#request.newsUrl#/formhandler.cfm','#attributes.alertType#','#attributes.answerId#');"
 	 * getting the variables using eFC.data and DOM because of the loop.
	************************************/
	$('div.commentPost a.alertModerator').click(function() {	
		var data = $(this).siblings("dl"); answersIdAlertModerator = data.find("[title=answersId]").text();
		alertModerator_OnClick(eFC.data.efcUrlAlertModerator,eFC.data.efcAlertTypeModerator,answersIdAlertModerator);
		return false;
	});	 
	
 	/* FUCTION ON CLICK OPEN A NEW WINDOW Answers Page Detail (See disclaimer)
 	 * substitution onclick="JAVASCRIPT: popupURL('http://#request.newsUrl#/disclaimer',500,350,'yes')"
	************************************/
	$("a[rel='disclaimer-popup']").click(function () {
  		    var features = "width=500, height=350,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no";
  		    newwindow=window.open(this.href, 'eFC', features);
  		    return false;
	});		 

 	/* FUCTION ON CLICK Answers Page Detail (sign in / register)
 	 * substitution href="javascript:submitForm('#attributes.sFormName#', 'http://#request.newsUrl#/formHandler.cfm?actionTemplate=myAccount');
	************************************/
	$('p#verifyHelp span').click(function(){
		submitForm(eFC.data.efcFormName, eFC.data.efcNewsUrl);
	});

 	/* FUCTION ON CLICK Answers Page Detail (btn answere question)
 	 * substitution href="javascript: validateForm()"
	************************************/
	$('a#AnswerQuestionBtn').click(function(){
		validateForm();
		return false;
	})
	
  	/* FUCTION ON CLICK Answers Page Detail - Send to a friend (Pop-Up Close & Send Buttons)
 	 * substitution href="javascript:if(document.email.onsubmit()){document.email.submit();}" & onClick="Javascript:window.close();"
	************************************/
	$("a#AnswersDetailEmailFriendSend").click(function () {
		if(document.email.onsubmit()){
			document.email.submit();
		}
		return false;
	});
	$("a#AnswersDetailEmailFriendClose").click(function () {
		window.close();
		return false;
	});

  	/* FUCTION ON CLICK Answers Page Detail - Recommend Button
 	 * substitution <cfif len(request.functionToCall)>href="javascript:#request.functionToCall#;"</cfif> (javascript:displaySignInMessage();)
	************************************/
	$("div.commentPost a.btnRecommend").click(function () {
		var data = $(this).parents().siblings("dl"), answersId = data.find("[title=answersId]").text(), answersFunctionToCall = data.find("[title=answersFunctionsToCall]").text()
		eval(answersFunctionToCall);
		return false;
	});	
 
  	/* FUCTION ON CLICK OPEN A NEW WINDOW Join the debate (Suggest a debate)
 	 * substitution onClick="JAVASCRIPT: popupURL('http://<cfoutput>#request.newsUrl#</cfoutput>/suggestDebate',530,390,'yes')"
	************************************/
	$("a[rel='suggestDebate-popup']").click(function () {
  		    var features = "width=530, height=390,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no";
  		    newwindow=window.open(this.href, 'eFC', features);
  		    return false;
	});	
	
 	/* FUCTION ON CLICK Join the debate (Suggest a debate)
 	 * substitution href="javascript: checkVote('pollGlobalDebateForm');")
	************************************/
	$('a#VoteSeeBtn').click(function(){
		checkVote('pollGlobalDebateForm');
		return false;
	})	
	
	/* FUNCTION ONCLICK Debate Page Tab-Nav
	 * substitution href="javascript:toggleLayerOff('openPopularDiv');toggleLayerOn('resolvedQuestionsDiv');" 
	 * 				href="javascript:toggleLayerOff('resolvedQuestionsDiv');toggleLayerOn('openPopularDiv');" 
	 ************************************/	 
	$('div.debateHomepage div#openPopularDiv ul li#tabCtrl02 a').click(function() {	
		toggleLayerOff('openPopularDiv');
		toggleLayerOn('resolvedQuestionsDiv');
		return false;
	});	
	$('div.debateHomepage div#resolvedQuestionsDiv ul li#tabCtrl02 a').click(function() {	
		toggleLayerOff('resolvedQuestionsDiv');
		toggleLayerOn('openPopularDiv');
		return false;
	});
 
 	/* FUCTION ON CHANGE Company Search (Select Location)
 	 * substitution onchange="updateSelectBoxLocation_useURL(this.form.localeName,this.selectedIndex); document.#attributes.sSearchFormName#.localeName[0].text='#jsstringformat(request.objTranslation.getById(3486,request.translationId,request))#';"
	************************************/
	$('form#formCompanySearch select.location').change(function() {
		updateSelectBoxLocation_useURL(this.form.localeName,this.selectedIndex); eFC.data.efcFormNameCompanySearch='eFC.data.efcTextCities';
	});

 	/* FUCTION ON CLICK Company Search (Form search click)
 	 * substitution href="javascript:if(document.#attributes.sSearchFormName#.onsubmit()){document.#attributes.sSearchFormName#.submit();}")
	************************************/
	$('a#SearchCompaniesBtn').click(function(){
		if(document.formCompanySearch.onsubmit()){
			document.formCompanySearch.submit();
			}
		return false;
	})

 	/* FUCTION ON CLICK OPEN A NEW WINDOW MyEFC (Dashboard)
 	 * substitution onclick="popupURL('http://#request.siteUrl#/myEfc.htm/pageAction-help-helpId-resumeStats',winWidth='530',winHeight='450',resizable='no');return false;"
	************************************/
	$("a[rel='question-popup']").click(function () {
  		    var features = "width=530, height=450,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no";
  		    newwindow=window.open(this.href, 'eFC', features);
  		    return false;
	});
	

  	/* FUCTION ON CLICK My eFC (MyJobs - resumes - resumes radiobutton non-searchable)
 	 * substitution onClick="location='http://#request.siteUrl#/myEfc.htm/pageAction-hideAllResumes';"
	************************************/
	$('input#resumeSelectRadio').click(function(){
		window.location.replace(eFC.data.efcResumesRedirect);
	})
	
 	/* FUCTION ON CLICK My eFC (MyJobs - resumes - datadelete resumes)
 	 * substitution onClick="if (confirm('#request.objTranslation.getById(3967,request.translationId,request)#<!--- Are you sure you want to delete this resume? --->')){location='http://#request.siteUrl#/myEfc.htm/pageAction-resumeDelete-id-#attributes.objMyResumesDisplayBean.getid()#';}return false;"
	************************************/
	$('li.delete a#deleteMyResumes').click(function(){
	    if (confirm (eFC.data.efcTxtSureDelete)){
	        window.location.replace(eFC.data.efcDeleteRedirect);
	    }
	    return false;  
	})

 	/* FUCTION ON CHANGE My eFC (MyJobs - resumes - select contact details)
 	 * substitution onchange="location='http://#request.siteUrl#/myEfc.htm/pageAction-toggleAnonymity';"
	************************************/
	$("select[name='personalDetails']").change(function(){
        window.location.replace(eFC.data.efcSelectDisplayContactDetails);
	})
 
  	/* FUCTION ON CLICK My eFC (MyJobs - link export spreadsheet)
 	 * substitution href="javascript:doWriteCSV();")
	************************************/
	$('span.export a').click(function(){
        doWriteCSV();
	})
	
 	/* FUCTION ON CLICK My eFC (MyJobs - link add note)
 	 * substitution href="javascript:toggleSectionVisibility('updateNotes#attributes.objMyJobsDisplayBean.getId()#');toggleSectionVisibility('editNote#attributes.objMyJobsDisplayBean.getId()#'); toggleSectionVisibility('resumeListing#attributes.objMyJobsDisplayBean.getid()#'); ")
	************************************/
	$('ul.resumeTools li.edit a').click(function(){
        // Getting the specific value to pass to the function. There is a hidden semantic structure (<dl>) with the values
		var data = $(this).parents("li.edit").siblings("li.MyeFCjobsVariables"), value = data.find("[title=getId]").text();
		value = value.replace(/^\s*|\s*$/g,''); // Get rid off blank spaces on IE
		//console.log($(this).parents("li.edit").siblings("li.MyeFCjobsVariables"));
		//console.log("Value: ", value);
		toggleSectionVisibility('updateNotes' + value);
		toggleSectionVisibility('editNote'+ value); 
		toggleSectionVisibility('resumeListing' + value);
		return false;
	})
	
 	/* FUCTION ON CLICK My eFC (delete jobs)
 	 * substitution onclick="javascript:return confirmDelete('#attributes.orderby#','#attributes.objMyJobsDisplayBean.getId()#','#attributes.view#');"
	************************************/
	$('li.delete a#deleteMyJobs2').click(function(){
		// Getting the specific value to pass to the function. There is a hidden semantic structure (<dl>) with the values
		var data = $(this).parents("li.delete").siblings("li.MyeFCjobsVariables"), OrderBy = data.find("[title=efcOrderBy]").text(), getID = data.find("[title=getId]").text(), efcView = data.find("[title=efcView]").text();
		OrderBy = OrderBy.replace(/^\s*|\s*$/g,''); // Get rid off blank spaces on IE
		getID = getID.replace(/^\s*|\s*$/g,''); // Get rid off blank spaces on IE
		efcView = efcView.replace(/^\s*|\s*$/g,''); // Get rid off blank spaces on IE
		confirmDelete(OrderBy,getID,efcView);
		return false;
	})
	
 	/* FUCTION ON CLICK My eFC (save new note in saved job)
 	 * substitution href="javascript:saveNote(#attributes.objMyJobsDisplayBean.getid()#);"
	************************************/
	$('div.noteButtons a.SaveNoteClass').click(function(){
        // Getting the specific value to pass to the function. There is a hidden semantic structure (<dl>) with the values
		var data = $(this).parents('div.noteButtons').find('a.MyeFCjobsVariables'), value = data.find("[title=getId]").text();
		value = value.replace(/^\s*|\s*$/g,''); // Get rid off blank spaces on IE
		saveNote(value);
		return false;
	})
	
 	/* FUCTION ON CLICK My eFC (delete note in saved job)
 	 * substitution href="javascript:confirmAndDelete(#attributes.objMyJobsDisplayBean.getid()#);"
	************************************/
	$('div.noteButtons a.confirmAndDeleteClass').click(function(){
        // Getting the specific value to pass to the function. There is a hidden semantic structure (<dl>) with the values
		var data = $(this).parents('div.noteButtons').find('a.MyeFCjobsVariables'), value = data.find("[title=getId]").text();
		value = value.replace(/^\s*|\s*$/g,''); // Get rid off blank spaces on IE
		confirmAndDelete(value);
		return false;
	})

 	/* FUCTION ON CLICK My eFC (MySearch & Alerts - RadioButtons (daily...))
 	 * substitution onclick="document.form#attributes.searchesArray[searchNumber].searchAgentId#.submit();"
 	 * There is a new il in the code (Line 144) to get the id of each search/alert in the loop.
	************************************/
	$('input.dailyFreqClass,input.weeklyFreqClass,input.neverFreqClass').click(function(){
        var a1 = $(this).parent().parent();
		var a2 = a1.find("li.liSearchAgentId").text();
		var submitForm = "document.form" + a2 + ".submit()";
		eval(submitForm); // The eval() function evaluates and/or executes a string of JavaScript code.
	})

 	/* FUCTION ON CLICK My eFC (MySearch & Alerts - Delete Alert)
 	 * substitution onclick="javascript:return confirmDelete(#attributes.searchesArray[searchNumber].searchAgentId#);"
 	 * There is a new il in the code (Line 144) to get the id of each search/alert in the loop.
	************************************/
	$('ul.resumeTools li.delete a.deleteAlert').click(function(){
		var a1 = $(this).parent().prev().text();
		confirmDelete(a1);
		return false;
	})

 	/* FUCTION ON CLICK My eFC (my E-Newsletter - sample link)
 	 * substitution onclick="window.open('#attributes.objSubscriberService.getNewsLetterSampleFile(siteURL=request.siteURL, partnerid=request.partnerId, language=request.language)#','Preview', 'width=690, height=656,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')
	************************************/
	$("a[rel='sampleNewsletter-popup']").click(function () {
  		    var features = "width=690, height=656,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no";
  		    newwindow=window.open(this.href, 'eFC', features);
  		    return false;
	});
	
 	/* FUCTION ON CLICK My eFC (my E-Newsletter - each radiobutton in the section)
 	 * substitution onClick="#attributes.sFormSubmit#" - (check myNewsletter.cfm file, to known the variables)
	************************************/
	$('input#noNewsletter, input#yesreceiveEfcMessages, input#noreceiveEfcMessages, input#yesCompanies, input#noCompanies, input#htmlEmail, input#normalEmail').click(function(){
		var SubmitChoiseForm = "document." + eFC.data.efcFormSubmit + ".submit()";	
		eval(SubmitChoiseForm);
	})
	
 	/* FUCTION ON CLICK My eFC (my E-Newsletter - radiobutton YES NEWSLETTER)
 	 * substitution onClick="omnitureNewsLetterSignUp(this)" 
	************************************/	
	$('input#yesNewsletter').click(function(){
		var SubmitChoiseForm = "document." + eFC.data.efcFormSubmit + ".submit()";	
		eval(SubmitChoiseForm);
		omnitureNewsLetterSignUp(this);
	})
 
	/* FUCTION ON CHANGE My eFC My Account (select box country USA)
 	 * substitution onChange="updateSelectBoxLocation(document.#attributes.sFormName#.city,this.selectedIndex); isUSSelected(this.value);" 
	************************************/	
	$('form[name=subscriberDetail] div#JobSearch_US select.shortened').change(function(){
		updateSelectBoxLocation(document.subscriberDetail.city,this.selectedIndex);
		isUSSelected(this.value);
	})			

 	/* FUCTION ON CHANGE My eFC My Account (select box country non USA)
 	 * substitution onChange="updateSelectBoxLocation(document.#attributes.sFormName#.city,this.selectedIndex);"
	************************************/	
	$('form[name=subscriberDetail] select[name=country]').change(function(){
		updateSelectBoxLocation(document.subscriberDetail.city,this.selectedIndex);
	})	
	
 	/* FUCTION ON CHANGE My eFC My Account (select box Current Work Sector)
 	 * substitution onchange="updateSelectBoxSector(document.#attributes.sFormName#.currentRole,this.selectedIndex);"
	************************************/	
	$('form[name=subscriberDetail] select#sectorCurrent').change(function(){
		updateSelectBoxSector(document.subscriberDetail.currentRole,this.selectedIndex);
	})
	
 	/* FUCTION ON CLICK My eFC My Account (select box Current Work Sector)
 	 * substitution href="javascript:if(document.subscriberDetail.onsubmit()){document.subscriberDetail.submit();}"
	************************************/	
	$('div#yourDetailsAmend div.submitFormNavMod a#updateAccountBtn').click(function(){
		if(document.subscriberDetail.onsubmit()){
			document.subscriberDetail.submit();
		}
		return false;
	})	
	
 	/* FUCTION ON CLICK My eFC My Account & Resume / Preview / Edit your personal details (select box Current Work Sector)
 	 * substitution href="javascript:location.href='http://#request.siteURL#/myEfc.htm/pageAction-myAccount';")
	************************************/	
	$('div#yourDetailsAmend div.submitFormNavMod a#cancelUpdateAccountBtn').click(function(){
		var url = "http://" + eFC.data.efcSiteUrl + "/myEfc.htm/pageAction-myDashboard"
		url = url.replace(/^\s*|\s*$/g,''); // Get rid off blank spaces on IE
		window.location.replace(url);
		return false;
	})	
	
 	/* FUCTION ON CLICK My eFC My Account (pop up forgotten - edit login)
 	 * substitution href="javascript: popupURL('/efc/myEFC/myefc.htm/pageAction-forgottenPassword','530','450');")
	************************************/	
	$("a[rel='forgottenPassword-popup']").click(function () {
  		    var features = "width=530, height=450,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no";
  		    newwindow=window.open(this.href, 'eFC', features);
  		    return false;
	});
	
 	/* FUCTION ON CLICK My eFC My Account (link button Edit Login Details)
 	 * substitution href="javascript:toggleSectionVisibility('loginDetailsDisplay','loginDetailsAmend');"
	************************************/	
	$('a#EditLoginDetailsBtn').click(function(){
		toggleSectionVisibility('loginDetailsDisplay','loginDetailsAmend');
		return false;
	})			
	
 	/* FUCTION ON CLICK My eFC My Account (cancel button Edit Login Details)
 	 * substitution href="javascript:toggleSectionVisibility('loginDetailsAmend','loginDetailsDisplay');
	************************************/	
	$('a#cancelEditLoginDetailsBtn').click(function(){
		toggleSectionVisibility('loginDetailsAmend','loginDetailsDisplay');
		return false;
	})	
	
 	/* FUCTION ON CLICK My eFC My Account (update button on Edit Login)
 	 * substitution href="javascript: if(document.subscriberLoginDetail.onsubmit()){document.subscriberLoginDetail.submit();}"
	************************************/	
	$('a#updateEditLoginDetailsBtn').click(function(){
		if (document.subscriberLoginDetail.onsubmit()) {
			document.subscriberLoginDetail.submit();
			return false;
		}	
		return false;	
	}) 	
	
 	/* FUCTION ON CLICK My eFC My Account (Forgotten Login Details Pop-Up)
 	 * substitution href="Javascript:document.forgottenPassword.submit();"
	************************************/	
	$('a#PopUpForgotYourPasswordSend').click(function(){
		document.forgottenPassword.submit();
		return false;
	}) 

 	/* FUCTION ON CLICK Post your Resume (checkbox Do NOT display my contact details…)
 	 * substitution onclick="fnMakeUserAnonymous(this);"
	************************************/	
	$('div#resumeSearchableChoices input#isAnonymous').click(function(){
		fnMakeUserAnonymous(this);
	})	

	/* FUNCTION ONCHANGE Post your Resume (select box country)
	 * substitution onChange="updateSelectBoxLocation(document.#attributes.sFormName#.city,this.selectedIndex); isUSSelected(this.value); doShowHideElement('zipCodeDiv', this.value==39?'none':'inline');")
	 ************************************/
 	$("div#yourDetails div#JobSearch_US select#country").change(function () { 
		var documentForm = "document." + eFC.data.efcFormNamePostResume + ".city";
		updateSelectBoxLocation(eval(documentForm),this.selectedIndex);
		isUSSelected(this.value);
		doShowHideElement('zipCodeDiv', this.value==39?'none':'inline');
    });
	
 	/* FUCTION ONKEYUP & ONCHANGE Post your Resume (Your resume file textbox File)
 	 * substitution onKeyUp="checkBrowse(this);" onChange="doCheckFileName(this);"
	************************************/	
	$('div#resumeSummaryMod input#resumeFile').keyup(function(){
		checkBrowse(this);
	})	
	$('div#resumeSummaryMod input#resumeFile').change(function(){
		doCheckFileName(this);
	})	
	
 	/* FUCTION ONCLICK Post your Resume (relocate RadioButtons)
 	 * substitution onclick="fnChangeRelocatePreference(this);"
	************************************/	
	$('span.relocationRadios input#relocateYes,span.relocationRadios input#relocateNo').click(function(){
		fnChangeRelocatePreference(this);
	})	
	
 	/* FUCTION ONCHANGE  Post your Resume (relocate location options)
 	 * substitution onchange="updateSelectBoxLocation(document.#attributes.sFormName#.relocateLocale1,this.selectedIndex); #attributes.sFormName#.relocateLocale1.selectedIndex = 0;"
 	 * 				onchange="updateSelectBoxLocation(document.#attributes.sFormName#.relocateLocale2,this.selectedIndex); #attributes.sFormName#.relocateLocale2.selectedIndex = 0;"
 	 * 				onchange="updateSelectBoxLocation(document.#attributes.sFormName#.relocateLocale3,this.selectedIndex); #attributes.sFormName#.relocateLocale3.selectedIndex = 0;"
	************************************/	
	$('div#divRelationOptions select#relocateCountry1').bind("change keydown", function(){
		var form = $(this).parents("form:eq(0)").attr("name");
		var documentForm1 = "document." + form + ".relocateLocale1";
		var documentForm2 = "document." + form + ".relocateLocale1.selectedIndex";
		updateSelectBoxLocation(eval(documentForm1),this.selectedIndex);
		reorderRelocateSelect(this);
		//documentForm2 = 0;
		//console.log("Var1: ", document.resumeFormFull.relocateLocale1.selectedIndex);
	})
	$('div#divExtraRelationOptions select[name=relocateCountry2]').bind("change keydown", function(){
		var form = $(this).parents("form:eq(0)").attr("name");
		var documentForm3 = "document." + form + ".relocateLocale2";
		var documentForm4 = "document." + form + ".relocateLocale2.selectedIndex";
		updateSelectBoxLocation(eval(documentForm3),this.selectedIndex);
		reorderRelocateSelect(this);
	})
	$('div#divExtraRelationOptions select[name=relocateCountry3]').bind("change keydown", function(){
		var form = $(this).parents("form:eq(0)").attr("name");
		var documentForm5 = "document." + form + ".relocateLocale3";
		var documentForm6 = "document." + form + ".relocateLocale3.selectedIndex";
		updateSelectBoxLocation(eval(documentForm5),this.selectedIndex);
		reorderRelocateSelect(this);
		
		documentForm6 = 1;
	})
	
	/* FUNCTION ONCHANGE Post your Resume (Current sector select box)
	 * substitution onchange="updateSelectBoxSector(document.#attributes.sFormName#.resumeSummary_currentRole,this.selectedIndex);"
	 ************************************/
 	$("span.formSpanPadding select#resumeSummary_currentSector").change(function () { 
		var FormNameDoc = "document." + $(this).parents("form:eq(0)").attr("name") + ".resumeSummary_currentRole"
		updateSelectBoxSector(eval(FormNameDoc),this.selectedIndex);
    });	
		
	/* FUNCTION ONCLICK Post your Resume (Add more languages link)
	 * substitution href="javascript:toggleLayer('extraLanguages');
	 ************************************/
 	$("h4 a#moreLanguages").click(function () { 
		toggleLayer('extraLanguages');
		return false;
    });	
	
	/* FUNCTION ONCLICK Post your Resume (Add more locations link)
	 * substitution href="javascript:toggleLayer('divExtraRelationOptions');
	 ************************************/
 	$("h4 a#moreLocations").click(function () { 
		toggleLayer('divExtraRelationOptions');
		return false;
    });
	
	/* FUNCTION ONCLICK Students Homepage (search textbox keyword)
	 * substitution onclick="if(this.value == '#lcase(application.phrase[request.translationId][3515])#') this.value = '';"
	 ************************************/
 	$("div.studentCenter div#jobSearchMod input#keyword").click(function () { 
        var a1 = $(this).next().text();
		if (this.value == a1) {
			this.value = '';
		}
    });	

	/* FUNCTION ONCHANGE Students Homepage (select country)
	 * substitution onchange="updateSelectBoxLocation(this.form.iCity,this.selectedIndex);"
	 ************************************/
 	$("div.studentCenter div#jobSearchMod select[name=iCountry]").change(function () { 
		updateSelectBoxLocation(this.form.iCity,this.selectedIndex);
    });

	/* FUNCTION ONCLICK Students Homepage (button search)
	 * substitution href="javascript:scFinaliseSearch(document.jobsearch);"
	 ************************************/
 	$("div.studentCenter div#jobSearchMod a.jobSearchButton").click(function () { 
		scFinaliseSearch(document.jobsearch);
		return false;
    });	

	/* FUNCTION ONSUBMIT Students Homepage (jobsearch)
	 * substitution onsubmit="scFinaliseSearch(this);"
	 * Is it happens at some point?...we don't have submit button in the form or any onsubmit event.
	 ************************************/		
	$('div.studentCenter #formJobSearch').submit(function() {
		scfinaliseSearch(this);
	});	
	
	/* FUNCTION ONCLICK & ONMOUSEOVER Students Homepage (jobsearch)
	 * substitution onClick="toggleDiv(\'toggleImgSectorsExplained\',\'DropDownContentSectorsExplained\');" onmouseover="this.style.cursor=\'pointer\';">'
	 ************************************/		
	$('div.studentCenter div#LearnAboutIndustryLeftColumn img#toggleImgSectorsExplained, div.studentCenter div#DropDownTitleSectorsExplained span.GradGenericBlueLinksConst a').click(function() {
		toggleDiv('toggleImgSectorsExplained','DropDownContentSectorsExplained');
		return false;
	});	
	$('div.studentCenter div#LearnAboutIndustryLeftColumn img#toggleImgSectorsExplained').mouseover(function() {
		this.style.cursor='pointer';
	});	
  
	$('div.studentCenter div#LearnAboutIndustryLeftColumn span.GenericMainDropdownHeader img#toggleImgCareerPath, div.studentCenter div#LearnAboutIndustryLeftColumn div#DropDownTitleCareerPath span.GradGenericBlueLinksConst a').click(function() {
		toggleDiv('toggleImgCareerPath','DropDownContentCareerPath');
		return false;
	});		
	$('div.studentCenter div#LearnAboutIndustryLeftColumn span.GenericMainDropdownHeader img#toggleImgCareerPath').mouseover(function() {
		this.style.cursor='pointer';
	});	

	/* FUNCTION ONCLICK & ONBLUR Students Homepage (Search articles by keyword - text)
	 * substitution onclick="if(this.value == '#application.phrase[request.translationId][15]#') this.value = '';" onblur="if(this.value == '') this.value = '#application.phrase[request.translationId][15]#';"
	 ************************************/
 	$("div.studentCenter div.searchWithoutDropdown input[name=keyword]").click(function () { 
		var a1 = $(this).next().text();
		if(this.value == a1){
			this.value = '';
		}
    });		
 	$("div.studentCenter div.searchWithoutDropdown input[name=keyword]").blur(function () { 
		var a1 = $(this).next().text();
		if(this.value == ''){
			this.value = a1;
		}
    });
	
	/* FUNCTION ONCLICK & ONBLUR Students Homepage (Sign up for news and job alerts)
	 * substitution href="javascript:document.newsletterFrm.submit()"
	 ************************************/
 	$("div.studentCenter div#newsJobAlerts a#SignUpNewsJobsbtn").click(function () { 
		document.newsletterFrm.submit();
		return false;
    });
	
	/* FUNCTION ONCHANGE Students Advanced Search (Sector Selects)
	 * substitution onchange="updateSelectBoxSector(document.profileform.iSubSector,this.selectedIndex);")
	 ************************************/
 	$("div.studentCenter table.table-spacing select[name=iSector]").change(function () {
		updateSelectBoxSector(document.profileform.iSubSector,this.selectedIndex);
    });		
 	$("div.studentCenter table.table-spacing select[name=iSector2]").change(function () {
		updateSelectBoxSector(document.profileform.iSubSector2,this.selectedIndex);
    });	
 	$("div.studentCenter table.table-spacing select[name=iSector3]").change(function () {
		updateSelectBoxSector(document.profileform.iSubSector3,this.selectedIndex);
    });	
	
	/* FUNCTION ONCHANGE Students Advanced Search (Locations Selects)
	 * substitution onchange="updateSelectBoxLocation(document.profileform.iCity,this.selectedIndex);"
	 ************************************/
 	$("div.studentCenter table.table-spacing select[name=iCountry]").change(function () {
		updateSelectBoxLocation(document.profileform.iCity,this.selectedIndex);
    });		
 	$("div.studentCenter table.table-spacing select[name=iCountry2]").change(function () {
		updateSelectBoxLocation(document.profileform.iCity2,this.selectedIndex);
    });	
 	$("div.studentCenter table.table-spacing select[name=iCountry3]").change(function () {
		updateSelectBoxLocation(document.profileform.iCity3,this.selectedIndex);
    });	
	
	/* FUNCTION ONCLICK Students Advanced Search (Compensation Select)
	 * substitution onChange="populateSalaryBand(document.profileform.salaryband, salaryValueArray[this.selectedIndex], salaryDisplayArray[this.selectedIndex], '')"
	 ************************************/
 	$("div.studentCenter table.table-spacing select[name=currency]").change(function () { 
		populateSalaryBand(document.profileform.salaryband, salaryValueArray[this.selectedIndex], salaryDisplayArray[this.selectedIndex], '');
    });	
	
	/* FUNCTION ONCHANGE Students Advanced Search (link Search More Sectors)
	 * substitution href="javascript:toggleSectionVisibilityWithArrow('sectorsSection');"
	 ************************************/
 	$("div.studentCenter table.table-spacing a#MoreSectionsLink").click(function () { 
		toggleSectionVisibilityWithArrow('sectorsSection');
		return false;
    });	

	/* FUNCTION ONCHANGE Students Advanced Search (link Search More Locations)
	 * substitution href="javascript:toggleSectionVisibilityWithArrow('locationSection');"
	 ************************************/
 	$("div.studentCenter table.table-spacing a#MoreLocationsLink").click(function () { 
		toggleSectionVisibilityWithArrow('locationSection');
		return false;
    });
	
 	/* FUCTION ONCLICK OPEN recruiter's office (Pop Up / Reminder Password (Button Send))
 	 * substitution href="Javascript:document.changePassword.submit();"
	************************************/
	$("div.emailPopup p#formButtons a#SendChangePass").click(function () {
			document.changePassword.submit();
			return false;
	});		

 	/* FUCTION ONCLICK OPEN recruiter's office (Pop Up / Reminder Password (Button Close))
 	 * substitution href="Javascript:window.close();"
	************************************/
	$("div.emailPopup p#formButtons a#CloseChangePass").click(function () {
			window.close();
			return false;
	});	

 	/* FUCTION ONCLICK CLOSE POP UP - generic window.close function
 	 * substitution href="Javascript:window.close();"
	************************************/
	$("a#GenericCloseWindow").click(function () {
			window.close();
			return false;
	});	
			
		 			
 });
 
