// JavaScript Document for Hox Brasserie

<!--
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];}
}

// original script from http://slayeroffice.com/code/imageCrossFade/


//var currentLeftPhoto = 0;
//var secondLeftPhoto = 1;
var currentLetterboxPhoto = 0;
var secondLetterboxPhoto = 1;
//var currentMiddlePhoto = 0;
//var secondMiddlePhoto = 1;
//var currentRightPhoto = 0;
//var secondRightPhoto = 1;

//var currentLeftOpacity = new Array();
var currentLetterboxOpacity = new Array();
//var currentMiddleOpacity = new Array();
//var currentRightOpacity = new Array();


//var pauseLeft = false;
var pauseLetterbox = false;
//var pauseMiddle = false;
//var pauseRight = false;

function init() {
		
//	currentLeftOpacity[0]=99;
//	for(i=1;i<homeLeftImages.length;i++)currentLeftOpacity[i]=0;
//	lHTML="";
//	for(i=0;i<homeLeftImages.length;i++)lHTML+="<div id=\"lPhoto\" name=\"lPhoto\" class=\"mPhoto\"><img src=\"img/homeimages/" + homeLeftImages[i]  +"\" /></div>";
//	document.getElementById("lContainer").innerHTML = lHTML;
//
//	if(document.all) {
//		document.getElementsByName("lPhoto")[currentLeftPhoto].style.filter="alpha(opacity=100)";
//	} else {
//		document.getElementsByName("lPhoto")[currentLeftPhoto].style.MozOpacity = .99;
//	}
	
	currentLetterboxOpacity[0]=99;
	for(i=1;i<homeLetterboxImages.length;i++)currentLetterboxOpacity[i]=0;
	leHTML="";
	for(i=0;i<homeLetterboxImages.length;i++)leHTML+="<div id=\"letterboxPhoto\" name=\"letterboxPhoto\" class=\"mPhoto\"><img src=\"img/homeimages/" + homeLetterboxImages[i]  +"\" /></div>";
	document.getElementById("letterboxContainer").innerHTML = leHTML;

	if(document.all) {
		document.getElementsByName("letterboxPhoto")[currentLetterboxPhoto].style.filter="alpha(opacity=100)";
	} else {
		document.getElementsByName("letterboxPhoto")[currentLetterboxPhoto].style.MozOpacity = .99;
	}
	
//	currentMiddleOpacity[0]=99;
//	
//	for(i=1;i<homeMiddleImages.length;i++)currentMiddleOpacity[i]=0;
//	mHTML="";
//	for(i=0;i<homeMiddleImages.length;i++)mHTML+="<div id=\"mPhoto\" name=\"mPhoto\" class=\"mPhoto\"><img src=\"img/homeimages/" + homeMiddleImages[i]  +"\" /></div>";
//	document.getElementById("mContainer").innerHTML = mHTML;
//
//	if(document.all) {
//		document.getElementsByName("mPhoto")[currentMiddlePhoto].style.filter="alpha(opacity=100)";
//	} else {
//		document.getElementsByName("mPhoto")[currentMiddlePhoto].style.MozOpacity = .99;
//	}
//	
//	currentRightOpacity[0]=99;
//	
//	for(i=1;i<homeRightImages.length;i++)currentRightOpacity[i]=0;
//	rHTML="";
//	for(i=0;i<homeRightImages.length;i++)rHTML+="<div id=\"rPhoto\" name=\"rPhoto\" class=\"mPhoto\"><img src=\"img/homeimages/" + homeRightImages[i]  +"\" /></div>";
//	document.getElementById("rContainer").innerHTML = rHTML;
//
//	if(document.all) {
//		document.getElementsByName("rPhoto")[currentRightPhoto].style.filter="alpha(opacity=100)";
//	} else {
//		document.getElementsByName("rPhoto")[currentRightPhoto].style.MozOpacity = .99;
//	}
}

//function init_l(){
//	 lInterval = setInterval("crossFadeLeft()",2); 
//}

function init_le(){
	 leInterval = setInterval("crossFadeLetterbox()",2); 
}

//function init_m() {
//	 mInterval = setInterval("crossFadeMiddle()",2); 
//}

//function init_r(){
//	 rInterval = setInterval("crossFadeRight()",2); 
//}



