var NS = (document.layers) ? 1 : 0;
var IE = (document.all && document.getElementById) ? 1 : 0;
var N6 = (!document.all && document.getElementById) ? 1 : 0;

function MM_findObj(n, d) { //v3.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); return x;
}
/* Functions that swaps images. */
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 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;
}

/* Functions that handle preload. */
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 loadImages(){
   MM_preloadImages(
'images/lang_eng_on.gif','images/lang_eng_off.gif',
'images/lang_fr_on.gif','images/lang_fr_off.gif',
'images/hmenu_activites_off.gif', 'images/hmenu_activites_on.gif',
'images/hmenu_lauberge_off.gif', 'images/hmenu_lauberge_on.gif',
'images/hmenu_reservation_off.gif', 'images/hmenu_reservation_on.gif',
'images/topmenu_activites_off.gif', 'images/topmenu_activites_on.gif',
'images/topmenu_lauberge_off.gif', 'images/topmenu_lauberge_on.gif',
'images/topmenu_reservation_off.gif', 'images/topmenu_reservation_on.gif',
'images/submenu_bar_off.gif','images/submenu_bar_on.gif',
'images/submenu_calendrier_off.gif','images/submenu_calendrier_on.gif',
'images/submenu_chambres_off.gif','images/submenu_chambres_on.gif',
'images/submenu_contact_off.gif','images/submenu_contact_on.gif',
'images/submenu_hors_off.gif','images/submenu_hors_on.gif',
'images/submenu_jardin_off.gif','images/submenu_jardin_on.gif',
'images/submenu_recommandons_off.gif','images/submenu_recommandons_on.gif',
'images/submenu_restaurant_off.gif','images/submenu_restaurant_on.gif',
'images/submenu_traifs_off.gif','images/submenu_traifs_on.gif'
);
}

function GetStyle(name) {
   if (document.getElementById)
      return document.getElementById(name).style;
   else if (document.all)
      return document.all[name].style;
   else {
      var el = document.layers[name];
      if (el != null)   return el;
      for (var i=0; i<document.layers.length; i++) {
         el = document.layers[i].document.layers[name];
         if (el != null)   return el;
      }//end-for-i
   }//end-if  
}//end-func-GetStyle

function styleRoll(span, vis) {
   var el = GetStyle(span);
   var state = vis? 'visible':'hidden';
   el.visibility = state;
}//end-func-styleRoll

function imageSwap3On(theImage, theSrc, span) {
   imageSwap2(theImage, theSrc);
   styleRoll(span, true);
}//end-func-imageSwap3On

function imageSwap3Off(theImage, theSrc, span) {
   imageSwap2(theImage, theSrc);
   styleRoll(span, false);
}//end-func-imageSwap3Off

function imageSwap2(theImage, theSrc) {
   if (document.images) {
      var img = document.images[theImage];
      if (img)   img.src = theSrc;
      else {
         for (var i=0; i<document.images.length; i++) {
            if (document.images[i].name == theSrc) {
               document.images[i].src = theSrc;
               return;
            }//end-if
         }//end-for-i
      }//end-if-img
   }//end-if-document.images
}//end-func-imageSwap2


function View(winname,theURL,top,left,width,height) 
{
	msgWindow = window.open('','','menubar=no,scrollbars=no,toolbar=no,location=no,titlebar=yes,resizable=yes,status=no,screenX=0,top='+top+',screenY=0,left='+left+',width='+width+',height='+height+'');

	msgWindow.location.href = theURL;

	if (msgWindow.opener == null) 
		msgWindow.opener = self;

}

function View2(winname,theURL,top,left,width,height)
{
        msgWindow = window.open(theURL,winname,'menubar=no,scrollbars=yes,toolbar=no,location=no,titlebar=no,resizable=no,status=no,screenX=0,top='+top+',screenY=0,left='+left+',width='+width+',height='+height+'');

        if (msgWindow.opener == null)
                msgWindow.opener = self;

}

function showimage(img_name) {
	var str = "scrollbars=no,width=640,height=660,status=no,left=0,screenX=0,top=0,screenY=0";
	str += ",resizable"; // so the user can resize the newwindow manually
	var newwin = window.open('','', str);
	var content = "";
	content += "<html>\n\r";
	content += "<title>Map</title>\n\r";
	content += "<head>\n\r";
	content += "<script language=javascript src=\"/web/common.js\"></script>\n\r";
	content += "<link href=\"/web/common.css\" rel=\"stylesheet\" type=\"text/css\">\n\r";
	content += "</head>\n\r";
	content += "<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 class=\"bgmain mainbgcolor\">\n\r";
	content += "<table width=\"640\" height=\"640\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"mainbgline\">\n\r";
	content += "<tr><td><img src=\"/web/images/blank.gif\" width=10 height=10 border=0></td></tr>\n\r";
	content += "<tr><td valign=center align=center>\n\r";
	content += "<table width=620 height=620 cellspacing=0 cellpadding=0 border=0 bgcolor=#E7E7E7>\n\r";
	content += "<tr>\n\r";
	content += "<td><img src=\"/web/images/blank.gif\" width=10 height=1 border=0></td>\n\r";
	content += "<td><img src=\"/web/images/blank.gif\" width=600 height=1 border=0></td>\n\r";
	content += "<td><img src=\"/web/images/blank.gif\" width=10 height=1 border=0></td>\n\r";
	content += "</tr>\n\r";
	content += "<tr><td colspan=3><img src=\"/web/images/blank.gif\" width=1 height=9 border=0></td></tr>\n\r";
	content += "<tr>\n\r";
	content += "<td></td>\n\r";
	content += "<td align=center valign=center height=600>\n\r";
	content += "<img src=\"/web/images/"+img_name+"\" border=0>\n\r";
	content += "</td>\n\r";
	content += "<td></td>\n\r";
	content += "</tr>\n\r";
	content += "<tr><td colspan=3><img src=\"/web/images/blank.gif\" width=1 height=10 border=0></td></tr>\n\r";
	content += "</table>\n\r";
	content += "</tr>\n\r";
	content += "<tr><td><img src=\"/web/images/blank.gif\" width=1 height=10 border=0></td></tr>\n\r";
	content += "<tr><td align=center><a href=\"javascript:self.close();window.close()\" onMouseOut=\"MM_swapImgRestore();\" onMouseOver=\"MM_swapImage('close','','/web/images/close_on.gif',1)\"><img src=\"/web/images/close_off.gif\" border=0 name=\"close\"></a></td></tr>\n\r";
	content += "<tr><td><img src=\"/web/images/blank.gif\" width=1 height=10 border=0></td></tr>\n\r";
	content += "</table>\n\r";
	content += "</body>\n\r";
	content += "</html>\n\r";


	newwin.document.write(content);
}
