<!--
if (document.images)
    window.name = "mainWineWindow";
//-->


<!--   hide this script from non-javascript-enabled browsers

function funReplaceStr(sTextToSearch,sReplaceThis,sWithThis) {
	var strLength = sTextToSearch.length, txtLength = sReplaceThis.length;
	if ((strLength == 0) || (txtLength == 0)) return sTextToSearch;

	var i = sTextToSearch.indexOf(sReplaceThis);
	if ((!i) && (sReplaceThis != sTextToSearch.substring(0,txtLength))) return sTextToSearch;
	if (i == -1) return sTextToSearch;

	var newstr = sTextToSearch.substring(0,i) + sWithThis;

	if (i+txtLength < strLength) 	newstr += funReplaceStr(sTextToSearch.substring(i+txtLength,strLength),sReplaceThis,sWithThis);
	return newstr;
}

	function show(object,e,xOffset, yOffset) {
	    if (document.layers && document.layers[object]) {
	        document.layers[object].left = e.pageX+xOffset;
					document.layers[object].top = e.pageY+yOffset;
	        document.layers[object].visibility = 'visible'; }
	    else if (document.all) {
					document.all[object].style.posLeft = e.clientX+xOffset;
					document.all[object].style.posTop = e.clientY+yOffset;
					document.all[object].style.visibility = 'visible'; }
	}

	function hide(object) {
	    if (document.layers && document.layers[object])
	        document.layers[object].visibility = 'hidden';
	    else if (document.all)
	        document.all[object].style.visibility = 'hidden';
	}
	
	//beacHut.com
	//Simon Davies
	//Feb 24 2000
	//Gets rid of trailing white space
	function fnTrim(sText)
	{
		//Leading spaces
		if (sText.length > 0)
			{
			while (sText.substring(0,1) == ' ') 
				sText = sText.substring(1, sText.length);
			//Trailing spaces
			while (sText.substring(sText.length-1,sText.length) == ' ')
				sText = sText.substring(0, sText.length-1);
			}
	return sText;
	} 

	//function that displays status bar message
var showMsg = navigator.userAgent != "Mozilla/4.0 (compatible; MSIE 4.0; Mac_PowerPC)";
function dmim(msgStr) {
  document.returnValue = false;
  if (showMsg) { 
    window.status = msgStr;
    document.returnValue = true;
  }
}

	//function that checks if a date is valid - dd/mm/yyyy
