<!--

/**
* The specific functions used by the form
*
* @author	khai TA
* @version 1 11/02/2008
*/


/** 
* remove blank on starting string
*	@return string
*/
String.prototype.trim = function () {
   return this.replace(/^\s*|\s*$/,"");
}

/** 
* replace all blank in a string into one
*	@return string
*/
String.prototype.simplify= function () {
   return this.replace(/\s+/g," ");
}

/**
* Check if the value is empty
* @param string theFieldValue
* @return bool
*/
function isFieldEmpty(theFieldValue){
	
	//tmpFieldValue = theField.value.trim();
	tmpFieldValue = theFieldValue.trim();
	
	if( tmpFieldValue.length == 0 ) // empty input
		return true;
	else return false;
}

/**
* Check if the field 'theFieldValue' length is oversized 'maxchars' chars
* @param string theFieldValue 
* @param integer maxchars 
* @return bool
*/
function isFieldOverChars(theFieldValue, maxchars){
	
	if( theFieldValue.length > maxchars)
		return true;
	else return false;
}

/**
* Check if the field 'theFieldValue' is a correct Kompass client code
* @param string theFieldValue 
* @return bool
*/
function isValidClientCodeKompass(theFieldValue){
	
	var CodeClientKompassLength = 7;
	if( theFieldValue.length == CodeClientKompassLength && !isNaN(theFieldValue) )
		return true;
	else return false;
}

/**
* Check if the email 'emailAddress' is a correct email format
* @param string emailAddress 
* @return bool
*/
function isValidEmail(emailAddress) {

	var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
	//var re =  /^[\w\.]+@[\w\.-]+\.[a-zA-Z]{2,5}$/gi;
	
	//var re = /^([a-zA-Z0-9]+(([\.\-\_]?[a-zA-Z0-9]+)+)?)\@(([a-zA-Z0-9]+[\.\-\_])+[a-zA-Z]{2,4})$/gi;
	
	return re.test(emailAddress);
}

/**
* Open a popup
* @param string adresse		An URL
* @param string fenetre		The popup name
* @param integer largeur
* @param integer hauteur
* @param string options		Options for the popup : scroll etc...
*/
function ouvre(adresse, fenetre, largeur, hauteur, options){
	var top = (screen.height-hauteur) / 2;
	var left = (screen.width-largeur) / 2;

//	window.open(adresse, fenetre, "top=" + top + ",left=" + left + ",width=" + largeur + ",height=" + hauteur + "," + options);
	window.open(adresse,fenetre,"width="+largeur+", height="+hauteur+",top="+top+",left="+left+","+options);
	
}

-->