function MM_swapImgRestore() { //needed when onMouseOut event is triggered
  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() { //cache the mouse_over graphic before everything else
  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) { //needed by MM_swapImage()
  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() { //needed when OnMouseOver event is triggered
  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 preloadImages(id, language){
	var M =7;
	var tobeLoaded ="";

	for ( c=0; c <M; c++){
		if (c !=id){
		tobeLoaded +="'http://www.zero8.com/images/buttons/menu"+ c +"_over.png',";
		}
	}
	tobeLoaded +=",'http://www.zero8.com/images/buttons/menu_"+ language + "_over.png')";
	MM_preloadImages(tobeLoaded);
}

//Used to created the menu using an id as a reference to know which menu is dn!
function CreateLanguage(language, where){
	var str ="";
	if (!where) where ="index";

	if (language =="francais"){
		str +="<table width ='240' height ='62' border ='0' cellpadding ='0' cellspacing ='0'>\n";
		str +="\t<tr>\n\t\t<td height ='34' valign ='top'>";
		str += "<img src ='http://www.zero8.com/images/buttons/menu_francais_dn.png' width ='240' height ='34' /></td>\n\t</tr>\n";
		str += "\t<tr>\n\t\t<td height ='28' valign ='top'>";
		str += "<a href ='http://www.zero8.com/english/"+ where +".html' onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('anglais','','http://www.zero8.com/images/buttons/menu_anglais_over.png',1)\">";
		str += "<img src ='http://www.zero8.com/images/buttons/menu_anglais_shadow.png' alt ='English' name ='anglais' width ='240' height ='28' border ='0' id ='anglais' /></a></td>\n\t</tr>\n";
		str +="</table>\n";
	}
	else if (language =="anglais"){
		str +="<table width ='240' height ='62' border ='0' cellpadding ='0' cellspacing ='0'>\n";
		str +="\t<tr>\n\t\t<td height ='34' valign ='top'>";
		str += "<a href ='http://www.zero8.com/"+ where +".html' onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('francais','','http://www.zero8.com/images/buttons/menu_francais_over.png',1)\">";
		str += "<img src ='http://www.zero8.com/images/buttons/menu_francais_up.png' alt ='Francais' name ='francais' width ='240' height ='34' border ='0' id ='francais' /></a></td>\n\t</tr>\n";
		str += "\t<tr>\n\t\t<td height ='28' valign ='top'>";
		str += "<img src ='http://www.zero8.com/images/buttons/menu_anglais_dn.png' width ='240' height ='28' /></td>\n\t</tr>\n";
		str +="</table>\n";
	}
	else {
		str +="<table width ='240' height ='62' border ='0' cellpadding ='0' cellspacing ='0'>\n";
		str +="\t<tr>\n\t\t<td height ='34' valign ='top'>";
		str += "<a href ='http://www.zero8.com/"+ where +".html' onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('francais','','http://www.zero8.com/images/buttons/menu_francais_over.png',1)\">";
		str += "<img src ='http://www.zero8.com/images/buttons/menu_francais_up.png' alt ='Francais' name ='francais' width ='240' height ='34' border ='0' id ='francais' /></td>\n\t</tr>\n";
		str += "\t<tr>\n\t\t<td height ='28' valign ='top'>";
		str += "<a href ='http://www.zero8.com/english/"+ where +".html' onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('anglais','','http://www.zero8.com/images/buttons/menu_anglais_over.png',1)\">";
		str += "<img src ='http://www.zero8.com/images/buttons/menu_anglais_up.png' alt ='English' name ='anglais' width ='240' height ='28' border ='0' id ='anglais' /></a></td>\n\t</tr>\n";
		str +="</table>\n";
	}
	
	return(str);	
}


function CreateMenu(id){
	//the current menu contains 7 items
	//array creation for menu name, html reference, graphics name
	var M =7;
	var MI =4;
	var str ="";

	var menuId = new Array(M);
	for ( c =0; c <M; c++){
		menuId[c] =  new Array(MI);
	}

	menuId[0][0] ="Accueil";
	menuId[0][1] ="index.html";
	menuId[0][2] ="menu1";
	menuId[0][3] =40;
	menuId[1][0] ="Promesse Zero8";
	menuId[1][1] ="promesse.html";
	menuId[1][2] ="menu2";
	menuId[1][3] =19;
	menuId[2][0] ="Pour en savoir plus";
	menuId[2][1] ="savoirplus.html";
	menuId[2][2] ="menu3";
	menuId[2][3] =19;
	menuId[3][0] ="Notre Menu";
	menuId[3][1] ="menu2.html";
	menuId[3][2] ="menu4";
	menuId[3][3] =19;
	menuId[4][0] ="Critiques";
	menuId[4][1] ="critiques.html";
	menuId[4][2] ="menu5";
	menuId[4][3] =19;
	menuId[5][0] ="Coordonnees";
	menuId[5][1] ="coordonnees.html";
	menuId[5][2] ="menu6";
	menuId[5][3] =19;
	menuId[6][0] ="Postes offerts";
	menuId[6][1] ="postes.html";
	menuId[6][2] ="menu7";
	menuId[6][3] =26;

	var tableHeight =0;
	for (c =0; c<M; c++){
		tableHeight +=menuId[c][3];
	}

	for (c =0; c <M; c++){
		str +="      <tr>\n";
		if (c ==id) {
			str +="        <td width ='240' height ='"+ menuId[c][3] +"' align ='right' valign ='top'><img src ='http://www.zero8.com/images/buttons/"+ menuId[c][2] +"_dn.png' width ='240' height ='"+ menuId[c][3]+ "' /></td>\n";
		}
		else if (c ==(id +1)) {
			str +="        <td width ='240' height='"+ menuId[c][3] +"' align ='right' valign ='top'><a href ='"+ menuId[c][1] +"' onMouseOut =\"MM_swapImgRestore()\" onMouseOver =\"MM_swapImage('"+ menuId[c][2] +"','','http://www.zero8.com/images/buttons/"+ menuId[c][2] +"_over.png',1)\"><img src ='http://www.zero8.com/images/buttons/"+ menuId[c][2] +"_shadow.png' alt ='"+ menuId[c][0] +"' name ='"+ menuId[c][2] +"' width='240' height ='"+ menuId[c][3] +"' border ='0' id ='"+ menuId[c][2] +"' /></a></td>\n";
		}
		else {
			str +="        <td width ='240' height ='"+ menuId[c][3] +"' align ='right' valign ='top'><a href ='"+ menuId[c][1] +"' onMouseOut =\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('"+ menuId[c][2] +"','','http://www.zero8.com/images/buttons/"+ menuId[c][2] +"_over.png',1)\"><img src ='http://www.zero8.com/images/buttons/"+ menuId[c][2] +"_up.png' alt='"+ menuId[c][0] +"' name ='"+ menuId[c][2] +"' width ='240' height ='"+ menuId[c][3] +"' border ='0' id ='"+ menuId[c][2] +"' /></a></td>\n";
		}
		str +="      </tr>\n";
	}
	return(str);
}

function CreateNews(){
	var str ="";
	str +="\
	<table width ='240' bgcolor ='#FFFFFF' cellpadding ='0' cellspacing ='0' border ='0'>\n\
	  <tr>\n\
		<td height ='35'><img src ='http://www.zero8.com/images/table/nouvelle_up.gif' width ='240' height ='35' border ='0' /></td>\n\
	  </tr>\n\
	  <tr>\n\
		<td background ='http://www.zero8.com/images/table/nouvelle_bckg.gif' ><table width ='240' border ='0' cellpadding ='0' cellspacing ='0'>\n\
		  <tr>\n\
			<td width ='85'>&nbsp;</td>\n\
			<td width ='155' valign ='top' align ='left' class ='nouveau'>\
			  Nouveau en restaurant!<br /><a class ='nouv' href ='http://www.zero8.com/info/menuhote_fra.html' target ='_self'>Menu table d\'h&#244;te</a><br />\
			  <hr class ='nouv'>\
			  <br />Commandez pour vos f&#234;tes!<br /><a class ='nouv' href ='http://www.zero8.com/info/menutraiteur_fra.html' target ='_self'>Menu traiteur</a><br />\
			  <hr class ='nouv'>\
			  <br /><a class ='nouv' href ='http://www.zero8.com/coordonnees.html#horaire' target ='_self'>Consultez notre horaire!</a><br />\
			</td>\n\
		  </tr>\n\
		</table></td>\n\
	  </tr>\n\
	  <tr>\n\
		<td height ='16' background ='http://www.zero8.com/images/table/nouvelle_bot.gif'><font size ='-1'>&nbsp;</font></td>\n\
	  </tr>\n\
	</table>\n";

	return (str);
}

function CreateInscription(from){
	var str ="";

	str +="   <form id ='inscrire' name ='inscrire' method ='post' action ='http://www.zero8.com/inscrire.php'>\n";
	str +="	    <td width ='85' height ='52'><input name ='where' id ='where' type ='hidden' value ='http://zero8.com/" + from +".html'>&nbsp;</td>\n";
	str +="	    <td width ='155' height ='52' valign ='bottom' align ='left'>\n";
	str +="		  <input class ='input' type ='text' name ='nom' size ='16' value ='<Nom>' onfocus =\"if(this.value=='<Nom>'){this.value='';}\"/>\n";
	str +="		</td>\n";
	str +="	  </tr>\n";
	str +="	  <tr>\n";
	str +="	    <td width ='85' height ='30'>&nbsp;</td>\n";
	str +="		<td width ='155' height ='30' valign ='bottom' align ='left'>\n";
	str +="		<input class ='input' type ='text' name ='email' size ='16' value ='<Courriel>' onfocus =\"if(this.value=='<Courriel>'){this.value='';}\"/>\n";
	str +="		</td>\n";
	str +="	  </tr>\n";
	str +="	  <tr>\n";
	str +="	    <td width ='85' height ='30'>&nbsp;</td>\n";
	str +="		<td width ='155' height ='30' valign ='bottom' align ='left'>\n";
	str +="		<input class ='input' type ='text' name ='promo' size ='10' value ='<Promo>' onfocus =\"if(this.value=='<Promo>'){this.value='';}\"/>\n";
	str +="		</td>\n";
	str +="	  </tr>\n";
	str +="	  <tr>\n";
	str +="	    <td width ='85' height ='26'>&nbsp;</td>\n";
	str +="	    <td width ='155' height ='26' valign ='bottom' align ='center'>\n";
	str +="		<input name ='send' id ='send' value ='Envoyer' type ='submit'/></td>\n";
	str +="	  </tr>\n";
	str +="	  <tr>\n";
	str +="	    <td width ='85' height ='18'>&nbsp;</td>\n";
	str +="	    <td width ='155' height ='18' valign ='bottom' align ='left'>&nbsp;</td>\n";
	str +="	  </form>\n";
	str +="	</tr>\n";
	str +="	</table>\n";
	str +="	<table width ='240' height ='127' background ='http://www.zero8.com/images/table/invitez_bckg.png' cellpadding ='0' cellspacing ='0' border ='0'>\n";
	str +="	<tr>\n";
	str +="	  <form id ='ami' name ='ami' method ='post' action ='http://www.zero8.com/inscrire_ami.php'>\n";
	str +="	    <td width ='85' height ='52'><input name ='where' id ='where' type ='hidden' value ='http://zero8.com/"+ from +".html'>&nbsp;</td>\n";
	str +="	    <td width ='155' height ='52' valign ='bottom' align ='left'>\n";
	str +="		  <input class ='input' type ='text' name ='nom' size ='16' value ='<Nom>' onfocus =\"if(this.value=='<Nom>'){this.value='';}\"/>\n";
	str +="		</td>\n";
	str +="	  </tr>\n";
	str +="	  <tr>\n";
	str +="	    <td width ='85' height ='30'>&nbsp;</td>\n";
	str +="		<td width ='155' height ='30' valign ='bottom' align ='left'>\n";
	str +="		<input class ='input' type ='text' name ='email' size ='16' value ='<Courriel>' onfocus =\"if(this.value=='<Courriel>'){this.value='';}\"/>\n";
	str +="		</td>\n";
	str +="	  </tr>\n";
	str +="	    <td width ='85' height ='26'>&nbsp;</td>\n";
	str +="	    <td width ='155' height ='26' valign ='bottom' align ='center'>\n";
	str +="		<input name ='send' id ='send' value ='Envoyer' type ='submit'/></td>\n";
	str +="	  </tr>\n";
	str +="	  <tr>\n";
	str +="	    <td width ='85' height ='19'>&nbsp;</td>\n";
	str +="	    <td width ='155' height ='19'>&nbsp;</td>\n";
	str +="	  </form>\n";

	return(str);
}

function CreatePhotos() { 
	var img =CreatePhotos.arguments;
	var i=0;
	str ="";

	for (i =0; i <img.length; i++){
		str +="		<p align ='left'><a href ='http://www.zero8.com/images/resto/big/"+ img[i] +".jpg' target ='_blank'><img width ='200' height ='125' border ='0' lowsrc ='http://www.zero8.com/images/resto/"+ img[i] +"_low.jpg' src ='http://www.zero8.com/images/resto/"+ img[i] +"_pti.jpg' /></a></p><br><br>\n";
	}
	return(str);
}

function CreateFooter(id){
	var str ="";

	str +="<span style ='font-family: Century Gothic; font-size: 14px; color: #434343; margin-left: 4pt; margin-right: 4pt;	text-align: center;'><b>Zero8 Resto-Bar</b> | 1735 Saint-Denis | 514 658 5552</span>";
	return(str);
}

function CreateFooterBAK(id){
	var str ="";
	var M =7;
	var MI =3;

	var menuId = new Array(M);
	for ( c =0; c <M; c++){
		menuId[c] =  new Array(MI);
	}
	menuId[0][0] =true;
	menuId[0][1] ="index.html";
	menuId[0][2] ="Accueil";
	menuId[1][0] =true;
	menuId[1][1] ="promesse.html";
	menuId[1][2] ="Promesse";
	menuId[2][0] =true;
	menuId[2][1] ="savoirplus.html";
	menuId[2][2] ="Pour en savoir plus";
	menuId[3][0] =true;
	menuId[3][1] ="menu2.html";
	menuId[3][2] ="Menu";
	menuId[4][0] =false;
	menuId[4][1] ="critiques.html";
	menuId[4][2] ="Critiques";
	menuId[5][0] =true;
	menuId[5][1] ="coordonnees.html";
	menuId[5][2] ="Coordonn&#233;es";
	menuId[6][0] =false;
	menuId[6][1] ="postes.html";
	menuId[6][2] ="Postes";

	//count how many marquer!
	var marquer =0;
	for ( c=0; c<M; c++){
		if (menuId[c][0] ==true){
			marquer++;
		}
	}
	marquer--;

	for ( c=0; c<M; c++){
		if (menuId[c][0] ==true){
			if ( c ==id){
				str +="<font name ='Century Gothic' size ='2' color ='#62802a'><b>"+ menuId[c][2] +"</b></font>";
			}
			else{
				str +="<a class ='menu' href ='http://www.zero8.com/"+ menuId[c][1] +"'>"+ menuId[c][2] +"</a>";
			}
			if (marquer >0){
				str +="<font name ='Century Gothic' size ='2' color ='#62802a'> | </font>";
				marquer--;
			}
		}
	}
	return(str);
}

function CreateCopyright(){
	var str ="";

	str +="		<td width ='240' height ='48' align ='right' valign ='top'>&nbsp;</td>\n";
	str +="		<td width ='432' height ='48' align ='right' valign ='top'><p class ='droits'>&#169; Copyright 2008-2009 Alimentation Z&#233;ro8 inc., tous droits r&#233;serv&#233;s.Z&#233;ro8 et le logo Z&#233;ro8 sont des marques de commerces d'Alimentation Z&#233;ro8 inc.</p></td>\n";
	str +="		<td width ='24' height ='48'>&nbsp;</td>\n";
	str +="		<td width ='400' height ='48'>&nbsp;</td>\n";
	return(str);
}

function PasteTwitterWidget(){
	var str ="";

	str +="<div id='twtr-profile-widget\ ></div>\n";
	str +="	<script src=\"http://widgets.twimg.com/j/1/widget.js\"><\/script>\n";
	str +="	<link href=\"http://widgets.twimg.com/j/1/widget.css\" type=\"text/css\" rel=\"stylesheet\">\n";

	str +="<script>\n";
	str +="	new TWTR.Widget({\n";
	str +="		profile: true,\n";
	str +="		id: 'twtr-profile-widget',\n";
	str +="		loop: true,\n";
	str +="		width: 250,\n";
	str +="		height: 300,\n";
	str +="		theme: {\n";
	str +="			shell: {\n";
	str +="				background: '#3082af',\n";
	str +="				color: '#ffffff'\n";
	str +="			},\n";
	str +="			tweets: {\n";
	str +="				background: '#ffffff',\n";
	str +="				color: '#444444',\n";
	str +="				links: '#1985b5'\n";
	str +="			}\n";
	str +="		}\n";
	str +="	}).render().setProfile('Zero8RestoBar').start();\n";
	str +="<\/script>\n";

	return (str);
}

function PasteFacebookWidget(){
var str ="";

	str +="<script type='text/javascript' src='http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US'>\n";
	str +="<\/script>\n";
	str +="<script type='text/javascript'>FB.init('59f8fc9cb34d9a8dc088ff17444878e6');\n";
	str +="<\/script>\n";
	str +="<fb:fan profile_id='139872529214' stream='1' connections='10' width='300'>\n";
	str +="</fb:fan>\n";
	str +="<div style='font-size:8px; padding-left:10px'><a href='http://www.facebook.com/pages/Montreal-QC/Zero8-Resto-Bar/139872529214'>Zéro8 Resto-Bar on Facebook</a>\n";
	str +="<\/div>\n";

	return (str);
}