	$(function() {
		$('a.gallery').lightBox();
                $('a.galleryplan').lightBox();
	});


/**************************************************************
 LTrim: Returns a String containing a copy of a specified
        string without leading spaces

 Parameters:
      String = The required string argument is any valid
               string expression. If string contains null,
               false is returned

 Returns: String
***************************************************************/
function LTrim(String)
{
	var i = 0;
	var j = String.length - 1;

	if (String == null)
		return ("");

	for (i = 0; i < String.length; i++)
	{
		if (String.substr(i, 1) != ' ' &&
		    String.substr(i, 1) != '\t')
			break;
	}

	if (i <= j)
		return (String.substr(i, (j+1)-i));
	else
		return ('');
}

/**************************************************************
 RTrim: Returns a String containing a copy of a specified
        string without trailing spaces

 Parameters:
      String = The required string argument is any valid
               string expression. If string contains null,
               false is returned

 Returns: String
***************************************************************/
function RTrim(String)
{
	var i = 0;
	var j = String.length - 1;

	if (String == null)
		return ("");

	for(j = String.length - 1; j >= 0; j--)
	{
		if (String.substr(j, 1) != ' ' &&
			String.substr(j, 1) != '\t')
		break;
	}

	if (i <= j)
		return (String.substr(i, (j+1)-i));
	else
		return ('');
}

/**************************************************************
 RTrim: Returns a String containing a copy of a specified
        string without both leading and trailing spaces

 Parameters:
      String = The required string argument is any valid
               string expression. If string contains null,
               false is returned

 Returns: String
***************************************************************/
function Trim(String)
{
	if (String == null)
		return ("");

	return RTrim(LTrim(String));
}


function isCurrency(Expression)
{

			Expression = Expression.toLowerCase();
			RefString = "0123456789,";

			if (Expression.length < 1)
				return (false);

			for (var i = 0; i < Expression.length; i++)
			{
				var ch = Expression.substr(i, 1)
				var a = RefString.indexOf(ch, 0)
				if (a == -1)
					return (false);
			}
			return(true);

}
function isInt(Expression)
{

			Expression = Expression.toLowerCase();
			RefString = "0123456789";

			if (Expression.length < 1)
				return (false);

			for (var i = 0; i < Expression.length; i++)
			{
				var ch = Expression.substr(i, 1)
				var a = RefString.indexOf(ch, 0)
				if (a == -1)
					return (false);
			}
			return(true);

}

function isDateShort(strDtm)
	{

	//	check le format de la date (JJ/MM/AA)
	//	strInputName	: le nom du champ date
	//	strName			: le nom de la date pour le msg d'erreur

		var strDtm;
		var strMessage;
		var strMessage2;
		var month;
		var day;
		var year;
		var result;



		if (strDtm.length!=8)
		{
			return false;
		}

		if ((strDtm.charAt(2)!="/") || (strDtm.charAt(5)!="/"))
		{
			return false;
		}

		if ((isNaN(strDtm.charAt(0))==true) ||
			(isNaN(strDtm.charAt(1))==true) ||
			(isNaN(strDtm.charAt(3))==true) ||
			(isNaN(strDtm.charAt(4))==true) ||
			(isNaN(strDtm.charAt(6))==true) ||
			(isNaN(strDtm.charAt(7))==true))
		{
			return false;
		}
		else
		{
			day = Number(strDtm.slice(0,2));
			month = Number(strDtm.slice(3,5));
			year = Number(strDtm.slice(6,8));


			if (day<=0 || day>31)
			{
				return false;
			}

			//alert ('d' + day + 'm' + month);
			switch (month)
			{

				case (1) :
					if (day>31)
						{

							return false;
						}
					break;
				case (3) :
					if (day>31)
						{

							return false;
						}
					break;
				case (5) :
					if (day>31)
						{

							return false;
						}
					break;
				case (7) :
					if (day>31)
						{

							return false;
						}
					break;
				case (8) :
					if (day>31)
						{

							return false;
						}
					break;
				case (10) :
					if (day>31)
						{

							return false;
						}
					break;
				case (12) :
					if (day>31)
						{

							return false;
						}
					break;

				case (4) :
					if (day>30)
						{
							return false;
						}
					break;
				case (6) :
					if (day>30)
						{

							return false;
						}
					break;

				case (9) :
					if (day>30)
						{

							return false;
						}
					break;
				case (11) :
					if (day>30)
						{

							return false;
						}
					break;


				case (2) :
					if (day==29)

						{ if (year%4!=0)
							{

								return false;
							}
						}


					if (day>29)
						{

							return false;
						}

					break;
			/*	case (0) :
						{

							return false;
						}
					break;
			*/
				default :
						{


							return false;
						}

			}

		}

		return true;
	}


