<!--
var bDebug = true;
var bLive = false;

var URLarray = document.URL.split("/");
var completeURL = URLarray[0] + "//" + URLarray[2] + "/";

if (completeURL.indexOf("artisanalcellars.com")) {
	var bLive = true;
	var bDebug = false;
}

// some globals
var getURL = "";
var response = "";
var pcontent =  "";

// mark the DIV to alter
var targetDIV = "content";

function LoadContent() {
	//alert("LoadContent");
	
	// find querystring
	var qs = new Querystring();
	pcontent = qs.get("view");
	
	if (pcontent == null) {
		pcontent = "Home";
	}	
	
	// update the DIV
	loadXMLDoc(pcontent);
}

function ChangeContent(pName) {
	//tell the user what si going on
	var dispDiv=document.getElementById(targetDIV);
	dispDiv.innerHTML = "Loading...";
	
	// load the DIV
	loadXMLDoc(pName);
}

function loadXMLDoc(pName) {
	//alert("loadXMLDoc(" + pName + ")");
	
	// get the global right
	pcontent = pName 
	
	// make url for data pull
	var time = new Date();
	
	if (bLive) {
		// for real site
		getURL = completeURL + pName + ".html?now=" + time;
	} else {
		// for testing
		getURL = completeURL + pName + ".html?now=" + time;
	}
	
	if (bDebug) alert(getURL);
	
	// flag default	
	req = false;
	
	// branch for native XMLHttpRequest object
	if(window.XMLHttpRequest) {
		try {
		req = new XMLHttpRequest();
		} catch(e) {
		req = false;
		}
		
	// branch for IE/Windows ActiveX version
	} else if(window.ActiveXObject) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				req = false;
			}
		}
	}
	
	// check flag and continue if possible
	if(req) {
		req.onreadystatechange = processReqChange;
		req.open("GET", getURL, true);
		req.send("");
	}
}

function processReqChange() {
	if (bDebug) alert("processReqChange()");
	// only if req shows "loaded"
	if (req.readyState == 4) {
		// only if "OK"
		if (bDebug) alert("readystate is OK");
		if (req.status == 200) {
			if (bDebug) alert("status is OK");
			if (bDebug) alert(req.responseText);
			
			var strCleanHTML = req.responseText;			

			// update the data object
			changeInnerHTML(targetDIV,strCleanHTML);
			//var dispDiv=document.getElementById(targetDIV);
			//dispDiv.innerHTML = strCleanHTML;	

		} else {
			if (req.statusText == "Object Not Found" && pcontent != "Main") {
				alert("Sorry, we couldn't not find the " + pcontent + " page, you are being redirected to the Homepage.")
				pcontent = "Main";
				loadXMLDoc(pcontent);
			} else {
				// update the data object
				var dispDiv=document.getElementById(targetDIV);
				var dispError= "The Artisanal Cellars you requested is still under construction, please check back for " + pcontent + " information <br><br><center><img src='image_under_construction.jpg'></center>";
				dispDiv.innerHTML = dispError;
				//alert("The Salt hill Pub you requested is still under construction, please check back for " + pcontent + " information");
			}
		}
	} else {
		if (bDebug) alert("There was a problem finding the data:\n" + req.readyState);		
	}	
}

// cross browser code
function changeInnerHTML(divId,html){
 if (document.getElementById) {
       document.getElementById(divId).innerHTML= html;
 }else{
     document.layers[divId].document.open();
     document.layers[divId].document.write(html);
     document.layers[divId].document.close();
 }
}


// querystring code
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = new Object()
	this.get=Querystring_get
	
	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name
		
		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	// This silly looking line changes UNDEFINED to NULL
	if (default_ == null) default_ = null;
	
	var value=this.params[key]
	if (value==null) value=default_;
	
	return value
}

// hidden div code
	function toggle( targetId ){
		target = document.getElementById( targetId );
		if (target.style.display == ""){
			target.style.display = "none";
		} else {
			target.style.display = "";
		}
	}

// cookie code
	function getexpirydate( nodays){
		var UTCstring;
		Today = new Date();
		nomilli=Date.parse(Today);
		Today.setTime(nomilli+nodays*24*60*60*1000);
		UTCstring = Today.toUTCString();
		return UTCstring;
	}
	
	function getcookie(cookiename) {
		 var cookiestring=""+document.cookie;
		 var index1=cookiestring.indexOf(cookiename);
		 if (index1==-1 || cookiename=="") return ""; 
		 var index2=cookiestring.indexOf(';',index1);
		 if (index2==-1) index2=cookiestring.length; 
		 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
	}
	
	function setcookie(name,value,duration){
		cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration);
		document.cookie=cookiestring;
			if(!getcookie(name)){
			return false;
			}
			else{
	//		location.reload();
		}
	}
	