function isDateValid (sDate, sSep) {
	if (sDate.length == 0) 
		return true;
	if (sDate.length == 10) {
		if (sDate.substring(2,3) == sSep && sDate.substring(5,6) == sSep) {
			var sDay  = sDate.substring(0,2);
			var sMonth = sDate.substring(3,5);
			var sYear  = sDate.substring(6,10);
			var sYear2  = sYear.substring(2,4);
			var sNewDate = new Date(sYear,sMonth-1,sDay);
			if ((sYear == sNewDate.getYear() || sYear2 == sNewDate.getYear()) && (sMonth-1 == sNewDate.getMonth()) && (sDay == sNewDate.getDate())) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
		return false;
		}
	}
	else {
		return false;
	}
}


		//open another window with selected wine details		
		function funWineInfo(frmWinesFound)
			{
			var sMsg = "";
			var iWineID = fnTrim(frmWinesFound.cbWines.value);
			if (iWineID.length != 0) 
				{
				if (iWineID > -1) 
					{				
					var wnPopUp = window.open("../Wines/popUpPRoductDetails.asp?newwindow=1&merchantenquiry=1&LG=1&PID=" + iWineID,"NewWindow","scrollbars=yes,status=no,width=380,height=250")
					wnPopUp.focus();
					}
				else 
					{
					sMsg = sMsg + "  Choose a wine first\n";
					}
				}
				else
				{
					sMsg = sMsg + "  Choose a wine first\n";
				}			
			
			if (sMsg.length != 0)
				{
				alert(sMsg);
				}
			}


	//DISPLAY DIV Stuff
	//Find out the capability of the browser being used
	var ns4=document.layers;
	var ns6=document.getElementById&&!document.all;
	var ie4=document.all;
	var opr=navigator.userAgent.indexOf("Opera");

  //Expiry for temp cookies
	var today = new Date();
	var expiresInOneDay = new Date(today.getTime() + (1 * 86400000));

  //This function controls the use of dhtml div layers, and their display including flipping images, and maintaining state in a cookie for page navigation
	function showDisplay(divToShow, imageToSwap, newImageSrc, cookieName, cookieVal, cookieExpires) {
	    if (ns4) {
	        document.layers[divToShow].display = '';}
	    else if (ie4) {
					document.all[divToShow].style.display = '';}
	    else if (ns6) {
					document.getElementById(divToShow).style.display = '';}
			
			toggleImage(imageToSwap,newImageSrc);
			Set_Cookie(cookieName, cookieVal, cookieExpires);
	}

	function hideDisplay(divToHide, imageToSwap, newImageSrc, cookieName, cookieVal, cookieExpires) {
	    if (ns4)
	        document.layers[divToHide].display = 'none';
	    else if (ie4)
	        document.all[divToHide].style.display = 'none';
	    else if (ns6) {
					document.getElementById(divToHide).style.display = 'none';}

			toggleImage(imageToSwap,newImageSrc);
			Set_Cookie(cookieName, cookieVal, cookieExpires);
	}

	function toggleImage(name,src) {
	    if (document.images)
	        document.images[name].src = src;
	}


	function showAbsolute(divToShow) {
	    if (ns4) {
	        document.layers[divToShow].visibility = 'visible'; 
	        document.layers[divToShow].display = '';}
	    else if (ie4) {
					document.all[divToShow].style.visibility = 'visible'; 
					document.all[divToShow].style.display = '';}
	    else if (ns6) {
					document.getElementById(divToShow).style.visibility = 'visible'; 
					document.getElementById(divToShow).style.display = '';}
	}

	function showAbsolutePos(divToShow,iTop,iLeft) {
	    if (ns4) {
	        document.layers[divToShow].visibility = 'visible'; 
	        document.layers[divToShow].display = '';
	        document.layers[divToShow].top = iTop; 
	        document.layers[divToShow].left = iLeft;}
	    else if (ie4) {
					document.all[divToShow].style.visibility = 'visible'; 
					document.all[divToShow].style.display = '';
	        document.all[divToShow].style.posTop = iTop; 
	        document.all[divToShow].style.posLeft = iLeft;}
	    else if (ns6) {
					document.getElementById(divToShow).style.visibility = 'visible'; 
					document.getElementById(divToShow).style.display = '';
	        document.getElementById(divToShow).style.top = iTop; 
	        document.getElementById(divToShow).style.left = iLeft;}
	}

	function showAbsolutePos2(divToShow,iTop,iLeft,iNetscapeTop, iNetscapeLeft) {
	    if (ns4) {
	        document.layers[divToShow].visibility = 'visible'; 
	        document.layers[divToShow].display = '';
	        document.layers[divToShow].top = iTop; 
	        document.layers[divToShow].left = iLeft;}
	    else if (ie4) {
					document.all[divToShow].style.visibility = 'visible'; 
					document.all[divToShow].style.display = '';
	        document.all[divToShow].style.posTop = iTop; 
	        document.all[divToShow].style.posLeft = iLeft;}
	    else if (ns6) {
					document.getElementById(divToShow).style.visibility = 'visible'; 
	        document.getElementById(divToShow).style.top = iNetscapeTop; 
	        document.getElementById(divToShow).style.left = iNetscapeLeft;}
	}

	function hideAbsolute(divToShow) {
	    if (ns4) {
	        document.layers[divToShow].visibility = 'hidden'; 
	        document.layers[divToShow].display = 'none';}
	    else if (ie4) {
					document.all[divToShow].style.visibility = 'hidden'; 
					document.all[divToShow].style.display = 'none';}
	    else if (ns6) {
					document.getElementById(divToShow).style.visibility = 'hidden'; 
					document.getElementById(divToShow).style.display = 'none';}
	}

	function hideAbsolutePos(divToShow,iTop,iLeft) {
	    if (ns4) {
	        document.layers[divToShow].visibility = 'hidden'; 
	        document.layers[divToShow].display = 'none';
	        document.layers[divToShow].top = iTop; 
	        document.layers[divToShow].left = iLeft;}
	    else if (ie4) {
					document.all[divToShow].style.visibility = 'hidden'; 
					document.all[divToShow].style.display = 'none';
	        document.all[divToShow].style.posTop = iTop; 
	        document.all[divToShow].style.posLeft = iLeft;}
	    else if (ns6) {
					document.getElementById(divToShow).style.visibility = 'hidden'; 
					document.getElementById(divToShow).style.display = 'none';
	        document.getElementById(divToShow).style.top = iTop; 
	        document.getElementById(divToShow).style.left = iLeft;}
	}

	function hideAbsolutePos2(divToShow,iTop,iLeft,iNetscapeTop, iNetscapeLeft) {
	    if (ns4) {
	        document.layers[divToShow].visibility = 'hidden'; 
	        document.layers[divToShow].display = 'none';
	        document.layers[divToShow].top = iTop; 
	        document.layers[divToShow].left = iLeft;}
	    else if (ie4) {
					document.all[divToShow].style.visibility = 'hidden'; 
					document.all[divToShow].style.display = 'none';
	        document.all[divToShow].style.posTop = iTop; 
	        document.all[divToShow].style.posLeft = iLeft;}
	    else if (ns6) {
					document.getElementById(divToShow).style.visibility = 'hidden'; 
	        document.getElementById(divToShow).style.top = iNetscapeTop; 
	        document.getElementById(divToShow).style.left = iNetscapeLeft;}
	}


	function funSetTimerToLoadBanner(){
		var time= new Date();
		hours= time.getHours();
		mins= time.getMinutes();
		secs= time.getSeconds();
		closeTime=hours*3600+mins*60+secs;
		closeTime+=iRotateInSeconds;	
		funLoadBanner();
	}

	function funLoadBanner(){
		var time= new Date();
		hours= time.getHours();
		mins= time.getMinutes();
		secs= time.getSeconds();
		curTime=hours*3600+mins*60+secs
		if (curTime>=closeTime){
			if (iAddBeingShown < iNumberOfAds){
				iAddBeingShown++;
				document.imgBannerToRotate.src = imgBanner[iAddBeingShown].src;
			}
			else{
				iAddBeingShown = 1;
				document.imgBannerToRotate.src = imgBanner[iAddBeingShown].src;
			}
			funSetTimerToLoadBanner();
		}
		else{
			window.setTimeout("funLoadBanner()",1000)
		}
	}


