/*ssmenu*/
var cParent;
var cMenu;
function Pos(thisitem)
{
	if(typeof(thisitem) != 'object') {thisitem = document.getElementById(thisitem);}
	var ww = thisitem.offsetWidth, hh = thisitem.offsetHeight;
	for (var xx = 0,yy = 0; thisitem != null; xx += thisitem.offsetLeft,yy += thisitem.offsetTop,thisitem = thisitem.offsetParent);
	return {Left:xx, Top:yy, Right:xx + ww, Bottom:yy + hh}
}

function ShowMenu(currentParent, currentMenu)
{
	cMenu = currentMenu;
	
	currentMenu = document.getElementById(currentMenu);
	currentMenu.style.left = Pos(currentParent).Right + 'px';
	currentMenu.style.top = Pos(currentParent).Top + 'px';
	currentMenu.style.visibility = 'visible';

	cParent = currentParent;
}
		
function HoldMenu()
{
	ShowMenu(cParent, cMenu);
}
		
function HideMenu(hideMenu)
{
	hideMenu = document.getElementById(hideMenu);
	hideMenu.style.visibility = 'hidden';
}

function openPopUp(url, w, h, scrollb) 
{
	if( !scrollb ) scrollb = 0;
	var iLeft = (screen.width  - w) / 2 ;
	var iTop  = (screen.height - h) / 2 ;
	var sOptions = "toolbar=0,status=0,resizable=0,scrollbars=" + scrollb ;
		sOptions += ",width=" + w ; 
		sOptions += ",height=" + h ;
		sOptions += ",left=" + iLeft ;
		sOptions += ",top=" + iTop ;
		window.open( url, "_popup", sOptions ) ;
}

String.prototype.isEmpty = function()
{
	return this.match(/^\s*$/);
}

String.prototype.isInteger = function()
{
	return this.match(/^[0-9]+$/);
}

String.prototype.isFloat = function()
{
	return this.match(/^([0-9]+|[0-9]+\.[0-9]+)$/);
}

String.prototype.isEmail = function()
{
	return this.match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/);
}

function frmCheck(myForm)
{
	if( myForm.societe.value.isEmpty() )
	{
		alert( 'Le champ Société est obligatoire' );
		myForm.societe.focus();	
		return(false);
	}
	if( myForm.secteur.value.isEmpty() )
	{
		alert( "Le champ Secteur d'activité est obligatoire" );
		myForm.secteur.focus();	
		return(false);
	}
	if( myForm.nom.value.isEmpty() )
	{
		alert( 'Le champ Nom est obligatoire' );
		myForm.nom.focus();
		return(false);
	}
	if( myForm.prenom.value.isEmpty() )
	{
		alert( 'Le champ Prenom est obligatoire' );
		myForm.prenom.focus();
		return(false);
	}

	if( myForm.adresse1.value.isEmpty() )
	{
		alert( 'Le champ Adresse1 est obligatoire' );
		myForm.adresse1.focus();
		return(false);
	}
	if( myForm.cp.value.isEmpty() )
	{
		alert( 'Le champ Code postal  est obligatoire' );
		myForm.cp.focus();
		return(false);
	}
	if( myForm.ville.value.isEmpty() )
	{
		alert( 'Le champ Ville est obligatoire' );
		myForm.ville.focus();
		return(false);
	}
	if( myForm.pays.value.isEmpty() )
	{
		alert( 'Le champ Pays  est obligatoire' );
		myForm.pays.focus();
		return(false);
	}
	if( myForm.email.value.isEmpty() )
	{
		alert( 'Le champ Email  est obligatoire' );
		myForm.email.focus();
		return(false);
	}
	else
	{
		if( !myForm.email.value.isEmail() )
		{
			alert( 'Le champ Email  est invalide' );
			myForm.email.focus();
			return(false);
		}
	}
	if( myForm.tel.value.isEmpty() )
	{
		alert( 'Le champ Téléphone  est obligatoire' );
		myForm.tel.focus();
		return(false);
	}
	/****************modif khalid*********************************/
	mcochia = false ;
	for (i = 0; i < myForm.typeR.length;i++)
	{
		if(myForm.typeR[i].checked)
		{
			mcochia = true;
			
		}
	}
	 if(!mcochia)
	 {
		 alert( 'Veuillez sélectionner le type de réception de votre kit' );
		 return(false);
	 }
	/**********************fin modif khalid****************************/
	return(true);
}
/* ---------------------- */
function _Check()
{
	if( form.societe.value.isEmpty() )
	{
		alert( 'Le champ Société est obligatoire' );
		form.societe.focus();	
		return(false);
	}
		
	if( form.nom.value.isEmpty() )
	{
		alert( 'Le champ Nom est obligatoire' );
		form.nom.focus();
		return(false);
	}
	if( form.prenom.value.isEmpty() )
	{
		alert( 'Le champ Prenom est obligatoire' );
		form.prenom.focus();
		return(false);
	}
		if( form.fonction.value.isEmpty() )
	{
		alert( 'Le champ Prenom est obligatoire' );
		form.fonction.focus();
		return(false);
	}

	if( form.adresse1.value.isEmpty() )
	{
		alert( 'Le champ Adresse1 est obligatoire' );
		form.adresse1.focus();
		return(false);
	}
	if( form.cp.value.isEmpty() )
	{
		alert( 'Le champ Code postal  est obligatoire' );
		form.cp.focus();
		return(false);
	}
	if( form.ville.value.isEmpty() )
	{
		alert( 'Le champ Ville est obligatoire' );
		form.ville.focus();
		return(false);
	}
	if( form.pays.value.isEmpty() )
	{
		alert( 'Le champ Pays  est obligatoire' );
		form.pays.focus();
		return(false);
	}
	
	if( form.tel.value.isEmpty() )
	{
		alert( 'Le champ Téléphone  est obligatoire' );
		form.tel.focus();
		return(false);
	}
	if( form.telc.value.isEmpty() )
	{
		alert( 'Le champ Téléphone  est obligatoire' );
		form.telc.focus();
		return(false);
	}
	if( form.cn.value.isEmpty() )
	{
		alert( 'Le champ Téléphone  est obligatoire' );
		form.cn.focus();
		return(false);
	}
	if( form.email.value.isEmpty() )
	{
		alert( 'Le champ Email  est obligatoire' );
		form.email.focus();
		return(false);
	}
	else
	{
	if( !form.email.value.isEmail() )
		{
			alert( 'Le champ Email  est invalide' );
			form.email.focus();
			return(false);
		}
	}
	if( form.domaine.value.isEmpty() )
	{
		alert( 'Le champ Téléphone  est obligatoire' );
		form.domaine.focus();
		return(false);
	}	
		document.open("Bon_imp.htm","","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=1,top=1,left=50,width=800,height=700");

	
}