//function crossFadeLeft() {
//	if(pauseLeft)return;
//	currentLeftOpacity[currentLeftPhoto]-=5;
//	currentLeftOpacity[secondLeftPhoto] += 5;
//
//	if(document.all) {
//		document.getElementsByName('lPhoto')[currentLeftPhoto].style.filter = "alpha(opacity=" + currentLeftOpacity[currentLeftPhoto] + ")";
//		document.getElementsByName('lPhoto')[secondLeftPhoto].style.filter = "alpha(opacity=" + currentLeftOpacity[secondLeftPhoto] + ")";
//	} else {
//		document.getElementsByName('lPhoto')[currentLeftPhoto].style.MozOpacity = currentLeftOpacity[currentLeftPhoto]/100;
//		document.getElementsByName('lPhoto')[secondLeftPhoto].style.MozOpacity =currentLeftOpacity[secondLeftPhoto]/100;
//	}
//
//	if(currentLeftOpacity[secondLeftPhoto]/100>=.98) {
//		currentLeftPhoto = secondLeftPhoto;
//		secondLeftPhoto++;
//		if(secondLeftPhoto == homeLeftImages.length)secondLeftPhoto=0;
//		pauseLeft = true;
//		aInterval = setTimeout("pauseLeft=false",7000);
//	}
//	
//	
//}

//function crossFadeMiddle() {
//	if(pauseMiddle)return;
//	
//	currentMiddleOpacity[currentMiddlePhoto]-=5;
//	currentMiddleOpacity[secondMiddlePhoto] += 5;
//
//	if(document.all) {
//		document.getElementsByName('mPhoto')[currentMiddlePhoto].style.filter = "alpha(opacity=" + currentMiddleOpacity[currentMiddlePhoto] + ")";
//		document.getElementsByName('mPhoto')[secondMiddlePhoto].style.filter = "alpha(opacity=" + currentMiddleOpacity[secondMiddlePhoto] + ")";
//	} else {
//		document.getElementsByName('mPhoto')[currentMiddlePhoto].style.MozOpacity = currentMiddleOpacity[currentMiddlePhoto]/100;
//		document.getElementsByName('mPhoto')[secondMiddlePhoto].style.MozOpacity =currentMiddleOpacity[secondMiddlePhoto]/100;
//	}
//
//	if(currentMiddleOpacity[secondMiddlePhoto]/100>=.98) {
//		currentMiddlePhoto = secondMiddlePhoto;
//		secondMiddlePhoto++;
//		if(secondMiddlePhoto == homeMiddleImages.length)secondMiddlePhoto=0;
//		pauseMiddle = true;
//		bInterval = setTimeout("pauseMiddle=false",7000);
//	}
//	
//	
//}

//function crossFadeRight() {
//	if(pauseRight)return;
//	currentRightOpacity[currentRightPhoto]-=5;
//	currentRightOpacity[secondRightPhoto] += 5;
//
//	if(document.all) {
//		document.getElementsByName('rPhoto')[currentRightPhoto].style.filter = "alpha(opacity=" + currentRightOpacity[currentRightPhoto] + ")";
//		document.getElementsByName('rPhoto')[secondRightPhoto].style.filter = "alpha(opacity=" + currentRightOpacity[secondRightPhoto] + ")";
//	} else {
//		document.getElementsByName('rPhoto')[currentRightPhoto].style.MozOpacity = currentRightOpacity[currentRightPhoto]/100;
//		document.getElementsByName('rPhoto')[secondRightPhoto].style.MozOpacity =currentRightOpacity[secondRightPhoto]/100;
//	}
//
//	if(currentRightOpacity[secondRightPhoto]/100>=.98) {
//		currentRightPhoto = secondRightPhoto;
//		secondRightPhoto++;
//		if(secondRightPhoto == homeRightImages.length)secondRightPhoto=0;
//		pauseRight = true;
//		cInterval = setTimeout("pauseRight=false",7000);
//	}
//	
//	
//}

function crossFadeLetterbox() {
	if(pauseLetterbox)return;
	currentLetterboxOpacity[currentLetterboxPhoto]-=5;
	currentLetterboxOpacity[secondLetterboxPhoto] += 5;

	if(document.all) {
		document.getElementsByName('letterboxPhoto')[currentLetterboxPhoto].style.filter = "alpha(opacity=" + currentLetterboxOpacity[currentLetterboxPhoto] + ")";
		document.getElementsByName('letterboxPhoto')[secondLetterboxPhoto].style.filter = "alpha(opacity=" + currentLetterboxOpacity[secondLetterboxPhoto] + ")";
	} else {
		document.getElementsByName('letterboxPhoto')[currentLetterboxPhoto].style.MozOpacity = currentLetterboxOpacity[currentLetterboxPhoto]/100;
		document.getElementsByName('letterboxPhoto')[secondLetterboxPhoto].style.MozOpacity =currentLetterboxOpacity[secondLetterboxPhoto]/100;
	}

	if(currentLetterboxOpacity[secondLetterboxPhoto]/100>=.98) {
		currentLetterboxPhoto = secondLetterboxPhoto;
		secondLetterboxPhoto++;
		if(secondLetterboxPhoto == homeLetterboxImages.length)secondLetterboxPhoto=0;
		pauseLetterbox = true;
		dInterval = setTimeout("pauseLetterbox=false",7000);
	}
	
	
}


//-->