var init = true;
var currPizza = 0;
var navigation = 'pizza'
var mySlideShow;
var playing = true;
var start = true;
window.onload = function(){
	//venutosPizza.actionArea('url(images/hp_pizza_00.jpg)')
	venutosPizza.displayFooter();
}

function slideShow(init){
	if(init === true){
		currPizza = pizza.length - 1;
		init = false;
	}
	venutosPizza.next(0);
	mySlideShow = setTimeout('slideShow()', 5000);
}

/*function displayFooter(){
	document.getElementById('footerCopy').innerHTML = '<p>&copy;2007 Venuto&rsquo;s Old World Pizza.</p><a href="#">Privacy Policy</a><a href="#">Terms of Use</a><a href="#">Contact Us</a><a href="#">Site Map</a>';
}*/

function selectShow(name){
	currPizza = pizza.length - 1;
	navigation = name;
	if(navigation === 'bor'){
		document.getElementById('orderOnlineButton').style.display = 'none';
		document.getElementById('currentImage').style.display = 'none';
		document.getElementById('description').innerHTML = '<img src="images/bor_logo.gif" alt="The Bill of Doing Things Right" height="120" width="134">'
	}else{
		document.getElementById('orderOnlineButton').style.display = 'block';
		document.getElementById('currentImage').style.display = 'block';
		document.getElementById('description').innerHTML = '<h5 id="pizzaTitle"></h5><p id="pizzaDesc"></p>'
	}
	slideShow();
}

var pizza = [];
pizza[0] = new actionInfo('url(images/hp_pizza_don.jpg)', 'THE DONATELLO', 'Sweet Italian sausage, Venuto\'s Signature Pepperoni, applewood bacon, meatballs, smoked diced ham, and Venuto\'s Special Blend of Cheeses. A meaty masterpiece.');
pizza[1] = new actionInfo('url(images/hp_pizza_car.jpg)', 'THE CARAVAGGIO', 'Whole-wheat crust, marinated grilled chicken, roasted red peppers, medium diced red tomatoes, artichoke hearts, and Venuto\'s Special Blend of Cheeses. A masterful use of light ingredients, inspired by the artist.');
pizza[2] = new actionInfo('url(images/hp_pizza_gio.jpg)', 'THE GIOTTO', 'Fresh basil, Venuto\'s Marinara, and buffalo mozzarella. A timeless classic.');
pizza[3] = new actionInfo('url(images/hp_pizza_leo.jpg)', 'THE LEONARDO', 'Venuto\'s Signature Pepperoni, sweet Italian sausage, red onion, green and red peppers, sliced white mushrooms, black olives, and Venuto\'s Special Blend of Cheeses. Like the master himself.');
pizza[4] = new actionInfo('url(images/hp_pizza_bot.jpg)', 'THE BOTTICELLI', 'Fresh garlic, extra virgin olive oil, broccoli, sliced white mushrooms, spinach, red onion, roasted red peppers, and Venuto\'s Special Blend of Cheeses. A portrait of genuine pizza beauty.');
/*pizza[5] = new actionInfo('url(images/hp_pizza_tin.jpg)', 'THE TINTORETTO', 'Venuto\'s Signature Pizza, with your choice of three toppings. Tintoretto\'s most celebrated painting is called \"Paradise.\" That\'s no coincidence.');*/
pizza[5] = new actionInfo('url(images/hp_pizza_bel.jpg)', 'THE BELLINI', 'Grilled marinated chicken, our very own buffalo sauce, and Venuto\'s Special Blend of Cheeses. This work of art can change your life.');
pizza[6] = new actionInfo('url(images/hp_pizza_rap.jpg)', 'THE RAPHAEL', 'Generous double layers of Venuto\'s Signature Pepperoni, and our Special Blend of Cheeses. No artist should go starving.');
pizza[7] = new actionInfo('url(images/hp_pizza_mic.jpg)', 'THE MICHELANGELO', 'Venuto\'s Signature Pizza with our Special Blend of Cheeses. Just like the artist, it totally redefines the category.');

var bor = [];
bor[0] = new actionInfo('url(images/hp_bor_00.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>0');
bor[1] = new actionInfo('url(images/hp_bor_01.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>1');
bor[2] = new actionInfo('url(images/hp_bor_02.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>2');
bor[3] = new actionInfo('url(images/hp_bor_03.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>3');
bor[4] = new actionInfo('url(images/hp_bor_04.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>4');
bor[5] = new actionInfo('url(images/hp_bor_05.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>5');
bor[6] = new actionInfo('url(images/hp_bor_06.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>6');
bor[7] = new actionInfo('url(images/hp_bor_07.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>7');
bor[8] = new actionInfo('url(images/hp_bor_08.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>8');
bor[9] = new actionInfo('url(images/hp_bor_09.jpg)', 'Bill of Rights', 'bill of rights text here for accessability<br/>9');

//alert(bor.length)
//alert (pizza.length)

function actionInfo(image, title, copy)	{
	this.image = image;
	this.title = title;
	this.copy = copy;
	//this.url = url;
}


