
function init() {
	var t = document.getElementById("textbox");
	//alert(t.innerHTML )
	var c = replaceBreaks ( t.innerHTML );
	
	var p0 = c.indexOf(".");
	//var p0 = c.indexOf(".") + 1;
	var p1 = c.substring( p0+1 ).indexOf(".")+ p0+1;
	//var p1 = c.substring( p0+1 ).indexOf(".")+ p0+2;
	var firstSentence = c.substring(0,p0+1);
	var secondSentence = c.substring(p0+1,p1);
	var theRest = c.substring(p1);
	
	var newText = "<span style='font-size:14px;font-weight:bold;color:#075795; line-height:16px;'>"
	+firstSentence+"</span> <span style='font-size:11px;font-weight:bold;color:#075795;'>"
	+secondSentence+"</span>"+theRest;
	
	var unBRtext = replaceBreaks ( newText );
	
	t.innerHTML = unBRtext;
	
	document.getElementById("shield").style.display= "none";

	if (notes[0]+notes[1]+notes[2]=="") return;
	
	var c = "";
	while (c == "") {
		c = unescape(notes[rnd(notes.length)]);
	}
	var pp = c.indexOf("--");
	var o = c;
	var a = "";
	if (pp!=-1) {
		var o = c.substring(0,pp);
		var a = c.substring(pp+2);
	}
	var t = document.getElementById("tastingNotes");
	t.innerHTML = o
		+ "<br /><span style='font-size:16px;color:#DD3B33;'>"
		+ a.toUpperCase() + "</span>";
		
	document.getElementById("shield").style.display= "block";
}

function replaceBreaks( str ){
	var br0 = str.indexOf("<br><br>");
	
	// IE sees tags as uppercase
	if( br0 == -1 ) {
		var br0 = str.indexOf("<BR><BR>");
		if( br0 == -1 ) return str;
	}
	var br1 = br0+8;
	var ttt = str.substring(br0,br1);
	var firstPart = str.substring(0,br0);
	var secondPart = str.substring(br1);
	var newString = firstPart + '<br><span class="spacer">&nbsp;</span><br>' + secondPart;
	/// RECURSION
	var finalString = replaceBreaks( newString );
	return finalString;
}

function rollOverMe(DIV, BGCOLOR, COLOR){
	DIV.parentNode.style.zIndex=1000;
	DIV.style.backgroundColor = BGCOLOR;
	DIV.style.color = COLOR;
	DIV.style.height = "auto";
}

function rollOutMe(DIV, BGCOLOR, COLOR){
	DIV.parentNode.style.zIndex=1;
	DIV.style.backgroundColor = BGCOLOR;
	DIV.style.color = COLOR;
	DIV.style.height = "15px";
}

function getResource(res)
{
	var newwindow = window.open(res,'resource');
	return;
	
	// for password protection
	if (Get_Cookie("LOGGEDON")==null)
	{
		var s = prompt("Please enter the password to download resources.", "");
		if (s == "grateful")
		{
			var today = new Date();
			var zero_date = new Date(0,0,0);
			today.setTime(today.getTime() - zero_date.getTime());
			var cookie_expire_date = new Date(today.getTime() + 1000*60); 
			Set_Cookie("LOGGEDON", true, cookie_expire_date);
		}
	}
	
	if (Get_Cookie("LOGGEDON")!=null)
	{
		var newwindow = window.open(res,'resource');
	}
}


function rnd(i){
	return Math.floor(Math.random()*i);
}
