/* Fonctions pour les liste de pays et de régions */
/* ---------------------------------------------- */
iCountry_id = new Array("0", "7","39","150","108","146","8","40","140","41","161","102","42","43","151","44","1","45","47","48","49","2","51","50","52","53","141","54","27","55","160","56","58","28","3","147","32","152","155","59","60","4","127","26","62","149","22","5","153","6","63","144","64","9","148","142","154","10","77","106","123","29","30","66","67","11","65","69","12","143","31","70","71","72","73","68","46","57","13","74","75","14","15","156","76","157","145","16","82","78","79","80","81","158","159","84","85","83","86","125","130","33","87","88","89","17","90","34","18","91","19","92","61","93","25","94","95","96","100","98","97","99","101","103","135","104","105","35","20","21","107","110","109","23","24","111","112","113","115","114","116","36","117","118","119","120","122","121","124","126","128","129","131","132","133","37","134","136","137","138","139");

iCountry_value = new Array("Sélectionnez un pays", "France","USA","Afghanistan","Afrique du Sud","Algeria","Allemagne","Andorre","Angola","Antigua-et-Barbuda","Antilles néerlandaises","Arabie Saoudite","Argentine","Arménie","Aruba","Australie","Autriche","Azerbaïdjan","Bahreïn","Bangladesh","Barbade","Belgique","Bermudes","Biélorussie","Bolivie","Bosnie-Herzégovine","Botswana","Brésil","Brunéi","Bulgarie","Cameroun","Canada","Chili","Chine ","Chypre","Colombia","Corée (du Sud)","Costa Rica","Côte d'Ivoire","Croatie","Cuba","Danemark","EAU","Écosse","Égypte","Equateur","Espagne","Estonie","Ethiopie","Finlande","Géorgie","Ghana","Gibraltar","Grèce","Grenada","Guadeloupe","Guyane","Hongrie","Île Maurice","Îles Salomon","Îles Turques et Caïques","Inde","Indonésie","Iran","Iraq","Irlande","Islande","Israël","Italie","Jamaica","Japon","Jordanie","Kazakhstan","Kenya","Koweït","L'île de Man","Les Bahamas","Les Iles Cayman","Lettonie","Liban","Liechtenstein","Lituanie","Luxembourg","Macao","Macédoine","Madagascar","Malaysia","Malte","Maroc","Mexique","Micronésie","Moldavie","Monaco","Mozambique","Népal","Nigeria","Norvège","Nouvelle-Zélande","Oman","Ouganda","Ouzbékistan","Pakistan","Panama","Papouasie-Nouvelle-Guinée","Paraguay","Pays-Bas","Pérou","Philippines","Pologne","Porto Rico","Portugal","Qatar","République Tchèque","Roumanie","Royaume-Uni","Russie","Rwanda","Saint-Christophe-et-Niévès","Saint-Marin","Saint-Vincent-et-les-Grenadines","Sainte-Lucie","Samoa","Sao Tomé et Principe","Sénégal","Serbie et Montenegro","Seychelles","Sierra Leone","Singapour","Slovaquie","Slovénie","Somalie","Soudan","Sri Lanka","Suède","Suisse","Surinam","Swaziland","Syrie","Tadjikistan","Taiwan","Tanzanie","Thaïlande","Togo","Tonga","Trinité-et-Tobago","Tunisie","Turkménistan","Turquie","Tuvalu","Ukraine","Uruguay","USA Îles Vierges","Vanuatu","Vatican","Venezuela","Viêt-Nam","Yémen","Zaïre","Zambie","Zimbabwe","Autre");

iCity_id = new Array(160);