function funClickThisLink(sURLtoLink){
	var windowName = window.open(sURLtoLink,"AdLinkedWindow");
	windowName.focus();
}

	function Get_Cookie(name) {
	  var start = document.cookie.indexOf(name + '=');
	  var len = start + name.length + 1;
	  if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
	  if (start == -1) return null;
	  var end = document.cookie.indexOf(';',len);
	  if (end == -1) end = document.cookie.length;
	  return unescape(document.cookie.substring(len,end));
	}

	function Set_Cookie(name,value,expires,path,domain,secure) {
	  path="/";
	  document.cookie = 
	    name + '=' + escape(value) +
	    ( (expires) ? ';expires=' + expires.toGMTString() : '') +
	    ( (path) ? ';path=' + path : '') + 
	    ( (domain) ? ';domain=' + domain : '') +
	    ( (secure) ? ';secure' : '');
	}

	function Delete_Cookie(name,path,domain) {
	  if (Get_Cookie(name))
	    document.cookie =
	      name + '=' +
	      ( (path) ? ';path=' + path : '') +
	      ( (domain) ? ';domain=' + domain : '') +
	      ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
	}
	
	function showStatus(text) {
	    window.setTimeout('window.status="' + text + '"', 1);
	}


function funArrayOfSuggestions(sArrayOfSuggestions, sArrayOfSuggestionsNoForeign, sSearchForTextBox, cbSuggestionBox, divSuggestion) {
	var sText=sSearchForTextBox.value.toLowerCase();
	var j=0;
	var sProducerFromArray = "";

	sText=funReplaceStr(sText,'â','a');
	sText=funReplaceStr(sText,'à','a');
	sText=funReplaceStr(sText,'ä','a');
	sText=funReplaceStr(sText,'é','e');
	sText=funReplaceStr(sText,'è','e');
	sText=funReplaceStr(sText,'ê','e');
	sText=funReplaceStr(sText,'ë','e');
	sText=funReplaceStr(sText,'î','i');
	sText=funReplaceStr(sText,'ï','i');
	sText=funReplaceStr(sText,'ô','o');
	sText=funReplaceStr(sText,'ö','o');
	sText=funReplaceStr(sText,'ò','o');
	sText=funReplaceStr(sText,'õ','o');
	sText=funReplaceStr(sText,'ü','u');
	sText=funReplaceStr(sText,'û','u');
	sText=funReplaceStr(sText,'ú','u');
	sText=funReplaceStr(sText,'ç','c');
	sText=funReplaceStr(sText,'ñ','n');

	with(cbSuggestionBox) {
		for(var i=options.length-1;i>-1;i--) {
			options[i] = null;
		}

		if (sText.length>0) {
			for(i=0;i<sArrayOfSuggestions.length;i++)	{
				sProducerFromArray=sArrayOfSuggestionsNoForeign[i].toLowerCase();								
				if(sProducerFromArray.indexOf(sText) !=-1) {
					options[j] = new Option(sArrayOfSuggestions[i]);
					j++;
				}
			}
		}

		if (j>10) {
			j=10;
		}

		cbSuggestionBox.size=j;
	   
		if (cbSuggestionBox.length==0) {
			hideAbsolute(divSuggestion);
		} 
		else {
			showAbsolute(divSuggestion);
		}
	}
}