var emailexp = /^[a-z][a-z_0-9\-\.]+@[a-z_0-9\.\-]+\.[a-z]{2,3}$/i

function validateEmail(str) {
	return emailexp.test(str)
}
var phoneexp =  /^\d{10}$/
function validatePhone(str) {
	return phoneexp.test(str)
}
function getSepURL(location)
{
	if (location.indexOf('?')==-1)
		return "?";
	else
		return "&";

}


function openTrailer(sUrlTrailer,w,h)
{

	sWopenProperties='resizable=yes,scrollbars=no,status=no,location=no,width='+(parseInt(w)+30)+',height='+(parseInt(h)+30);
	sUrlTrailer = 'http://www.laviedechateau.be/openmedia.asp?urlmedia='+sUrlTrailer+'&w='+w+'&h='+h;

	window.open(sUrlTrailer,"_Trailer",sWopenProperties);

}function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}





}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}




function chkForm(typecheck,oForm)
{



	var messageError="";
	var TitleError="Le(s) champ(s) suivant(s) est/sont incorrect(s) :\n\n"
	var fakeEmail ="you@domain.com";







			register_name=  Trim(document.frm.lastname.value);
			if (register_name==null || register_name=="")
				messageError += "- Le champ nom est obligatoire \n";



			register_email = Trim(document.frm.email.value);
			if (register_email==null || register_email=="")
				messageError += "- Le champ email est obligatoire \n";
			else
				{
				if (!validateEmail(register_email))
					messageError += "- Le champ email est obligatoire \n";
				}

			if (register_email==fakeEmail)
				messageError += "- Le champ email est obligatoire \n";









if (messageError=="")
	return true;
else
{
	messageError = TitleError  + messageError;
	alert (messageError);
	return false;
}


}








	var ArrayMousever = new Array();
	ArrayMousever[17] = "<img src='public/imagesMenu/' border='0'   alt=''>";
				ArrayMousever[18] = "<img src='public/imagesMenu/' border='0'   alt=''>";
				ArrayMousever[19] = "<img src='public/imagesMenu/pic-menu_19.jpg' border='0'   alt=''>";
				ArrayMousever[20] = "<img src='public/imagesMenu/pic-menu_20.jpg' border='0'   alt=''>";
				ArrayMousever[21] = "<img src='public/imagesMenu/' border='0'   alt=''>";
				ArrayMousever[22] = "<img src='public/imagesMenu/' border='0'   alt=''>";
				ArrayMousever[23] = "<img src='public/imagesMenu/pic-menu_23.jpg' border='0'   alt=''>";
				ArrayMousever[24] = "<img src='public/imagesMenu/' border='0'   alt=''>";
				ArrayMousever[2] = "<img src='public/imagesMenu/pic-menu_2.jpg' border='0'   alt=''>";
				ArrayMousever[3] = "<img src='public/imagesMenu/pic-menu_3.jpg' border='0'   alt=''>";
				ArrayMousever[4] = "<img src='public/imagesMenu/pic-menu_4.jpg' border='0'   alt=''>";
				ArrayMousever[5] = "<img src='public/imagesMenu/pic-menu_5.jpg' border='0'   alt=''>";
				ArrayMousever[6] = "<img src='public/imagesMenu/pic-menu_6.jpg' border='0'   alt=''>";
				ArrayMousever[7] = "<img src='public/imagesMenu/pic-menu_7.jpg' border='0'   alt=''>";
				ArrayMousever[8] = "<img src='public/imagesMenu/pic-menu_8.jpg' border='0'   alt=''>";
				ArrayMousever[9] = "<img src='public/imagesMenu/pic-menu_9.jpg' border='0'   alt=''>";
				ArrayMousever[10] = "<img src='public/imagesMenu/pic-menu_10.jpg' border='0'   alt=''>";
				ArrayMousever[11] = "<img src='public/imagesMenu/pic-menu_11.jpg' border='0'   alt=''>";
				ArrayMousever[12] = "<img src='public/imagesMenu/pic-menu_12.jpg' border='0'   alt=''>";
				ArrayMousever[13] = "<img src='public/imagesMenu/pic-menu_13.jpg' border='0'   alt=''>";
				ArrayMousever[14] = "<img src='public/imagesMenu/' border='0'   alt=''>";
				ArrayMousever[15] = "<img src='public/imagesMenu/' border='0'   alt=''>";
				ArrayMousever[16] = "<img src='public/imagesMenu/' border='0'   alt=''>";


	var ContentHTML;
	var BlnSlideShow = true;


	ContentHTML="";
		var idxsave;
	idxsave=-1;



	function onMouseOutMenu(idx)
	{

				if (ContentHTML=="")
						ContentHTML = document.getElementById("tdcontent").innerHTML;


		if(idxsave!=idx)
			if (ArrayMousever[idx]!="")
			{

				document.getElementById("tdcontent").innerHTML = 	ContentHTML;
				BlnSlideShow=true;
			}

	}
	function onMouseClick(idx)
	{


		if (ContentHTML=="")
				ContentHTML = document.getElementById("tdcontent").innerHTML;

		BlnSlideShow=false;

		if (ArrayMousever[idx]!="")
		{
				document.getElementById("tdcontent").innerHTML = '<div class="div-contentnosize" style="OVERFLOW: hidden;width:485px;HEIGHT: 266px" >' + ArrayMousever[idx]+'</div>';
		}
		idxsave = idx;

	}
	function onMouseOverMenu(idx)
	{


		if (ContentHTML=="")
				ContentHTML = document.getElementById("tdcontent").innerHTML;

		BlnSlideShow=false;

			if(idxsave!=idx)
			{
			if (ArrayMousever[idx]!="")
			{

				document.getElementById("tdcontent").innerHTML = '<div class="div-contentnosize" style="OVERFLOW: hidden;width:485px;HEIGHT: 266px" >' + ArrayMousever[idx]+'</div>';

			}
				idxsave=-1;
			}
	}