iCity_value = new Array(160);
/* Create default arrays for every country */
		for(var i=0; i < iCountry_id.length; i++){

			iCity_id[i] = new Array("0");

			iCity_value[i] = new Array("Tous");

		}

		iCity_id[0] = new Array("0"); iCity_value[0] = new Array("Sélectionnez une région");

		iCity_id[1] = new Array("0","268","6","663","8","9","5","7","4","10");iCity_value[1] = new Array("Tous","Centre-Bourgogne","Grand Est","Grand Ouest","Grand Sud-Est","Grand Sud-Ouest","Nord-Pas-de-Calais","Normandie-Picardie","Paris Ile-de-France","Rhône-Alpes");

		iCity_id[2] = new Array("0","0","127","87","38","174","207","46","60","0","23","24","11","25","12","17","18","13","14","19","20","21","22","30","15","16","31","242","26","295","296","297","27","294","243","293","28","29","33","314","303","320","326","35","331","307","309","298","328","327","36","312","321","306","324","315","37","38","39","305","313","325","40","41","319","332","316","299","322","329","42","43","311","44","45","46","49","330","323","47","308","317","301","48","304","310","302","50","318","300","333","334","335","51","52","53","54","338","339","343","344","342","340","336","341","337","55","345","346","56","347","348","57","349","350","58","351","59","60","353","354","352","62","61","360","63","358","64","65","66","356","67","68","355","359","69","357","70","71","72","73","74","75","361","362","76","77","78","79","365","366","367","368","369","363","80","364","82","371","102","103","372","104","370","373","375","376","374","105","83","84","377","379","85","378","381","382","86","383","87","384","88","89","90","380","385","386","387","388","389","91","92","390","93","94","391","392","393","394","95","96","97","98","99","100","101","395","396","398","399","106","400","401","107","108","109","110","404","111","112","402","403","407","113","114","115","469","419","116","410","127","128","129","473","474","475","476","131","477","130","472","478","479","480","481","482","132","471","483","122","486","487","484","488","123","124","485","125","126","118","119","120","133","490","502","500","505","134","506","135","136","137","138","492","503","504","139","493","501","491","497","495","494","496","498","510","509","514","515","141","507","142","140","512","143","516","517","518","519","147","148","520","521","149","150","152","522","523","153","146","524","525","526","144","527","145","154","155","156","157","184","180","529","181","530","182","528","183","185","186","187","188","189","158","159","160","163","164","542","552","534","532","546","540","165","554","539","167","545","548","533","553","538","536","166","544","550","547","549","535","551","541","537","531","543","168","555","556","169","557","558","161","560","162","559","561","564","171","566","172","567","568","580","173","569","565","570","571","572","174","573","574","170","575","176","576","577","578","177","178","179","579","190","582","583","191","192","193","194","587","581","195","586","584","196","585","197","198","199","588","589","200","201","590","203","594","593","597","204","205","206","596","211","595","207","208","598","591","599","209","210","592","212","213","600","606","604","214","215","216","608","602","603","601","217","607","605","218","219","220","609","221","222","223","224","610","226","227","619","229","613","228","620","230","621","231","615","622","623","232","617","624","616","611","225","625","618","614","233","234","626","235","612","627","236","629","630","631","632","237","238","633","628","634","244","245","637","246","639","247","638","248","249","640","250","251","252","641","253","636","642","240","239","644","643","254","645","657","255","648","650","652","647","646","656","649","653","257","256","258","654","651","658","659","660","262","261","263","264","265","661","662","259","260","266","267");iCity_value[2] = new Array("Tous","--------------------","Boston","Chicago","Los Angeles","New York City","Philadelphie","San Francisco","Stamford","--------------------","AK-Anchorage","AK-Fairbanks/Interior","AK-Far North/Nome","AK-Juneau","AK-Southwest","AL-Anniston","AL-Birmingham","AL-Decatur","AL-Dothan","AL-Mobile","AL-Montgomery","AL-Northern/Huntsville","AL-Tuscaloosa","AR-Eastern","AR-Fayetteville","AR-Fort Smith","AR-Little Rock","AR-Pine Bluff","AZ-Flagstaff","AZ-Glendale","AZ-Mesa","AZ-Peoria/Sun City","AZ-Phoenix","AZ-Prescott","AZ-Scottsdale","AZ-Tempe","AZ-Tucson","AZ-Yuma","CA-Anaheim","CA-Bakersfield","CA-Berkeley","CA-Burbank","CA-Carlsbad","CA-Central Valley","CA-Chico","CA-Concord","CA-Daly City","CA-East Bay","CA-Encinitas","CA-Escondido","CA-Eureka","CA-Fresno","CA-Glendale","CA-Hayward","CA-Huntington Beach","CA-Lancaster","CA-Long Beach","CA-Los Angeles","CA-Marin County/North Bay","CA-Modesto","CA-Monterey","CA-Moreno Valley","CA-Oakland","CA-Orange County","CA-Oxnard","CA-Palm Springs","CA-Palmdale","CA-Paradise","CA-Pasadena","CA-Rancho Cordova","CA-Riverside","CA-Sacramento","CA-Salinas","CA-San Bernardino","CA-San Diego","CA-San Francisco","CA-San Jose","CA-San Mateo","CA-Santa Ana","CA-Santa Barbara","CA-Santa Clara","CA-Santa Clarita","CA-Santa Rosa","CA-Silicon Valley","CA-Stockton","CA-Sunnyvale","CA-Vallejo","CA-Ventura","CA-Ventura","CA-Yuba City","CO-Arvada","CO-Aurora","CO-Bloomfield","CO-Boulder","CO-Colorado Springs","CO-Denver","CO-Denver South","CO-Englewood","CO-Fort Collins","CO-Greeley","CO-Highlands Ranch","CO-Lakewood","CO-Littleton","CO-Longmont","CO-Loveland","CO-Pueblo","CO-Western/Grand Junction","CT-Bridgeport","CT-Bristol","CT-Danbury","CT-Fairfield","CT-Greenwich","CT-Hartford","CT-Meriden","CT-New Britain","CT-New Haven","CT-Norwalk","CT-Southeast/New London","CT-Stamford","CT-Storrs","CT-Trumbull","CT-Waterbury","DC-Washington/Metro","DE-Delaware","FL-Bradenton","FL-Daytona","FL-Fort Walton Beach","FL-Ft. Lauderdale","FL-Ft. Myers","FL-Gainesville","FL-Jacksonville","FL-Melbourne","FL-Miami","FL-Naples","FL-Ocala","FL-Orlando","FL-Panama City","FL-Pensacola","FL-Sarasota","FL-St. Petersburg","FL-Tallahassee","FL-Tampa","FL-West Palm Beach","GA-Albany","GA-Athens","GA-Atlanta","GA-Atlanta North","GA-Atlanta South","GA-Central/Augusta","GA-Columbus","GA-Dalton","GA-Gainesville","GA-Macon","GA-Marietta","GA-Peachtree City","GA-Savannah","GA-Smyrna","HI-Hawaii","IA-Ames","IA-Cedar Rapids","IA-Central/Des Moines","IA-Council Bluffs","IA-Davenport","IA-Dubuque","IA-Iowa City","IA-Mason City","IA-Muscatine","IA-Waterloo","IA-Western/Sioux City","ID-Boise","ID-Eastern/Twin Falls","ID-Idaho Falls","ID-Nampa","ID-Northern","ID-Pocatello","IL-Arlington Heights","IL-Aurora","IL-Bloomington","IL-Champaign","IL-Chicago","IL-Chicago Heights","IL-Chicago North","IL-Chicago Northwest","IL-Chicago South","IL-Chicago West","IL-Decatur","IL-Evanston","IL-Joliet","IL-Naperville","IL-Peoria","IL-Quincy","IL-Rockford","IL-Skokie","IL-Southern","IL-Springfield","IL-Waukegan","IN-Anderson/Muncie","IN-Bloomington","IN-Elkhart","IN-Evansville","IN-Fort Wayne","IN-Gary/Merrillville","IN-Indianapolis","IN-Lafayette","IN-South Bend","IN-Terre Haute","KS-Dodge City","KS-Emporia","KS-Garden City/Western","KS-Hutchinson","KS-Kansas City","KS-Lawrence","KS-Manhattan","KS-Overland Park","KS-Topeka","KS-Wichita","KY-Bowling Green","KY-Frankfort","KY-Lexington","KY-Louisville","KY-Northern","KY-Owensboro","KY-Paducah","LA-Alexandria","LA-Baton Rouge","LA-Lafayette","LA-Lake Charles","LA-Monroe","LA-Nouvelle Orléans","LA-Shreveport/Bossier City","MA-Boston","MA-Boston North","MA-Boston South","MA-Brockton/Plymouth","MA-Brookline","MA-Cambridge","MA-Fall River","MA-Framingham","MA-Haverhill/Lawrence","MA-Hyannis","MA-Lowell","MA-Lynn","MA-Malden/Medford","MA-New Bedford","MA-Newton/Quincy","MA-Taunton","MA-Western/Springfield","MA-Worcester","MD-Annapolis","MD-Baltimore","MD-Bethesda","MD-Bowie","MD-Chevy Chase","MD-Columbia","MD-Frederick","MD-Gaithersburg","MD-Hagerstown","MD-Prince George's County","MD-Salisbury","ME-Central/Augusta","ME-Northern/Bangor","ME-Southern/Portland","MI-Ann Arbor","MI-Battle Creek","MI-Bay City","MI-Burton","MI-Dearborn","MI-Detroit","MI-Farmington Hills","MI-Flint","MI-Grand Rapids","MI-Kalamazoo","MI-Lansing","MI-Livonia","MI-Midland","MI-Mount Pleasant","MI-Northern","MI-Pontiac","MI-Saginaw","MI-Southfield","MI-St. Clair Shores","MI-Sterling","MI-Troy","MI-Warren","MI-Waterford","MN-Burnsville","MN-Eden Prairie","MN-Lakeville","MN-Mankato","MN-Minneapolis","MN-Moorhead","MN-Northern/Duluth","MN-Rochester","MN-St. Cloud","MN-St. Paul","MN-Winona","MO-Columbia","MO-Florissant","MO-Independence","MO-Jefferson City","MO-Kansas City","MO-Lees Summit","MO-Liberty","MO-Northeastern","MO-Quincy","MO-Springfield/Joplin","MO-St. Charles","MO-St. Joseph","MO-St. Louis","MS-Biloxi","MS-Columbus","MS-Greenville","MS-Gulfport","MS-Jackson","MS-Meridian","MS-Tupelo","MT-Eastern/Billings","MT-Great Falls","MT-Helena/Butte","MT-Western/Missoula","NC-Asheville","NC-Charlotte","NC-Durham","NC-Eastern/Greenville","NC-Fayetteville","NC-Greensboro","NC-High Point","NC-Raleigh","NC-Wilmington","NC-Winston Salem","ND-Central","ND-Eastern","ND-Western","NE-Lincoln","NE-Omaha","NE-West/North Platte","NH-Northern","NH-Southern","NJ-Bayonne","NJ-Cherry Hill","NJ-Clifton","NJ-Dover","NJ-Edison","NJ-Elizabeth","NJ-Freehold","NJ-Hackensack","NJ-Jersey City","NJ-Marlton","NJ-Metuchen","NJ-Middletown","NJ-Morristown","NJ-New Brunswick","NJ-Newark","NJ-Orange","NJ-Paterson","NJ-Plainfield","NJ-Princeton","NJ-Sayreville","NJ-Somerville","NJ-Teaneck","NJ-Trenton","NJ-Union","NJ-Union City","NJ-Wayne","NJ-Westfield","NM-Albuquerque","NM-Las Cruces","NM-Rio Rancho","NM-Santa Fe","NV-Carson City","NV-Henderson","NV-Las Vegas","NV-North Las Vegas","NV-Reno","NV-Sparks","NY-Albany","NY-Babylon","NY-Binghamton/Elmira","NY-Brookhaven","NY-Buffalo","NY-Clarkstown","NY-Colonie/Latham","NY-Great Neck","NY-Hempstead","NY-Huntington","NY-Islip","NY-Levittown","NY-Mount Vernon","NY-New Rochelle","NY-New York City","NY-Niagara Falls","NY-Oyster Bay","NY-Poughkeepsie","NY-Ramapo","NY-Rochester","NY-Schenectady","NY-Smithtown","NY-Southampton","NY-Syracuse","NY-Utica","NY-White Plains","NY-Yonkers","OH-Akron","OH-Bowling Green","OH-Canton","OH-Cincinnati","OH-Cleveland","OH-Columbus","OH-Dayton","OH-Mansfield","OH-Middletown","OH-Northwest","OH-Sandusky","OH-Toledo","OH-Youngstown","OH-Zanesville","OK-Central/Oklahoma City","OK-Eastern/Tulsa","OR-Central","OR-Eugene","OR-Medford","OR-Portland","OR-Salem","OR-Springfield","PA-Allentown","PA-Bala Cynwyd","PA-Bethlehem","PA-Conshohocken","PA-Erie","PA-Harrisburg","PA-Johnstown","PA-King of Prussia","PA-Lancaster","PA-Levittown","PA-Philadelphie","PA-Pittsburgh","PA-Plymouth Meeting","PA-Reading","PA-Scranton","PA-State College","PA-Wilkes Barre","PA-York","PR-San Juan","RI-Providence","RI-Warwick","SC-Aiken","SC-Anderson","SC-Columbia","SC-Florence","SC-Greenville/Spartanburg","SC-Hilton Head","SC-Mount Pleasant","SC-Myrtle Beach","SC-Rock Hill","SC-South/Charleston","SC-Summerville","SC-Sumter","SD-East/Sioux Falls","SD-West/Rapid City","TN-Chattanooga","TN-Clarksville","TN-Jackson","TN-Knoxville","TN-Memphis","TN-Nashville","TX-Abilene","TX-Amarillo","TX-Austin","TX-Baytown","TX-Beaumont","TX-Bryan/College Station","TX-Dallas","TX-Denton","TX-El Paso","TX-Flower Mound","TX-Fort Worth","TX-Galveston","TX-Garland/Richardson","TX-Harlingen/McAllen","TX-Houston","TX-Irving","TX-Killeen","TX-Laredo","TX-Lubbock","TX-Midland/Odessa","TX-Pasadena","TX-Plano","TX-San Angelo","TX-San Antonio","TX-South/Corpus Christi","TX-Sugar Land","TX-Temple/Waco","TX-Tyler","TX-Victoria","TX-Wichita Falls","UT-Layton","UT-Logan","UT-Ogden","UT-Orem","UT-Provo","UT-Salt Lake City","UT-Sandy","UT-St. George","UT-Taylorsville","VA-Alexandria","VA-Charlottesville/Harrisonburg","VA-Chesapeake","VA-Fairfax","VA-Hampton","VA-McLean/Arlington","VA-Newport News","VA-Norfolk/Hampton Roads","VA-Northern","VA-Portsmouth","VA-Richmond","VA-Roanoke","VA-Southwest","VA-Suffolk","VA-Vienna","VA-Virginia Beach","VT-Bennington","VT-Brattleboro","VT-Burlington","VT-Montpelier","VT-Rutland","WA-Bellevue","WA-Bellingham","WA-Bremerton","WA-Central/Yakima","WA-Everett","WA-Federal Way","WA-Kennewick","WA-Lakewood","WA-Mount Vernon","WA-Olympia","WA-Redmond","WA-Richland","WA-Seattle","WA-Spokane","WA-Tacoma","WA-Walla Walla","WA-Wenatchee","WI-Appleton","WI-Eau Claire","WI-Fond du Lac","WI-Green Bay","WI-La Crosse","WI-Madison","WI-Milwaukee","WI-Northern","WI-Sheboygan","WI-Wausau","WV-Northern","WV-Southern","WY-Casper","WY-Cheyenne");

		iCity_id[6] = new Array("0","405","406","397","408","409","269","411","412","413","414","415","416","417","418","420");iCity_value[6] = new Array("Tous","Baden-Württemberg","Bavière","Berlin / Brandenburg","Bremen","Hamburg","Hessen","Mecklenburg-Vorpommern","Niedersachsen","Nordrhein-Westfalen","Rheinland-Pfalz","Saarland","Sachsen","Sachsen-Anhalt","Schleswig-Holstein","Thüringen");

		iCity_id[15] = new Array("0","448","449","450","710","466","451","452","447");iCity_value[15] = new Array("Tous","Adelaide","Brisbane","Canberra","Darwin","Hobart","Melbourne","Perth","Sydney");

		iCity_id[21] = new Array("0","277","279","278");iCity_value[21] = new Array("Tous","Région de Bruxelles-Capitale","Région flamande","Région wallonne");

		iCity_id[33] = new Array("0","707","706","276","703","704","705");iCity_value[33] = new Array("Tous","Autre villes","Guangzhou","Hong Kong","Péking","Shanghai","Shenzhen");

		iCity_id[42] = new Array("0","701","702");iCity_value[42] = new Array("Tous","Abu Dhabi","Dubaï");

		iCity_id[43] = new Array("0","468","467","458","459");iCity_value[43] = new Array("Tous","Aberdeen","Dundee","Edimbourg","Glasgow");

		iCity_id[65] = new Array("0","460","271","462","461");iCity_value[65] = new Array("Tous","Cork","Dublin","Galway","Limerick");

		iCity_id[68] = new Array("0","446","421","422","423","434","435","436","437","270","438","464","439","440","441","442","443","444","465","463","445");iCity_value[68] = new Array("Tous","Abruzzo","Basilicata","Calabria","Campania","Emilia Romagna","Friuli Venezia Giulia","Lazio","Liguria","Lombardia","Marche","Molise","Piemonte","Puglia","Sardegna","Sicilia","Toscana","Trentino Alto Adige","Umbria","Valle D'Aosta","Veneto");

		iCity_id[97] = new Array("0","453","455","456","454");iCity_value[97] = new Array("Tous","Auckland","Christchurch","Dunedin","Wellington");

		iCity_id[105] = new Array("0","280","281","282","283","284","285","286","287","288","291","289","290");iCity_value[105] = new Array("Tous","Drenthe","Flevoland","Friesland","Gelderland","Groningen","Limburg","Nord-Brabant","Nord-Holland","Overijssel","Sud-Holland","Utrecht","Zeeland");

		iCity_id[114] = new Array("0","468","708","467","457","458","424","425","459","2","428","709","1","426","427","432","433","429","430","431");iCity_value[114] = new Array("Tous","Aberdeen","Belfast","Dundee","East Anglia","Edimbourg","Est","Est-Midlands","Glasgow","Îles De la Manche","Irlande du Nord","Londonderry","Londres","Nord-Est","Nord-Ouest","Ouset-Midlands","Pays de Galles","Sud-Est","Sud-Ouest","Yorkshire & The Humber");

		iCity_id[134] = new Array("0","713","272","712","273","711","292","275");iCity_value[134] = new Array("Tous","Mitteland","Romande - Genève","Suisse centrale - Zug","Suisse nord-ouest - Bâle","Suisse orientale","Tessin - Lugano","Zurich");



