
	function trim(vText) {
		vText = vText.replace(/^\s+/g, '').replace(/\s+$/g, '');
		return vText;
	}

	function removeMultipleWhiteSpaces(vText) {
		vText = vText.replace(/\s+/g, ' ');
		return vText;
	}

	function removeAllWhiteSpaces(vText) {
		vText = vText.replace(/\s+/g, '');
		return vText;
	}

	function replaceWhiteSpacesWithPipe(vText) {
		vText = vText.replace(/\s/g, '|');
		return vText;
	}

	function isNumeric(vText) {
		if (vText.match(/\D+/gim)) {
       		return false;
       	} else {
       		return true;
       	}
	}
	
	function isAgentNameOk(vAgentName) {
		if (vAgentName.match(/[^A-Z0-9ÉÈÊËÒÓÔÖÇÀÁÂÄÛÚÙÜÌÍÎÏ\s]+/gi)) {
       		return false;
       	} else {
       		return true;
       	}
	}
	
	function isAgentEmailOk(vAgentEmail) {
		if (vAgentEmail.match(/^[A-Z0-9]+([._-][A-Z0-9]+)*@[A-Z0-9]+([_.-][A-Z0-9]+)*\.[A-Z]{2,3}$/gi)) {
       		return true;
       	} else {
			return false;
       	}
	}

	function isAlertNameOk(vAlertName) {
		if (vAlertName.match(/[\\\/\*\?\|<>:"]/gi)) {
       		return false;
       	} else {
       		return true;
       	}
	}

	function doHttpRequest(pUrl, pParams) {

		var strURL = pUrl;
		var params = pParams;
		//alert(params);
		
		if (window.XMLHttpRequest) {
			//alert("IE7+, Firefox, Chrome, Opera, Safari");
		  	xmlHttpReq = new XMLHttpRequest();
		} else {
			//alert("IE6, IE5");
		 	xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		 }

	    xmlHttpReq.open('POST',strURL,false);
	    xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	   	xmlHttpReq.send(params);
	   	//alert(params);

		if (xmlHttpReq.readyState == 4) {
			if (xmlHttpReq.status == 200) {
		        strError = strError + xmlHttpReq.responseText;
		        strError = strError.replace(/<BR>/g, "\n");
		        //alert(strError);
			}
		}	   	
	}	
	
	function exportResults() {

		strError  = "";	
		iExportFormat = document.getElementById('exportFormat').value;
		iExportNumber = document.getElementById('exportNumber').value;
		strLinkParams = document.getElementById('linkParams').value;
		
		if ( (iExportFormat==2) && (iExportNumber > 200) ) {
			strError = "Les exports au format WORD sont limités à 200 annonces" 
		} else if ( ((iExportFormat==5)||(iExportFormat==8)) && (iExportNumber > 500) ) {
			strError = "Les exports au format XML sont limités à 500 annonces" 
		}

		if (strError != "") {
			alert(strError);
		} else {		
			window.location = "HttpExport.asp?top=" + iExportNumber + "&exportFormat=" + iExportFormat + strLinkParams;
		}
	}


	function setPrint() {
	
		//alert('Pour de meilleurs résultats à l\'impression,\nveuillez sélectionner le format de papier A4 et l\'orientation PAYSAGE.'); 
		//this next part is to get round a bug in chrome & opera
		var objBrowse = window.navigator;
		if (objBrowse.appName == "Opera" || objBrowse.appName == "Netscape") {
			setTimeout('window.print()', 1000);
		} else {
			window.print();
		}
		
	}	

	function convertToMMDDYY(pDate){

		arrayDate = pDate.split("-");
		strDate = arrayDate[1] + "/" + arrayDate[0] + "/" + arrayDate[2];

		return strDate;
	}	

		//Disable the enter key
//		function stopRKey(evt) {
//			vForm = document.forms[0].name;
//			var evt = (evt) ? evt : ((event) ? event : null);
//			var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
//			if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
//		}
//
//		//global form event identifiers
//		document.onkeypress = stopRKey; 