function windowopen(scr,targ,pro)
{

	window.open(scr,targ,pro);
}



	function oldopenWin(url, windowname, w, h) {
	  newWin=window.open(url, windowname, "scrollbars=yes,width=" + w + ",height=" + h)
	  newWin.focus()
	}
	function launch(newURL, newName, newFeatures, orgName){var remote = open(newURL, newName, newFeatures); if (remote.opener == null) remote.opener = window;remote.opener.name = orgName;return remote;}

	function openwin(url, windowname, width, height){launch(url,"MoveWindow","height="+height+",width="+width+",screenX=" + (screen.availWidth/2 -(width/2)) +",left=" + (screen.availWidth/2 -(width/2)) +",screenY=" + (screen.availHeight/2 - (height/2)) +",top=" + (screen.availHeight/2 - (height/2)) +",alwaysLowered=0,alwaysRaised=1,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,z-lock=0","body_right");}




			/* PICTURE SLIDE SHOW */
			var slideduration = 3000; // milliseconds
			var fadeduration = 0.3 ; // seconds
			var picturepath = new Array(); // picture path array






			var slideTarget = new Array();
			slideTarget[0] = "SlideShow";

			//////////

			var timerobj;
			var pictures = new Array();
			var currentPicture = slideTarget.length;

			var currentTarget = 0;
			for (i = 0; i<picturepath.length; i++){
				pictures[i] = new Image();
				pictures[i].src = picturepath[i];
			}

			function runSlideShow()
			{
				if(BlnSlideShow)
				{
					if (document.images[slideTarget[currentTarget]])
					{
						if (document.all)
						{
								document.images[slideTarget[currentTarget]].style.filter = "blendTrans(duration="+fadeduration+")";
								document.images[slideTarget[currentTarget]].filters.blendTrans.Apply();
						}
						document.images[slideTarget[currentTarget]].src = pictures[currentPicture].src;
						if (document.all)
						{
								document.images[slideTarget[currentTarget]].filters.blendTrans.Play();
						}
						timerobj = setTimeout("runSlideShow()", slideduration);
						currentPicture++;
						if ( currentPicture >= picturepath.length)
						{
							currentPicture = 0;
						}
						currentTarget++;
						if ( currentTarget >= slideTarget.length)
						{
							currentTarget = 0;
						}
					}
				}
				else
				{
					timerobj = setTimeout("runSlideShow()", slideduration);
				}

			}
			/* END PICTURE SLIDE SHOW */


						if (pictures.length > slideTarget.length )
					 {
					 	currentPicture + slideTarget.length;
					 	timerobj = setTimeout("runSlideShow()", slideduration);
					 }



	function windowonload()
	{









	}