//initializes and updates select boxes

function initSelectBoxesLocation(primarySelectBox,primarySelectDefault,secondarySelectBox,secondarySelectDefault){

	// Populate the primary select box

	populateSelectBox(primarySelectBox,iCountry_value,iCountry_id);

	// Set the default value for the primary select box

	var primaryDefaultArray = primarySelectDefault.split(",");

	setSelectBoxDefault(primarySelectBox,primaryDefaultArray);

	

	// Populate the secondary select box

	var primarySelectedIndex = primarySelectBox.selectedIndex;

	populateSelectBox(secondarySelectBox,iCity_value[primarySelectedIndex],iCity_id[primarySelectedIndex]);

	//Set the default value(s) for the secondary select box

	var secondaryDefaultArray = secondarySelectDefault.split(",");

	setSelectBoxDefault(secondarySelectBox,secondaryDefaultArray);

}



function finaliseSearch(formName) {

	if (formName.keyword.value == 'Mots-clés') formName.keyword.value = '';

	//else if ((formName.keyword.value != initKeyword) && (initKeyword != 'keyword')) formName.keyword.value = formName.keyword.value + ' ' + initKeyword;

	formName.keyWordAny.value = formName.keyword.value;

	//enable the location boxes so the values are passed to action page

	formName.iCountry.disabled = false;

	formName.iCity.disabled = false;

	//return false;

}



