// JavaScript Document

function getAdoptionDate(langue) { 
	adoptiondate = new Array;
	adoptiondate['fr'] = "CHAQUE SAMEDI, SUR R.D.V.";	
	adoptiondate['en'] = "EVERY SATURDAY, with appointment";	
	return adoptiondate[langue];
}

// Gallery script.
// With image cross fade effect for those browsers that support it.
// Script copyright (C) 2004 www.cryer.co.uk.
// Script is free to use provided this copyright header is included.
function LoadGallery(pictureName,imageFile,titleCaption,captionText)
{
  if (document.all)
  {
    document.getElementById(pictureName).style.filter="blendTrans(duration=1)";
    document.getElementById(pictureName).filters.blendTrans.Apply();
  }
  document.getElementById(pictureName).src = imageFile;
  if (document.all)
  {
    document.getElementById(pictureName).filters.blendTrans.Play();
  }
  document.getElementById(titleCaption).innerHTML=captionText;
}


// General Form utility functions
function goBack1() {
    parent.otherFrameName.history.go(-1);
    setTimeout=('goBack2()',1000); // go back 2nd time after a seconds delay
}

function goBack2() {
    parent.otherFrameName.history.go(-1);
}

function ValidateEmail(email)
{
	posArobas = email.indexOf("@");					// 16
	if ( posArobas == -1 ) 
	{	// alert("posArobas"); 
		return -1;
	}

	username = email.substring( 0, posArobas );			
	if ( username == "" ) 
	{	// alert("username"); 
		return -1;
	}

	domaine = email.substring( posArobas + 1, email.length );	// ml5.com
	if ( domaine == "" ) 
	{	// alert("domaine"); 
		return -1;
	}

	posPoint = domaine.lastIndexOf(".");				// 20
	if ( posPoint == -1 ) 
	{	// alert("posPoint"); 
		return -1;
	}

	host = domaine.substring( 0, posPoint );			// ml5
	if ( host == "" ) 
	{	// alert("host"); 
		return -1;
	}

	extension = domaine.substring( posPoint + 1, domaine.length );	// com
	if ( extension == "" ) 
	{	// alert("extension"); 
		return -1;
	}

	return 1;
}

function validation_form_accueil(form2)
{
	var pass_star=true;

	//alert("validation_form_accueil");

	// Verify mandatory fields
	if ( "" == form2.nom.value )		{	pass_star=false;	}
	if ( "" == form2.degriffe.value )	{	pass_star=false;	}
	if ( "" == form2.email.value  )		{	pass_star=false;	}

	if (false == pass_star){
		alert("Vous devez remplir tous les champs marqués d'une *");
		return false;
	}
	// else pass_star is true

	if ( 1 != ValidateEmail(form2.email.value) ) 
	{
		alert("Vérifiez l'adresse de courriel que vous avez entrée.");
		return false;
	}
	// else pass_star is true

	// Everything's ok ... submit
	//alert("validation_form_accueil: Everything's ok ... submit");
	form2.submit();
	return true;

}

function validation_form_adoption(form2)
{
	var pass = true;
	var radio_choice = false;

	// Loop from zero to the one minus the number of radio button selections
	for (counter = 0; counter < form2.exterieur.length; counter++)
	{
	// If a radio button has been selected it will return true
	// (If not it will return false)
		if (form2.exterieur[counter].checked)	radio_choice = true; 
	}

	// If there were no selections made display an alert box
	if ( false == radio_choice ) 		{  	pass=false;		}
	if ( "" == form2.nom.value )		{	pass=false;		}
	if ( "" == form2.degriffe.value )	{	pass=false;		}
	if ( "" == form2.email.value )		{	pass=false;		}
	
	if ( false == pass) {
		alert("Vous devez remplir tous les champs marqués d'une *");
		return false;
	}

	if ( 1 != ValidateEmail(form2.email.value) )	{		
		alert("Vérifiez l'adresse de courriel que vous avez entrée.");
		return false;
	}

	form2.submit();
	return true;
}

