﻿// Fichier JScript

function showEncart(encartElement)
{
  Element.show(encartElement);
  if (encartElement == $('diveglise')) { Element.hide($('divbatiment')); }
  if (encartElement == $('divbatiment')) { Element.hide($('diveglise')); }
}


var _nom, _prenom, _mail

function VerifForm()
{
	var isOk = true;
	
	if (!VerifChamps($('ctl00_ContentPlaceHolder1_client_nom'))) { isOk = false; }
	
	if (!VerifChamps($('ctl00_ContentPlaceHolder1_client_prenom'))) { isOk = false; }
	
	if (!VerifChamps($('ctl00_ContentPlaceHolder1_client_tel'))) { isOk = false; }
	
	if (!VerifMail($('ctl00_ContentPlaceHolder1_client_email'))) { isOk = false; }
	
	return isOk;
}

function VerifChamps(c)
{
	if (!c.value)
	{
		c.className = 'champcontacterreur';
		return false;
  }
	else
	{
		c.className = 'champcontact';
		return true;
	}
}

function FocusChamps(c)
{
	c.className = 'champfocus';
}

function changeClass(o, c)
{
	o.className = c;
}

function BlurChamps(c)
{
	c.className = 'champcontact';
}

function VerifMail(c)
{
	if (!c.value)
	{
		c.className = 'champcontacterreur';
		return false;
	}
	else if (c.value.search(/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/) == -1)
	{
		c.className = 'champcontacterreur';
		return false;
	}
	else
	{
		c.className = 'champcontact';
		return true;
	}
}