function orderOnline(){
	alert('This will interface with the on-line ordering page');	
}

var venutosPizza = {
	actionArea:function(tourItem)
	{
		var currPizza = document.getElementById('action');
		currPizza.style.backgroundImage = tourItem;
	},
	next:function(condition){
		
		/*if(condition == 1){
			venutosPizza.stopSlideShow();
		}*/
	currPizza++;
		switch(navigation){
			case 'pizza':
				if(currPizza < pizza.length){
					venutosPizza.actionArea(pizza[currPizza].image);
				}else{
					currPizza = 0;
					venutosPizza.actionArea(pizza[currPizza].image);
				}
				clearTimeout(mySlideShow)
				venutosPizza.changePizzaCopy(pizza[currPizza].title, pizza[currPizza].copy);
				break;
			case 'bor':
				if(currPizza < bor.length){
					venutosPizza.actionArea(bor[currPizza].image);
				}else{
					currPizza = 0;
					venutosPizza.actionArea(bor[currPizza].image);
				}
				clearTimeout(mySlideShow)
			//	venutosPizza.changePizzaCopy(bor[currPizza].title, bor[currPizza].copy);
				break;
			default:
				break;
		}
				//window.status = currPizza + '   ' + pizza[currPizza].title;
	},
	prev:function(condition){
		/*
		if(condition == 1){
			venutosPizza.stopSlideShow();
		}*/
		switch(navigation){
			case 'pizza':
				if(currPizza == 0){
					currPizza = pizza.length - 1;
				}else{
					currPizza--;
				}
				venutosPizza.actionArea(pizza[currPizza].image);
				clearTimeout(mySlideShow)
				venutosPizza.changePizzaCopy(pizza[currPizza].title, pizza[currPizza].copy);
				break;
		case 'bor':
			if(currPizza == 0){
					currPizza = bor.length - 1;
				}else{
					currPizza--;
				}
				venutosPizza.actionArea(bor[currPizza].image)
				clearTimeout(mySlideShow)
				venutosPizza.changePizzaCopy(bor[currPizza].title, bor[currPizza].copy);
				break;
		default:
				break;
		}
		//alert('exit: ' + currPizza);
	},
	changePizzaCopy:function(title, description){
		document.getElementById('pizzaTitle').innerHTML = title;
		document.getElementById('pizzaDesc').innerHTML = description;
		document.getElementById('currentImage').setAttribute('alt', title)
		
	},
	stopSlideShow:function(){
		if(playing == true){
			clearTimeout(mySlideShow);
			document.getElementById('playPause').src = 'images/play.gif';
			document.getElementById('playPause').alt = 'Play Slide Show';
			playing = false;
		}else{
			slideShow();
			document.getElementById('playPause').src = 'images/pause.gif'
			document.getElementById('playPause').alt = 'Pause Slide Show';
			playing = true;
		}
	},
	displayFooter:function(){
		document.getElementById('footerCopy').innerHTML = '<p>&copy;2009 Venuto&rsquo;s Old World Pizza.</p><a href="mailto:greg@venutospizza.com">Contact Us</a><a href="http://www.venutos.com/terms">Privacy Policy</a><a href="http://www.venutos.com/terms">Terms of Use</a>';
	},
	displayNavigation:function(){ 
    var topnav = '<div id="logo" class="clear">' +
			'<a href="/venutos2/index.html" title="Venuto&rsquo;s Old World Pizza">' +
			'<img src="../images/logo2.gif" alt="Venuto&rsquo;s Old World Pizza" width="229" height="72" border="0" /></a>' +
		'</div>' +
		'<div id="orderOnline">' +
			'<a href="https://weborder3.microworks.com/venutos/" target="_blank" class="order" title="Order Online Now!">' +
			'<img src="../images/mona_lisa.gif" alt="Order Online Now!" width="77" height="74" border="0" class="right" />' +
			'<p class="one">Order Online Now!</p>' +
			'<p class="two">Real Italian Pizza that Tastes Real Good!</p>' +
            '<p class="two" style="color:#fff; font-size:120%;">We Deliver!</p>' +
				'</a>' +
		'</div>' +
		'<div class="clear"></div>' +
	'</div>' +
	'<div id="pimaryNav">' +
		'<ul>' +
		'<li><a href="../menu/" title="Browse the Venuto&rsquo;s pizza menu and more">menu</a></li>' +
			'<li><a href="../locations/" title="Check out our current location and future locations">locations</a></li>' +
			'<li><a href="../story/" title="Read the story behind Vento&rsquo;s Pizza">venuto&rsquo;s story</a></li>' +
			'<li><a href="../franchise/" title="Own your own Vento&rsquo;s Pizza Franchise">franchise</a></li>' +
			'<li><a href="../media/" title="Stay on top of the latest news and press releases for Venuto&rsquo;s Pizza">press</a></li>' +
		'</ul>';
		document.getElementById('header').innerHTML = topnav;
	}

}