function updateSelectBoxLocation(secondarySelectBoxObj,primaryIndex){

	populateSelectBox(secondarySelectBoxObj,iCity_value[primaryIndex],iCity_id[primaryIndex]);

}



// check whether the textField is with empty value

function isEmpty(fieldName) {

	if ((fieldName == null) || (fieldName.length == 0)) {

		return true;

	}

	else {	return false;	}

}



function checkEmail(str) {

	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(str)){ return true; }

	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 popupURL(url,winWidth,winHeight,resizable) {

	if(winWidth == null){winWidth = '500';}

	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 checkDates(f)	{

	var daysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

	var day   = f.day.value;

	var month = f.month.value;

	var year  = f.year.value;



	if ((year % 4) == 0 || (year % 400) == 0)	// leap year

		daysInMonth[1]++;

	if (day > daysInMonth[month - 1] || month > 12 || day > 31  || isNaN(day) || isNaN(month) || isNaN(year) || day.length == 0 || month.length == 0 || year.length == 0  ) {

		return true;

	}

	return false;

// Include the following parameters when checking for a birthdate || year > 2002 || year < 1880

}



/*

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

	}

}





/* 

	Navigation amongst the results (and away to refine search) is done by form submission to allow

	the criteria that has been entered to be passed around (ie: maintain state).

	

	Haran Jan 2005: orderColumnSearchResults() - see function after navigateSearchResults() - submits form sorting by column



*/

function navigateSearchResults(formName, actionPage, startRow){

	// Set the startRow variable in the form

	if(startRow){

		document[formName].startRow.value = startRow;

	}	

	

	submitForm(formName, actionPage);

}



function orderColumnSearchResults(formName, actionPage, sortColumn){

	// Set the sortColumn variable in the form (and reset startRow to 1)

	if(sortColumn){

		document[formName].sortColumn.value = sortColumn;

		document[formName].startRow.value = 1;

	}	

	

	submitForm(formName, actionPage);

}



function orderNewsArchiveSearchResults(formName, actionPage, sortColumn){

	// Set the sortColumn variable in the form (and reset startRow to 1)

	if(sortColumn){

		document[formName].sortByDate.value = sortColumn;

		document[formName].startRow.value = 1;

	}	

	

	submitForm(formName, actionPage);

}



function submitForm(formName, actionPage){

	// Adjust the action page

	if(actionPage){

		document[formName].action = actionPage;

	}

	document[formName].submit();

}



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;

			}

		}

	}

}



