// JavaScript Document
// JavaScript Document
function RunFoo(swf, hauteur, largeur, couleur, nom, mavariable) {
document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\""+hauteur+"\" height=\""+largeur+"\" id=\""+nom+"\" align=\"middle\">\n");
document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n");
document.write("<param name=\"movie\" value=\""+swf+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"bgcolor\" value=\""+couleur+"\" /><param name=\"FlashVars\" value=\""+mavariable+"\" /><embed src=\""+swf+"\" FlashVars=\""+mavariable+"\" quality=\"high\" wmode=\"transparent\" bgcolor=\""+couleur+"\" width=\""+hauteur+"\" height=\""+largeur+"\" name=\""+nom+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n");
document.write("</object>\n");
}
function Cimg(chemin, image) {
//var content ='"+chemin+"/"+image+"';
document.hotel.src=""+chemin+"/"+image+"";
}
function visibilite(thingId)
{
var targetElement;
targetElement = document.getElementById(thingId) ;
if (targetElement.style.display == "none")
{
targetElement.style.display = "" ;
} else {
targetElement.style.display = "none" ;
}
}
//    compter
var submitcount=0;
function checkSubmit() {

if (submitcount == 0)
{
submitcount++;
document.form2.submit();
}
}


function wordCounter(field, countfield, maxlimit) {
wordcounter=0;
for (x=0;x<field.value.length;x++) {
if (field.value.charAt(x) == " " && field.value.charAt(x-1) != " ") {wordcounter++} // Counts the spaces while ignoring double spaces, usually one in between each word.
if (wordcounter > 250) {field.value = field.value.substring(0, x);}
else {countfield.value = maxlimit - wordcounter;}
}
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
{field.value = field.value.substring(0, maxlimit);}
else
{countfield.value = maxlimit - field.value.length;}
}
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.01
  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 && d.getElementById) x=d.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 montre(id) {
	  if (document.getElementById) {
		  document.getElementById(id).style.visibility="visible";
		} else if (document.all) {
		  document.all[id].style.visibility="visible";
		} else if (document.layers) {
		  document.layers[id].visibility="visible";
		} } 
		
    function cache(id) {
	  if (document.getElementById) {
		  document.getElementById(id).style.visibility="hidden";
		} else if (document.all) {
		  document.all[id].style.visibility="hidden";
		} else if (document.layers) {
		  document.layers[id].visibility="hidden";
		} }
		
function popup(page,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}
function PopCenter(page,largeur,hauteur,options) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

function Cgal(gal, chemin)
{
var layout = "#000000"; // Couleur de fond de calque
var targetElement;
targetElement = document.getElementById('Viewer') ;
if (targetElement.style.display == "none")
{
targetElement.style.display = "" ;
 
	var content ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="800" height="600" id="c_gal" align="middle"><param name="allowScriptAccess" value="sameDomain" />';
	content +='<param name="movie" value="cgal/cgal-viewer.swf" /><param name="menu" value="false" /><param name="flashvars" value="galerie='+gal+'&chemin='+chemin+'"><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="'+layout+'" />';
	content +='<embed src="cgal/cgal-viewer.swf" width="800" height="600" align="middle" menu="false" flashvars="galerie='+gal+'&chemin='+chemin+'" quality="high" wmode="transparent" bgcolor="'+layout+'" name="c_gal" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>';

	 document.all("Viewer").innerHTML=content;
	 targetElement.style.top = document.body.scrollTop+20; 
	
} else {
targetElement.style.display = "none" ;
}
}
