
var ns4 = (document.layers);
var ie = (document.all);
var ns6 = (!document.all && document.getElementById);

if (document.images) {
  
	buyon = new Image();
	buyon.src = "images/go_on.gif";
	buyoff = new Image();
	buyoff.src = "images/go_off.gif";  
  
	viewon = new Image();
	viewon.src = "/shopping/images/view-on.jpg";
	viewoff = new Image();
	viewoff.src = "/shopping/images/view-off.jpg";
	
	gobackon = new Image();
	gobackon.src = "/shopping/images/back-on.jpg";
	gobackoff = new Image();
	gobackoff.src = "/shopping/images/back-off.jpg";

	addon = new Image();
	addon.src = "/shopping/images/add-On.gif";
	addoff = new Image();
	addoff.src = "/shopping/images/add-off.gif";
  
  /* MAIN MENU */
  
  image1on = new Image();
  image1on.src = "/images/menu/nav_1_on.jpg";
  
  image2on = new Image();
  image2on.src = "/images/menu/nav_3_on.jpg";

  image3on = new Image();
  image3on.src = "/images/menu/nav_2_on.jpg";

  image4on = new Image();
  image4on.src = "/images/menu/nav_4_on.jpg";

  image5on = new Image();
  image5on.src = "/images/menu/nav_5_on.jpg";

  image6on = new Image();
  image6on.src = "/images/menu/nav_6_on.jpg";
  
  image7on = new Image();
  image7on.src = "/images/menu/nav_7_on.jpg";
  
  image9on = new Image();
  image9on.src = "/images/next_on.jpg";
  
  image8on = new Image();
  image8on.src = "/images/previous-on.jpg";
  
  image10on = new Image();
  image10on.src = "/images/menu/wine_nav_on.jpg";
  
  
  image1off = new Image();
  image1off.src = "/images/menu/nav_1.jpg";

  image2off = new Image();
  image2off.src = "/images/menu/nav_3.jpg";

  image3off = new Image();
  image3off.src = "/images/menu/nav_2.jpg";

  image4off = new Image();
  image4off.src = "/images/menu/nav_4.jpg";

  image5off = new Image();
  image5off.src = "/images/menu/nav_5.jpg";

  image6off = new Image();
  image6off.src = "/images/menu/nav_6.jpg";

  image7off = new Image();
  image7off.src = "/images/menu/nav_7.jpg";
  
  image9off = new Image();
  image9off.src = "/images/next_off.jpg";
  
  image8off = new Image();
  image8off.src = "/images/previous-off.jpg";
  
  image10off = new Image();
  image10off.src = "/images/menu/wine_nav_off.jpg";
  
  /* END MAIN MENU */
  
    
}

function turnOn(imageName) {
  if (document.images) {
    document.images[imageName].src = eval(imageName + "on.src");
  }
}

function turnOff(imageName) {
  if (document.images) {
    document.images[imageName].src = eval(imageName + "off.src");
  }
}


function openIt(id,leftpos, toppos) {	
	
	if(ns4){
		if(leftpos){
			document.layers[id].visibility = "show";
			document.layers[id].left = leftpos;
			document.layers[id].top = toppos;
		}
	
	}else if(ie){
		if(leftpos){
			document.all[id].style.visibility = "visible";
			document.all[id].style.left = leftpos;
			document.all[id].style.top = toppos;
		}

	}else if(ns6){
		if(leftpos){
			document.getElementById(id).style.visibility = "visible";
			document.getElementById(id).style.left = leftpos;
			document.getElementById(id).style.top = toppos;
		}
	}
}

function closeIt(id){

	if(ns4){
		document.layers[id].visibility = "hide";
	}	else if(ie){
		document.all[id].style.visibility = "hidden";	
	}	else if(ns6){
		document.getElementById(id).style.visibility = "hidden";
	}
}

function showImage(id,size){
	sGoto = "/showimage.asp?id=" + id
	OpenWin = this.open( sGoto, "testWindow", "toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,resizable=yes,height=550,width=700,left=50,top=50,screenX=200,screenY=5");
}

//global var - needed for updateXCoor()
var x;

//this function updates the width of red space (how much to move over
// the drop down menus, by updating a variable in includes/TextLinks.asp
function updateXCoor(){

	//http://www.webmasterworld.com/forum91/1553.htm

		//the width of the page content
		var contentWidth = 775;
		var	myWidth = 0;
	
		//http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=16
		if( typeof( window.innerWidth ) == 'number' ) {
			 //Non-IE
			myWidth = window.innerWidth;
		} else if( document.documentElement &&
		  ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			 //IE 6+ in 'standards compliant mode'
			 myWidth = document.documentElement.clientWidth;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
		}	
		
		if (myWidth > contentWidth){
			x = (myWidth - contentWidth) / 2;
		}else{
			x = 10;
		}
			
		//window.status = 'The blank space = ' + x + ' ...available width = ' + myWidth;
}