/* toggles the display property of a particular object in the page */

function toggleDisplay(objectId) {

	if ( objectId.style.display == 'none' ){

		objectId.style.display = 'block';

	} else {

		objectId.style.display = 'none';

	}

}



function toggleSectionVisibility(sectionName){

	// toggle the visibility of the html content

	toggleDisplay(document.getElementById(sectionName));

}





// Used in the job search section to save the search criteria to a psa

function saveJobSearch(formName, actionPage){

	submitForm(formName, actionPage);

}

function leftTrim(sString){

	while (sString.substring(0,1) == ' '){

		sString = sString.substring(1, sString.length);

	}

	return sString;

}

// added by A Livie to do string trims

function trim(sString){

	while (sString.substring(0,1) == ' '){

		sString = sString.substring(1, sString.length);

	}

	while (sString.substring(sString.length-1, sString.length) == ' '){

		sString = sString.substring(0,sString.length-1);

	}

return sString;

}

// added by A Livie to do textarea counter

function textCounter(field, countfield, maxlimit) {

if (field.value.length > maxlimit) // if too long...trim it!

field.value = field.value.substring(0, maxlimit);

// otherwise, update 'characters left' counter

else 

countfield.value = maxlimit - field.value.length;

}



function toggleLayer(whichLayer)