// hide all text in status window
	function hidestatus(){ 
		window.status='' 
		return true 
		} 
		if (document.layers) 
		document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT) 
		document.onmouseover=hidestatus 
		document.onmouseout=hidestatus 	

// random pic code
var pic, alt;
pic = new Array;
// hover alt tags
alt = new Array;

pic[0] = "aglianico.png";alt[0] = "aglianico.png";
pic[1] = "barou.png";alt[1] = "barou.png";
pic[2] = "camplazens.png";alt[2] = "camplazens.png";
pic[3] = "chateau.png";alt[3] = "chateau.png";
pic[4] = "crozes-hermitage.png";alt[4] = "crozes-hermitage.png";
pic[5] = "fiano.png";alt[5] = "fiano.png";
pic[6] = "frederic mallo alsace.png";alt[6] = "frederic mallo alsace.png";
pic[7] = "frederic mallo.png";alt[7] = "frederic mallo.png";
pic[8] = "young.png";alt[8] = "young.png";
pic[9] = "HG.png";alt[9] = "HG.png";
pic[10] = "hilberg barbera dalba.png";alt[10] = "hilberg barbera dalba.png";
pic[11] = "hilberg vareij.png";alt[11] = "hilberg vareij.png";
pic[12] = "il puntone.png";alt[12] = "il puntone.png";
pic[13] = "la sala.png";alt[13] = "la sala.png";
pic[14] = "majara.png";alt[14] = "majara.png";
pic[15] = "masut da rive.png";alt[15] = "masut da rive.png";
pic[16] = "meinklang.png";alt[16] = "meinklang.png";
pic[17] = "rosenberg.png";alt[17] = "rosenberg.png";
pic[18] = "samling 88.png";alt[18] = "samling 88.png";
pic[19] = "scarzello.png";alt[19] = "scarzello.png";
pic[20] = "serendipity.png";alt[20] = "serendipity.png";
pic[21] = "special delivery.png";alt[21] = "special delivery.png";
pic[22] = "steininger.png";alt[22] = "steininger.png";
pic[23] = "wagram.png";alt[23] = "wagram.png";


// for the inline script
var ic = pic.length;

var rnow = new Date();
var seed = rnow.getTime() % 0xffffffff;

	function rand(n) {
		seed = (0x015a4e35 * seed) % 0x7fffffff;
		return ( seed >> 16 ) % n;
	}


function showOrganic() {
	Tip('Organic - Concerns over chemical residues in the foods we eat have lead many people to seek out organic produce and organically made products, wine included. A wine made from organically grown grapes has no chemical residue from pesticides, herbicides, or chemical fertilizers. Organically grown grapes come from living, breathing soil, full of microbial life unhampered by unnatural treatments. These grapes are generally healthier and more alive, with a higher content of natural trace elements and minerals (broken down by the microbes in the soil and absorbed by the vine\'s root system). This brings forth better tasting fruit, rich in minerality and \&#34;terroir\&#34; that is unique to the soil from which it was produced, and, it\'s no secret that better tasting grapes inevitably make better tasting wines.', WIDTH, 250, ABOVE, true, OFFSETX, 1, FADEIN, 400, FADEOUT, 300); }

function showSustainable() {
	Tip('Sustainable - Sustainable vineyards are essentially run the same as organic vineyards except they reserve the right to use pesticides in an emergency, such as the possibility of losing their entire crop. In general wines made from sustainable, organic, and biodynamically grown grapes are lower in sulfur than wines made from conventional farming methods. Many growers exert a more mindful approach to winemaking, using indigenous yeasts and taking a non-interventionist approach towards handcrafting their wines, none of these wines will have any harmful chemical residues.', WIDTH, 250, ABOVE, true, OFFSETX, 1, FADEIN, 400, FADEOUT, 300); }

function showBiodynamic() {
	Tip('Biodynamic - Biodynamic viticulture takes the principles of organic farming to a higher degree. It stresses the importance of the many balances (and imbalances) in nature, which affect the health and homeopathic strength of the vine. Natural holistic treatments are used to increase the vine\'s resistance to disease. At its core biodynamics is a common sense approach to viticulture employing age-old wisdom that studies the relationship of the vine with the sun, moon, stars, and earth. A biodynamic vineyard is in complete harmony with its surroundings, and is generally a self-sufficient entity.', WIDTH, 250, ABOVE, true, OFFSETX, 1, FADEIN, 400, FADEOUT, 300); }


-->