// JavaScript Document
var slideText = new Array();
slideText[0] = '<p class="slide_header"><span class="slideLineOne">Here the food is paired</span><br /><span class="slideLineTwo">around the wine</span></p><p class="slide_paragraph">Offering diners  a unique experience – one in which the selection of wine and its marriage to food comes first and foremost.</p><p class="slide_paragraph">The New American small plate menu focuses on seasonal Ingredients and sustainable seafood.</p><p class="slide_paragraph">It has been said that "variety is the spice of life." We at Upstairs 2 are committed to keeping that adage alive and well.</p>';
slideText[1] = '<p class="slide_header"><span class="slideLineOne">Extensive catering menu</span><br /><span class="slideLineTwo">to match your event.</span></p><p class="slide_paragraph">For over 5 years, Upstairs 2 has been providing Los Angeles with a "total package" catering service. From the initial planning phase to the production phase, we will pay attention to every detail and be there with you every step of the way.</p><p class="slide_paragraph">Corporate Lunches, Weddings, Anniversaries, Kosher Catering, Mexican Fiestas, Hawaiian Luaus, Barbecues, Tapas, Family-style Catering, Wine and Food Pairing Parties.</p>';
slideText[2] = '<p class="slide_header"><span class="slideLineOne">Try wines by the</span><br /><span class="slideLineTwo">Taste or Glass</span></p><p class="slide_paragraph">The Wine House, LA&rsquo;s largest wine store, has opened a unique restaurant and wine bar. As you would expect, they have created a wine program that is creative and affordable. In addition, our wine experts have constructed a free flowing, entertaining and extensive &quot;Wines by the Glass&quot; program.</p><p class="slide_paragraph">If you are not willing to Try our selections by the taste or glass, the corkage fee for wines purchased from The Wine House is only $10</p>';
//<p class="slide_paragraph">We offer diners a unique perspective rarely experienced at other restaurants - one in which the selection of wine and its marriage to food comes first and foremost.</p>
var faderTimeout = null;
/*******************************/
function gotoSlide(eID, i) {
		clearTimeout(faderTimeout);
		document.getElementById(eID).style.backgroundImage = 'url(/images/banner_' + i + '.png)';
		document.getElementById('slide1').style.borderColor = "#9f5220"
		document.getElementById('slide1').style.color = "#9f5220"
		document.getElementById('slide2').style.borderColor = "#9f5220"
		document.getElementById('slide2').style.color = "#9f5220"
		document.getElementById('slide3').style.borderColor = "#9f5220"
		document.getElementById('slide3').style.color = "#9f5220"
		document.getElementById('slide'+(i+1)).style.borderColor = "#94999e"
		document.getElementById('slide'+(i+1)).style.color = "#94999e"
		//document.getElementById('slide_text').style.visibility = "hidden";
		//document.getElementById('slide_text').style.display = "none";
		document.getElementById('slide_text').innerHTML = slideText[i];
		//document.getElementById('slide_text').style.display = "block";
		//document.getElementById('slide_text').style.visibility = "visible";
}
/*******************************/

function fader(eID, i) {
	faderTimeout = setTimeout("setBackground('"+ eID +"', "+ i +")", 10000);
}

function setBackground(eID, i) {
	fade(eID, 100, 0, 400, i);
	setTimeout("restartScript('"+ eID +"', "+ i +")", 1000);
}

function restartScript(eID, i) {
	if ( i == 2 ) {
		fade(eID, 0, 100, 400, i);
		fader(eID, 0);
	} else {
		fade(eID, 0, 100, 400, i);
		fader(eID, ++i);
	}
}


function setOpacity(eID, opacityLevel) {

	var eStyle = document.getElementById(eID).style;
	eStyle.opacity = opacityLevel / 100;
	eStyle.filter = 'alpha(opacity='+opacityLevel+')';

}

function fade(eID, startOpacity, stopOpacity, duration, graphicNumber) {
var timer = 0;
	var speed = Math.round(duration / 100);
	//var image = 1;

	if (startOpacity < stopOpacity){ // fade in
		for (var i=startOpacity; i<=stopOpacity; i++) {
			setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
			setTimeout("setOpacity('slide_text',"+i+")", timer * speed);
			timer++;
		}
		document.getElementById(eID).style.backgroundImage = 'url(/images/banner_' + graphicNumber + '.png)';
		document.getElementById('slide1').style.borderColor = "#9f5220"
		document.getElementById('slide1').style.color = "#9f5220"
		document.getElementById('slide2').style.borderColor = "#9f5220"
		document.getElementById('slide2').style.color = "#9f5220"
		document.getElementById('slide3').style.borderColor = "#9f5220"
		document.getElementById('slide3').style.color = "#9f5220"
		document.getElementById('slide'+(graphicNumber+1)).style.borderColor = "#94999e"
		document.getElementById('slide'+(graphicNumber+1)).style.color = "#94999e"
		document.getElementById('slide_text').style.visibility = "hidden";
		document.getElementById('slide_text').style.display = "none";
		document.getElementById('slide_text').innerHTML = slideText[graphicNumber];
		document.getElementById('slide_text').style.display = "block";
		document.getElementById('slide_text').style.visibility = "visible";
		return;
	}

	for (var i=startOpacity; i>=stopOpacity; i--) { // fade out
		setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
		setTimeout("setOpacity('slide_text',"+i+")", timer * speed);
		timer++;
	}

}