function validation_newsletter_form(form2)
{
	var pass_star=true;

	if ( "" == form2.prenom.value )		{		pass_star=false;	}
	if ( "" == form2.nom.value )		{		pass_star=false;	}
	if ( "" == form2.email.value )		{		pass_star=false;	}
	
	if ( false == pass_star ){
		alert("Vous devez remplir tous les champs requis.");
		return false;
	}
	
	if ( 1 != ValidateEmail(form2.email.value) ) 
	{	
		alert("Vérifiez l'adresse de courriel que vous avez entrée.");
		return false;
	}

	// Everything's ok, submit
	form2.submit();
	return true;
}

function validation_contact_form(form2)
{
	var pass_star=true;

	if ( "" == form2.nom.value )		{		pass_star=false;	}
	if ( "" == form2.email.value )		{		pass_star=false;	}
	
	if ( false == pass_star ){
		alert("Vous devez remplir tous les champs requis.");
		return false;
	}
	
	if ( 1 != ValidateEmail(form2.email.value) ) 
	{	
		alert("Vérifiez l'adresse de courriel que vous avez entrée.");
		return false;
	}

	// Everything's ok, submit
	form2.submit();
	return true;
}

/*
              <table width="238" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td colspan="3"><img src="images/fr/top-encadre-petit.gif" width="238" height="32" /></td>
                </tr>
                <tr> 
                  <td width="10" bgcolor="#1F94C9"><img src="images/spacer.gif" width="10" height="30" /></td>
                  <td valign="top" bgcolor="#1F94C9" width="211"> 
                    <p align="center">
					  <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
					  <b>SAMEDI 17 JUIN </b></font>
					  <br />
                      <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">
					  Pour plus d'informations, <br />
                      <a href="formulaire-adoption.php"><b><font color="#ffffff">contactez-nous</font></b></a></font> 
                    </p>
                  </td>
                  <td valign="top" width="17"><img src="images/right-encadre-petit.gif" width="17" height="65" /></td>
                </tr>
                <tr> 
                  <td colspan="3"> <img src="images/bas-encadre-petit.gif" width="238" height="23" /></td>
                </tr>
              </table>
*/
function DrawJourneeAdoption() { 

	var htmlcode=" \
			 <!-- Section Journee d'adoption --> \n \
              <table width=\"238\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"male\"> \n \
                <tr> \n \
                  <td colspan=\"3\"><img src=\"../images/fr/top-encadre-petit.gif\" width=\"238\" height=\"32\" \/><\/td> \n \
                <\/tr> \n \
                <tr> \n \
                  <td width=\"10\"><img src=\"../images/spacer.gif\" width=\"10\" height=\"30\" \/><\/td> \n \
                  <td valign=\"top\" width=\"211\"> \n \
                    <p align=\"center\" class=\"defaut bold dateadoption\"> \n \ " 
					+ getAdoptionDate('fr') + " </p> \n \
                    <p align=\"center\" class=\"defaut blanc\">Pour plus d'informations, <a href=\"/fr/contacts.html\" class=\"bold blanc\">contactez-nous</a>.</p> \n \
                  <\/td>\n \
                  <td valign=\"top\" width=\"17\"><img src=\"../images\/right-encadre-petit.gif\" width=\"17\" height=\"65\" \/><\/td>\n \
                <\/tr>\n \
                <tr> \n \
                  <td colspan=\"3\"> <img src=\"../images/bas-encadre-petit.gif\" width=\"238\" height=\"23\" \/><\/td>\n \
                <\/tr>\n \
              <\/table>\n \
			  <!-- Fin Section Journee d'adoption -->\n";
			  
	document.write(htmlcode);
}

