function CheckNumeric(e)
{
  var key //= (window.event) ? event.keyCode : e.which;
  if (window.event)
    key = event.keyCode
  else
    key = e.which
 
  // Was key that was pressed a numeric character (0-9) or backspace (8)?
  if ( key > 47 && key < 58 || key == 8 )
    return; // if so, do nothing
  else // otherwise, discard character
    if (window.event) //IE
      window.event.returnValue = null;     
    else //Firefox
      e.preventDefault();
}

function VerifyFields(source, arguments)
{
    var sDepartment,sCity,sExpertise,sToutes, sTous;
    var oSpeciality;
    sCity = document.getElementById(oCity).value;
    sDepartment = document.getElementById(oDepartment).value;
    oSpeciality=document.getElementById(oExpertise);
    //sToutes = document.getElementById(oToutes).value;
    //sTous = document.getElementById(oTous).value;
    if ((sDepartment != "") || (sCity != "") || (oSpeciality.selectedIndex !='0'))
	{
	    arguments.IsValid=true;
        return;
	}
	else
	{
        arguments.IsValid=false;
	}
}

function validateCity(oEvent, sLiteral) 
{
	var lLength;
	var sString = document.getElementById(sLiteral).value;
	var obj;
	if (navigator.appName.indexOf("Explorer")==-1) 
	{
		obj=oEvent.target;
		lLength=parseInt(obj.value.length,10);
	} 
	else 
	{
		obj=oEvent.srcElement;
		lLength=parseInt(obj.value.length,10);
	}
	if (lLength==0) 
	{
	    obj.value= sString;	
    }
}

function validateDepartment(oEvent, sLiteral) 
{
	var lLength;
	var sString = document.getElementById(sLiteral).value;
	var obj;
	if (navigator.appName.indexOf("Explorer")==-1) 
	{
		obj=oEvent.target;
		lLength=parseInt(obj.value.length,10);
	} 
	else 
	{
		obj=oEvent.srcElement;
		lLength=parseInt(obj.value.length,10);
	}
	if (lLength==0) 
	{
	    obj.value= sString;	
    }
}
 
function OpenWindowInfoslegales()
{
	var oWindow;
	oWindow = window.open("/Pages/Infos-legales.aspx", "infoslegales", "directories=no, scrollbar=no, width=500px, height=500px, top=50px, left=100px, location=no, resizeable=no, titlebar=yes");
}

function EnterPress(oEvent)
{
    var iAscii; 
     
    if (window.event) 
        iAscii = oEvent.keyCode; 
    else
        iAscii = oEvent.which; 
      
    if (iAscii == 13)
    {
        document.getElementById(oButtonSearch).click();
    }

    return true; 
} 

function CheckNumericIntro(e)
{
  var key //= (window.event) ? event.keyCode : e.which;
  if (window.event)
    key = event.keyCode
  else
    key = e.which
  
  if (key == 13) //Intro
  {
        document.getElementById(oButtonSearch).click();
  }
  else
  {
      // Was key that was pressed a numeric character (0-9) or backspace (8)?
      if ( key > 47 && key < 58 || key == 8 )
        return; // if so, do nothing
      else // otherwise, discard character
        if (window.event) //IE
          window.event.returnValue = null;     
        else //Firefox
          e.preventDefault();
   }
}

function VerifyFieldsUserContactForm(source, arguments)
{	
	var ddlObject = document.getElementById(oObject);
    if (ddlObject.selectedIndex !='0')
	{
	    arguments.IsValid=true;
        return;
	}
	else
	{
        arguments.IsValid=false;
	}
}


function VerifyMailsRecommendPageForm(source, arguments)
{	
    var reg = new RegExp("^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$");
   
	var ddlObject = document.getElementById(otxtRecipientsObject);
    if (ddlObject.value!="")
	{
	    arguments.IsValid=true;
	    var mails= ddlObject.value.replace(/ /g,"").split(";");
	    for(var i=0; i<mails.length ;i++)
	    {
	        if(reg.test(mails[i])==false) arguments.IsValid=false;    
	    }
        return;
	}
	else
	{
        arguments.IsValid=false;
	}
}

function LinkPreviousPage()
{   
    history.back(); 
}