{

if (document.getElementById)

{

// this is the way the standards work

var style2 = document.getElementById(whichLayer).style;

style2.display = style2.display? "":"block";

}

else if (document.all)

{

// this is the way old msie versions work

var style2 = document.all[whichLayer].style;

style2.display = style2.display? "":"block";
}else if (document.layers){// this is the way nn4 works
var style2 = document.layers[whichLayer].style;style2.display = style2.display? "":"block";}}function OpenNewWindow_OnClick( url, width, height ){    var _PageName = url;
	var _Width    = width;
	var _Height   = height;
	var _WndName  = 'Wnd';
	var scrWidth  = screen.width;
	var scrHeight = screen.height;
	var topLeft_X = Math.round( ( scrWidth  - _Width  ) / 2 );
	var topLeft_Y = Math.round( ( scrHeight - _Height ) / 2 );
	var features  = 'toolbar=0,' 	  +
			        'scrollbars=1,' +
			        'location=0,'   +
			        'status=0,'  +
			        'menubar=0,'    +
			        'resizable=0,'  +
			        'width='  + _Width    + ','   +
			        'height=' + _Height   + ','   +
			        'left='   + topLeft_X + ','   +
			        'top='    + topLeft_Y + '';
	window.open( _PageName, _WndName, features );}