/*
					<!-- SiteSearch Google -->
				<table border="0" align="center" id="google_search">
				<form method="get" action="http://www.google.ca/custom" target="google_window">
				<tr>
				<td align="right" nowrap="nowrap" bordercolor="#0066CC">
				<a href="http://www.google.com/">
<img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle" /></a>
<br/>
				<input type="hidden" name="domains" value="www.sphinxprojet.com" />
				<input type="text" name="q" size="20" maxlength="255" value="" />
				<br/>
				<select name="sitesearch">
				  <option value="www.sphinxprojet.com">Projet Sphinx</option>
				  <option value="">Web</option>
				</select>
				<br/>
				<input type="submit" name="sa" value="Chercher" />
				<br/>
					
				<input type="hidden" name="client2" value="pub-4270624150596740" />
				<input type="hidden" name="forid2" value="1" />
				<input type="hidden" name="ie2" value="ISO-8859-1" />
				<input type="hidden" name="oe2" value="ISO-8859-1" />
				<input type="hidden" name="cof2" value="GALT:#0066CC;GL:1;DIV:#999999;VLC:336633;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0066CC;LC:0066CC;T:000000;GFNT:666666;GIMP:666666;LH:31;LW:50;L:http://www.sphinxprojet.com/images/logo.jpg;S:http://www.sphinxprojet.com;FORID:1;" />
				<input type="hidden" name="hl2" value="fr" />
			</td>
				</tr>
				</form>
				</table>
									<!-- SiteSearch Google -->
*/
function DrawGoogleSearchBox(langue) { 

    projetsphinx = new Array;
	projetsphinx['en'] = "Sphinx Project";
	projetsphinx['fr'] = "Projet Sphinx";
	projetsphinx['bi'] = "Projet Sphinx Project";
	
	chercher = new Array;
	chercher['en'] = "Search";
	chercher['fr'] = "Chercher";
	chercher['bi'] = "Chercher/Search";
	
	var htmlcode=" \
					<!-- SiteSearch Google -->	\n \
				<table border=\"0\" align=\"center\" id=\"google_search\"> \n \
				<form method=\"get\" action=\"http:\/\/www.google.ca\/custom\" target=\"google_window\"> \n \
				<tr> \n \
				<td align=\"right\" nowrap=\"nowrap\"> \n \
				<a href=\"http:\/\/www.google.com\/\"> \n \
<img src=\"http:\/\/www.google.com\/logos\/Logo_25wht.gif\" border=\"0\" alt=\"Google\" align=\"middle\" \/><\/a> \n \
<br\/> \n \
				<input type=\"hidden\" name=\"domains\" value=\"www.sphinxprojet.com\" \/> \n \
				<input type=\"text\" name=\"q\" size=\"20\" maxlength=\"255\" value=\"\" \/> \n \
				<br\/> \n \
				<select name=\"sitesearch\"> \n \
				  <option value=\"www.sphinxprojet.com\">" + projetsphinx[langue] + "<\/option> \n \
				  <option value=\"\">Web<\/option> \n \
				<\/select> \n \
				<br\/> \n \
				<input type=\"submit\" name=\"sa\" value=\"" + chercher[langue] + "\" \/> \n \
				<br\/> \n \
					 \n \
				<input type=\"hidden\" name=\"client2\" value=\"pub-4270624150596740\" \/> \n \
				<input type=\"hidden\" name=\"forid2\" value=\"1\" \/> \n \
				<input type=\"hidden\" name=\"ie2\" value=\"ISO-8859-15\" \/> \n \
				<input type=\"hidden\" name=\"oe2\" value=\"ISO-8859-15\" \/> \n \
				<input type=\"hidden\" name=\"cof2\" value=\"GALT:#0066CC;GL:1;DIV:#999999;VLC:336633;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0066CC;LC:0066CC;T:000000;GFNT:666666;GIMP:666666;LH:31;LW:50;L:http:\/\/www.sphinxprojet.com\/images\/logo.jpg;S:http:\/\/www.sphinxprojet.com;FORID:1;\" \/> \n \
				<input type=\"hidden\" name=\"hl2\" value=\"fr\" \/> \n \
			<\/td> \n \
				<\/tr> \n \
				<\/form> \n \
				<\/table> \n \
									<!-- SiteSearch Google --> \n \
";
			  
	document.write(htmlcode);
}
