function renderFooter () {
  footer = 'French Table Wine, &copy;2006 Red Bicyclette USA, Healdsburg, CA. All rights reserved. Use of this site is subject to the <a href=\'javascript:popUp("user_agreement.html","useragreement");\'>user agreement</a> and <a href=\'javascript:popUp("privacy.html","privacy");\'>privacy policy</a> and <a href=\'javascript:popUp("trademarks.html","trademarks");\'>trademarks</a>.';
  document.write(footer);
}

function renderMenu (on) {
	var menuItems = ["Home", "Wines", "Grapes", "Learn", "Recipe", "Entertaining", "Contact", "Buy"];
	var menuLinks = ["home.html", "wines.html", "grapes.html", "learn.html", "recipes.html", "entertaining.html", "contact.html", "buy.html"];
	var menuCode = "";
	
	if(on != 0)	
		for(var i = 0; i < menuItems.length; i++) {
			imageCode = '<img src="images/common/menu/menu' + menuItems[i];
			imageProperties = ' width="112" height="21" border="0" ';
		
			if(on != (i + 1))
				menuCode +=	'<a href="' + menuLinks[i] +'">'  + imageCode  + 'Off.jpg"' + imageProperties + ' onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a><br />';
			else
				menuCode += imageCode + 'On.jpg"' + imageProperties + '/><br />';				
		}
	else
		menuCode = '<a href="#"><img src="images/common/menu/menuHomeOff.jpg" width="112" height="21" border="0" id="menu1" onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a><br />'
	  + '<a href="#"><img src="images/common/menu/menuWinesOff.jpg" width="112" height="21" border="0" id="menu2" onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a><br />'
	  + '<a href="#"><img src="images/common/menu/menuGrapesOff.jpg" width="112" height="21" border="0" id="menu3" onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a><br />'
	  + '<a href="#"><img src="images/common/menu/menuLearnOff.jpg" width="112" height="21" border="0" id="menu4" onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a><br />'
	  + '<a href="#"><img src="images/common/menu/menuRecipeOff.jpg" width="112" height="21" border="0" id="menu5" onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a><br />'
	  + '<a href="#"><img src="images/common/menu/menuEntertainingOff.jpg" width="112" height="21" id="menu6" border="0" onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a><br />'
	  + '<a href="#"><img src="images/common/menu/menuContactOff.jpg" width="112" height="21" border="0" id="menu7" onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a><br />'
	  + '<a href="#"><img src="images/common/menu/menuBuyOff.jpg" width="112" height="21" border="0" id="menu8" onmouseover="javascript:rollOver(this);" onmouseout="javascript:rollOver(this);" /></a>';
		
  document.write(menuCode);
}

function hideBottle () {
	thisid = document.getElementById("bottles");
	thisid.src = thisid.src.substring(0, thisid.src.lastIndexOf("bottle")) + "bottles.jpg";
}

function showBottle (id) {
	thisid = document.getElementById("bottles");
	
	if(thisid.src.substring("bottles.jpg") != -1)
		thisid.src = thisid.src.substring(0, thisid.src.lastIndexOf("bottles")) + "bottle" + id + ".jpg";
}

function renderUncork () {
	 if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
			menuDivX = (window.innerWidth)/2 + 65;
			menuDivY = 166;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
			menuDivX = (document.body.offsetWidth)/2 + 73;
			menuDivY = 166;
		}
	}

	thisid = document.getElementById('homeUncorkImage');
	thisid.style.left = menuDivX + "px";
  thisid.style.top = menuDivY + "px";
	thisid.style.display = "block";
	
}

function rollOver (image) {   
    var imageState;   
       
    var index1 = image.src.lastIndexOf('/');   
       
    if(image.src.lastIndexOf('Off') == -1) {   
        var index2 = image.src.lastIndexOf('On');   
        imageState = 1;   
    }   
    else {   
        var index2 = image.src.lastIndexOf('Off');   
        imageState = 0;   
    }   
       
    var index3 = image.src.lastIndexOf('.');   
       
    var imagePath = image.src.substring(0, index1 + 1);   
    var imageName = image.src.substring(index1 + 1, index2);   
    var imageExt = image.src.substring(index3, image.src.length);      
       
    if(imageState == 0)   
        image.src = imagePath + imageName + "On" + imageExt;   
    else  
        image.src = imagePath + imageName + "Off" + imageExt;      
}