/* Fonctions poour les offres déroulantes */

/* -------------------------------------- */
var characterTimeout = 30;
var jobTimeout = 2000;
var markerOne = "_";
var markerTwo = "-";
var markerNone = "";
var jobTitles = new Array();
var jobLinks = new Array();
function doInitialiseTicker()	{
	currentJob     = -1;
	currentLength    = 0;
	if (document.getElementById) {
			anchorObject     = document.getElementById("tickerAnchor");
			doLaunchTicker();
	}
	else {
			document.write("<style>.tickerDiv{display:none;}.ticko{border:0px; padding:0px;}</style>");
			return true;
	}
}
function doLaunchTicker()	{
	var thisTimeout;
	// Go for the next story data block
	if(currentLength == 0)	{
		currentJob++;
		currentJob = currentJob % itemCount;
		jobSummary = jobTitles[currentJob].replace(/&quot;/g,'"');
		thisLink = jobLinks[currentJob];
		anchorObject.href = thisLink;
	}
	// Put current ticker text into anchor
	anchorObject.innerHTML = jobSummary.substring(0,currentLength) + whatMarker();
	// Modify the length for the substring and define the timer
	if(currentLength != jobSummary.length)	{
		currentLength++;
		thisTimeout = characterTimeout;
	}
	else	{
		currentLength = 0;
		thisTimeout = jobTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("doLaunchTicker()", thisTimeout);
}
function whatMarker()	{

	if(currentLength == jobSummary.length)	{
		return markerNone;
	}	
if((currentLength % 2) == 1)	{
		return markerOne;
	}
	else	{
		return markerTwo;
	}
}