function funArrayOfSuggestionsBeginsWith(sArrayOfSuggestions, sArrayOfSuggestionsNoForeign, sSearchForTextBox, cbSuggestionBox, divSuggestion) {
	var sText=sSearchForTextBox.value.toLowerCase();
	var j=0;
	var sProducerFromArray = "";

	sText=funReplaceStr(sText,'â','a');
	sText=funReplaceStr(sText,'à','a');
	sText=funReplaceStr(sText,'ä','a');
	sText=funReplaceStr(sText,'é','e');
	sText=funReplaceStr(sText,'è','e');
	sText=funReplaceStr(sText,'ê','e');
	sText=funReplaceStr(sText,'ë','e');
	sText=funReplaceStr(sText,'î','i');
	sText=funReplaceStr(sText,'ï','i');
	sText=funReplaceStr(sText,'ô','o');
	sText=funReplaceStr(sText,'ö','o');
	sText=funReplaceStr(sText,'ò','o');
	sText=funReplaceStr(sText,'õ','o');
	sText=funReplaceStr(sText,'ü','u');
	sText=funReplaceStr(sText,'û','u');
	sText=funReplaceStr(sText,'ú','u');
	sText=funReplaceStr(sText,'ç','c');
	sText=funReplaceStr(sText,'ñ','n');

	with(cbSuggestionBox) {
		for(var i=options.length-1;i>-1;i--) {
			options[i] = null;
		}

		if (sText.length>0) {
			for(i=0;i<sArrayOfSuggestions.length;i++)	{
				sProducerFromArray=sArrayOfSuggestionsNoForeign[i].toLowerCase();								
				if(sProducerFromArray.indexOf(sText) ==0) {
					options[j] = new Option(sArrayOfSuggestions[i]);
					j++;
				}
			}
		}

		if (j>10) {
			j=10;
		}

		cbSuggestionBox.size=j;
	   
		if (cbSuggestionBox.length==0) {
			hideAbsolute(divSuggestion);
		} 
		else {
			showAbsolute(divSuggestion);
		}
	}
}
function funSelectSuggestion(cbSuggestionBox, sSearchForTextBox, frmSuggestion) {
		sSearchForTextBox.value = cbSuggestionBox.options(cbSuggestionBox.selectedIndex).text;
		frmSuggestion.submit()	;
}