function showMapDescription(id) {
	var text = new Array();
	text[0] = '<span class="commonTextAlt">Limoux</span>: On the banks of the Aude River; Limoux is a town in Aude in the Western Languedoc. It is close to the foothills of the Pyrenees Mountains. Limoux is an acclaimed area that produces ripe, fruit-forward Chardonnays with peach and apple flavors and is the home of the winery for Red Bicyclette.';
	text[1] = '<span class="commonTextAlt">Gard and Herault</span>: Our Pinot Noir, Merlot, and Syrah are sourced from the flat, windy plains of Gard and Herault. The Gard’s stoney soils are famous for producing rich, red wines, while Herault produces medium-weight reds with long palate structure.';
	text[2] = '<span class="commonTextAlt">Aude</span>: Stretching from the Mediterranean Sea in the East to the Mountains in the West, Aude has a range of terrains, but is known for its sunny climate and its ability to produce medium-weight aromatic reds.';
	
	thisid = document.getElementById('mapDescription');
	
	switch(id) {
		case 2: thisid.innerHTML = text[0];
		break;
		case 3: thisid.innerHTML = text[1];
		break;
		case 1: thisid.innerHTML = text[2];
		break;
	}
}

function hideMapDescription() {
	thisid = document.getElementById('mapDescription');
	thisid.innerHTML = "";
}


function showHideLayer (id1, id2) {
	thisid1 = document.getElementById(id1);
	thisid2 = document.getElementById(id2);
	thisid1.style.display = "none";
	thisid2.style.display = "block";
}

function hidePairs(id) {
	thisid1 = document.getElementById('pair1');
	thisid2 = document.getElementById('pair2');
	thisid3 = document.getElementById('pair3');
	thisid4 = document.getElementById('pair4');
	
	thisid5 = document.getElementById(id);

	thisid1.style.display = "none";
	thisid2.style.display = "none";
	thisid3.style.display = "none";
	thisid4.style.display = "none";
	thisid5.style.display = "block";
}

function popUp(url, name) {
	var config = "scrollbars=yes, resizable=no, width=425, height=400";
  window.open(url, name, config);
}

var adnum = -1;

function randomAd() {
	//var ran_unrounded=Math.random()*5;
	//var ran_number=Math.floor(ran_unrounded);
	var name;
	
	adnum++;
	
	switch(adnum){
		case 0: name = "atlanta";
		break;
		case 1: name = "boston";
		break;
		case 2: name = "charlotte";
		break;
		case 3: name = "denver";
		break;
		case 4: name = "houston";
		adnum = -1;
		break;
		
	}
	
	/*switch(ran_number){
		case 0: name = "atlanta";
		break;
		case 1: name = "boston";
		break;
		case 2: name = "charlotte";
		break;
		case 3: name = "denver";
		break;
		case 4: name = "houston";
		break;
		
	}*/
	
	var ad = document.getElementById("adspace");
	
	ad.innerHTML = "<img src='images/buy/" + name + "_journal.jpg' style='margin-top: 7px;' />";
	
	//document.write("<img src='images/buy/" + name + "_journal.jpg' style='margin-top: 7px;' />");
	
	setTimeout("randomAd()", 4000);
}

function writeFlash() {

var flashObject = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="900" height="185">' +
      '<param name="movie" value="flash/footer_aimee.swf" />' +
      '<param name="quality" value="high" />' +
      '<param name="wmode" value="transparent" />' +
      '<embed src="flash/footer_aimee.swf" width="900" height="185" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>' +
    '</object>';
	
	document.write(flashObject);
	
	
}

bot1= new Image(381,419); 
bot1.src="../images/common/bottles/bottle1.jpg"; 
bot2= new Image(381,419); 
bot2.src="../images/common/bottles/bottle2.jpg"; 
bot3= new Image(381,419); 
bot3.src="../images/common/bottles/bottle3.jpg"; 
bot4= new Image(381,419); 
bot4.src="../images/common/bottles/bottle4.jpg"; 
bot5= new Image(381,419); 
bot5.src="../images/common/bottles/bottle5.jpg"; 

