/********************************
www.studio-calico.com - v1.0
(c) Copyright 2009 Calico
contact@studio-calico.com
********************************/
/*
var liste_images = new Array('images/visite/sam.jpg', 'images/visite/chambre1.jpg', 'images/visite/chambre2.jpg', 'images/visite/chambre3.jpg', 'images/visite/hall.jpg', 'images/visite/cuisine.jpg', 'images/visite/sam.jpg'); //on crée le tableau contenant les images
document.image_chargee = new Array(); //on crée un deuxième tableau où on va stocker les images pour le preload
    
function prechargement() {
  for(i=0;i<liste_images.length;i++){ //boucle pour lister tous les éléments du tableau
	document.image_chargee[i] = new Image; //on crée la nouvelle image(virtuellement car non affichée)
	document.image_chargee[i].src = liste_images[i]; //on indique la source pour le tableau
  }
}
*/
function wop(nompage,largeur,hauteur) {
	window.open(nompage,"pop","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+largeur+",height="+hauteur);
}

function GetId(id) {
	return document.getElementById(id);
}

function changeOpac(opacity, id, where, what, limit, sens) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
	if((opacity==0) && (where=="actualite") && (sens=="moins")) {
		changeContent(where,what,limit);
	}
	else if((opacity==0) && (where=="change_actu") && (sens=="moins")) {
		changeActu(what);
	}
}

function opacity(id, opacStart, opacEnd, millisec,where,what,limit) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "','" +where+ "'," +what+ "," +limit+ ",'moins')",(timer * speed));
			timer++;
		}
	}
	else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++) {
			setTimeout("changeOpac(" + i + ",'" + id + "','','','','plus')",(timer * speed));
			timer++;
		}
	}
}

function ShowInnerHtml(Where, toData) {
	if (document.getElementById) {
		if (document.getElementById(Where)) {
			document.getElementById(Where).innerHTML = toData;
		}
	}
}

function checkForm(formid) {
	theform=document.getElementById(formid);
    if(formid=="form") {
		if(theform.nom.value=="") {alert("Veuillez saisir votre Nom");theform.nom.focus();}
		else if(theform.prenom.value=="") {alert("Veuillez saisir votre prenom");theform.prenom.focus();}
		else if(theform.adr.value=="") {alert("Veuillez saisir votre adresse");theform.adr.focus();}
		else if(theform.cp.value=="") {alert("Veuillez saisir votre code postal");theform.cp.focus();}
		else if(theform.ville.value=="") {alert("Veuillez saisir votre ville");theform.ville.focus();}
		else if(theform.tel.value=="") {alert("Veuillez saisir votre numéro de téléphone");theform.tel.focus();}
		else if((theform.mail.value.indexOf("@")>=0) && (theform.mail.value.indexOf(".")>=0)) {
			  var reg = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/
			  if(reg.exec(theform.mail.value) == null) alert("L'adresse mail que vous avez entré est invalide");
			  else theform.submit();
		}
		else {alert("L'adresse mail que vous avez entré est invalide");theform.mel.focus();}
    }   
}

function refreshChat(where) {
    setInterval("sendMsgI('"+where+"refresh','','')",3000);
}