function funArrayOfSuggestionsAndID(sArrayOfSuggestions, sArrayOfSuggestionsNoForeign, sArrayOfSuggestionsIDs, sSearchForTextBox, cbSuggestionBox, divSuggestion) {
	var sText=sSearchForTextBox.value.toLowerCase();
	var j=0;
	var sProducerFromArray = "";

	sText=funReplaceStr(sText,'â','a');
	sText=funReplaceStr(sText,'à','a');
	sText=funReplaceStr(sText,'ä','a');
	sText=funReplaceStr(sText,'é','e');
	sText=funReplaceStr(sText,'è','e');
	sText=funReplaceStr(sText,'ê','e');
	sText=funReplaceStr(sText,'ë','e');
	sText=funReplaceStr(sText,'î','i');
	sText=funReplaceStr(sText,'ï','i');
	sText=funReplaceStr(sText,'ô','o');
	sText=funReplaceStr(sText,'ö','o');
	sText=funReplaceStr(sText,'ò','o');
	sText=funReplaceStr(sText,'õ','o');
	sText=funReplaceStr(sText,'ü','u');
	sText=funReplaceStr(sText,'û','u');
	sText=funReplaceStr(sText,'ú','u');
	sText=funReplaceStr(sText,'ç','c');
	sText=funReplaceStr(sText,'ñ','n');

	with(cbSuggestionBox) {
		for(var i=options.length-1;i>-1;i--) {
			options[i] = null;
		}

		if (sText.length>0) {
			for(i=0;i<sArrayOfSuggestions.length;i++)	{
				sProducerFromArray=sArrayOfSuggestionsNoForeign[i].toLowerCase();								
				if(sProducerFromArray.indexOf(sText) !=-1) {
					options[j] = new Option(sArrayOfSuggestions[i]);
					options[j].value = sArrayOfSuggestionsIDs[i];
					j++;
				}
			}
		}

		if (j>10) {
			j=10;
		}

		cbSuggestionBox.size=j;
	   
		if (cbSuggestionBox.length==0) {
			hideAbsolute(divSuggestion);
		} 
		else {
			showAbsolute(divSuggestion);
		}
	}
}

function funSelectSuggestionAndID(cbSuggestionBox, sSearchForTextBox, sDestinationIDTextBox, sTextForDestination, frmSuggestion) {
	sSearchForTextBox.value = cbSuggestionBox.options(cbSuggestionBox.selectedIndex).text;
	sTextForDestination=funReplaceStr(sTextForDestination,'|',cbSuggestionBox.options(cbSuggestionBox.selectedIndex).value);
	sTextForDestination=funReplaceStr(sTextForDestination,'~',cbSuggestionBox.options(cbSuggestionBox.selectedIndex).text);
	sTextForDestination=funReplaceStr(sTextForDestination,'DQ','"');
	sTextForDestination=funReplaceStr(sTextForDestination,'LF','\n');
	sDestinationIDTextBox.value = sTextForDestination;
}

function funClear(sTextBox) {
	sTextBox.value = '';
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function setTextOfLayer(objName,x,newText) { 
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}



// stop hiding -->

