/*
 * Supprime les caractères espace, retour chariot et newline
 * en début et fin de chaîne.
 */
function trim(str){
	str = str.replace( /^([\s]+)/g, '' ); // Supprime les caractères non-imprimables de début de chaîne
	str = str.replace( /([\s]+)$/g, '' ); // Supprime les caractères non-imprimables de fin de chaîne
	return str;
}

/*
 *	Vérifie qu'une chaîne contient un nombre entier valide
 * 	les séparateurs de décimale sont la virgule et le point
 */
function validint(ch){
	var reg = new RegExp("^(([\+\-]?)([0-9]+))$");
	return reg.test(ch);
}

function ValidForm() {

	if ((form1.Bassin.value == -1) && (form1.Commune.value == -1)) {
		alert("Vous devez précisez votre recherche, svp.");
		return false;
	}
	else
		return true;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/* script pour ouvrir les photos des logements */
var _PAGE="";
    _PAGE=""; /* Specify an actual page if you don't want to use the popup code. */

var _CONTENT=""; /* this holds the data to write if no external html file is used */

function openImageWindow(imageSrc,imageTitle)
{
/*
 * if you use the name "_PAGE" for the page
 * you will have no problems at all
 * however if you change the name to something else
 * remember to change the reference to it in the following line of code
 * to reference your own filename..
 *
 * No _PAGE specified uses the javascript code embedded on this page.
 *
 */

_CONTENT="";
_CONTENT+="<HTML>\n";
_CONTENT+="<head>\n";
_CONTENT+="<"+"SCRIPT>\n";
_CONTENT+="function specialInit()\n";
_CONTENT+="{\n";
_CONTENT+="if (document.all || document.layers)\n";
_CONTENT+="window.resizeTo(document.images[0].width+20,document.images[0].height+35);\n";
_CONTENT+="}\n";
_CONTENT+="</"+"SCRIPT>\n";
_CONTENT+="</head>\n";
_CONTENT+="<BODY onLoad='specialInit();' leftmargin='0' topmargin='0'>\n";
_CONTENT+="<"+"SCRIPT>\n";
_CONTENT+="document.write('<center>');\n";
_CONTENT+="document.write('<IMG SRC=\\'"+imageSrc+"\\'>');\n";
_CONTENT+="document.write('</center>')\n";
_CONTENT+="</"+"SCRIPT>\n";
_CONTENT+="</BODY>\n";
_CONTENT+="</HTML>\n";

  var _parms = 'directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=yes';
 var _windowName = "PicViewer";
  if(_PAGE)
  {
    fileName = 'popup.htm?' + escape(imageSrc) + '&amp;' + escape(imageTitle);
    myWindowHandle = window.open(fileName,_windowName,_parms);
  }
  else
  {
    myWindowHandle=window.open("",_windowName,_parms);
    myWindowHandle.document.open();
    myWindowHandle.document.write(_CONTENT);
    myWindowHandle.document.close();
  }
  myWindowHandle.focus();
}
