/* javascript document */

// body images preloader
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// lightbox type
/*var w=0;
var opacity=0;
var y;
var lbox;
var viewportwidth;
var viewportheight;
var overblk=0;
var agt=navigator.userAgent.toLowerCase();
var winloc=0;
if (typeof window.innerWidth != 'undefined')
{
  viewportwidth = window.innerWidth,
  viewportheight = window.innerHeight
}
else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
{
   viewportwidth = document.documentElement.clientWidth,
   viewportheight = document.documentElement.clientHeight
}
else
{
   viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
   viewportheight = document.getElementsByTagName('body')[0].clientHeight
}

function getPageSizeWithScroll()
{
 if (window.innerHeight && window.scrollMaxY) 
 {// Firefox
  yWithScroll = window.innerHeight + window.scrollMaxY;
  xWithScroll = window.innerWidth + window.scrollMaxX;
 }
 else if (document.body.scrollHeight > document.body.offsetHeight)
 { // all but Explorer Mac
  yWithScroll = document.body.scrollHeight;
  xWithScroll = document.body.scrollWidth;
 }
 else
 { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
  yWithScroll = document.body.offsetHeight;
  xWithScroll = document.body.offsetWidth;
   }
 pheight=yWithScroll;
}*/
function $(id)
{
  return document.getElementById(id);
}
function getid(id)
{
  return document.getElementById(id);
}
/*function open_layer(no)
{
 	getPageSizeWithScroll();
	
	lbox="lbox"+no;
	$("overlay").style.display="block";
	overblk=1;
	if (agt.indexOf("firefox") != -1)
	{
		y=document.documentElement.scrollTop;
		document.body.style.overflow="hidden";
		$("overlay").style.height="200%";
	}
	else if (agt.indexOf("ie") != -1)
	{
		y=document.documentElement.scrollTop;
		$("overlay").style.height="150%";
		document.body.scroll="no";
	}
	else if (agt.indexOf("netscape") != -1)
	{
		y=document.documentElement.scrollTop;
		document.body.style.overflow="hidden";
	}
	else if (agt.indexOf("safari") != -1)
	{
		y=document.body.scrollTop;
		document.body.style.overflow="hidden";
		document.getElementById("wrapper").style.height=viewportheight+"px";
		document.getElementById("wrapper").style.overflow="hidden"
	}
	else if (agt.indexOf("opera") != -1)
	{
		y=document.body.scrollTop;
		document.body.style.overflow="hidden";
		document.getElementById("wrapper").style.height=viewportheight+"px";
		document.getElementById("wrapper").style.overflow="hidden";
	}
	else
	{
		y=document.body.scrollTop;
	}
	light();
}*/
function light()
{
	if(w<80)
	{
		$("overlay").style.opacity = (w / 100);
		$("overlay").style.MozOpacity = (w / 100);
		$("overlay").style.KhtmlOpacity = (w / 100);
		$("overlay").style.filter = "alpha(opacity=" + w + ")";
		w=w+5;
		var t=setTimeout("light()",1);
	}	
	else
	{
		clearTimeout(t);
		y=y+50;
		if (agt.indexOf("safari") != -1)
		{
			$(lbox).style.top="20%";
		}
		else if (agt.indexOf("opera") != -1)
		{
			y=document.body.scrollTop;
			y=y+50;
			$(lbox).style.top=y+"px";
		}
		else
		{
			$(lbox).style.top=y+"px";
		}
		$(lbox).style.display="block";
	}
	
}
function closed()
{
	$(lbox).style.display="none";
	if (agt.indexOf("firefox") != -1)
	{
		document.body.style.overflow="auto";
	}
	else if (agt.indexOf("ie") != -1)
	{
		document.body.scroll="yes";
	}
	else if (agt.indexOf("netscape") != -1)
	{
		document.body.style.overflow="auto";
	}
	else if (agt.indexOf("safari") != -1)
	{
		document.getElementById("wrapper").style.height="auto";
		document.getElementById("wrapper").style.overflow="overflow";
		document.body.style.overflow="auto";
	}
	else if (agt.indexOf("opera") != -1)
	{
		document.getElementById("wrapper").style.height="auto";
		document.getElementById("wrapper").style.overflow="overflow";
		document.body.style.overflow="auto";
		
	}
	dlight();
}
function dlight()
{
	if(w>0)
	{
		$("overlay").style.opacity = (w / 100);
		$("overlay").style.MozOpacity = (w / 100);
		$("overlay").style.KhtmlOpacity = (w / 100);
		$("overlay").style.filter = "alpha(opacity=" + w + ")";
		w=w-2;
		var t2=setTimeout("dlight()",1);
	}	
	else
	{
		clearTimeout(t2);
		$("overlay").style.display="none";
			
		overblk=0;
	}
}


// make dob visible
/*document.onkeydown = checkKeycode
	function checkKeycode(e) 
	{
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		if(overblk ==1)
		{
			if(keycode==27)
			{
				$(lbox).style.display="none";
				if (agt.indexOf("firefox") != -1)
	{
		document.body.style.overflow="auto";
	}
	else if (agt.indexOf("ie") != -1)
	{
		document.body.scroll="yes";
	}
	else if (agt.indexOf("netscape") != -1)
	{
		document.body.style.overflow="auto";
	}
	else if (agt.indexOf("safari") != -1)
	{
		document.getElementById("wrapper").style.height="auto";
		document.getElementById("wrapper").style.overflow="overflow";
		document.body.style.overflow="auto";		
	}
	else if (agt.indexOf("opera") != -1)
	{
		document.getElementById("wrapper").style.height="auto";
		document.body.style.overflow="auto";
	}
				dlight();			
			}
		}
	}
	*/
function opendob(dobid,selectid)
{
	if(document.getElementById(selectid).value!='')
		document.getElementById(dobid).style.display="block";
	else
		document.getElementById(dobid).style.display="none";
}

// set check box value visible
function checkedbox(form)
{
	if(form.checked==true)
	{
		form.value="Yes";
	}
	else
	{
		form.value="No";
	}
	//alert("checkbox val = "+form.value);
}

function checkedbox_yn(form)
{
	if(form.checked==true)
	{
		form.value="y";
	}
	else
	{
		form.value="n";
	}
	//alert("checkbox val = "+form.value);
}

function enablefield(id1,id2)
{
	if(document.getElementById(id1).value=="Other")
	{
		document.getElementById(id2).disabled=false;
	}
	else
	{
		document.getElementById(id2).disabled=true;
	}
	//alert("Other  = "+document.getElementById(id2).disabled);
}

function testnumeric(pass) {
	var valid = "1234567890"
	var k = "y";
	var temp;
	for (var i=0; i<pass.value.length; i++) {
		temp = "" + pass.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") {
			k = "n";
		}
	}
	if (k == "n") {
		alert("Only numerical in this field please!");
		pass.focus();
		pass.select();
		pass.value = "";
	}
}

function testit(pass) {
	var valid = "1234567890:+-"
	var k = "y";
	var temp;
	for (var i=0; i<pass.value.length; i++) {
		temp = "" + pass.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") {
			k = "n";
		}
	}
	if (k == "n") {
		alert("Only numerical in this field please!");
		pass.focus();
		pass.select();
		pass.value = "";
	}
}

// ONLINE TOUR page popup flash launch
function PopupCenter(pageURL,title) {
	var w=1024;
	var h=768;
	var left = (screen.width/2)-(w/2);
	var top = (screen.height/2)-(h/2);
	window.open(pageURL,'win','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
function alter()
{
	document.write('<img src=\"images/flash_alt.gif\" alt=\"THE BALVENIE\" width=\"191\" height=\"110\" /><br class=\"clear\">Flash player not available. Please click <a href=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\" >here<\/a> to install<br \/><br \/>');	
}
function chkBrwsr() {
var OpSys = checkOS();
if (OpSys == "Macintosh")
{
	return 2;
	} 
	else if (browser.isIE)
	{
		return 1;
		}
		return 0;
	}
function alterhead()
{
	document.write('<img src=\"images/img_headerFlash.jpg\" alt=\"THE BALVENIE\" width=\"603\" height=\"93\" /><br class=\"clear\">Flash player not available. Please click <a href=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\" >here<\/a> to install<br \/><br \/>');	
}

function alterreg()
{
	document.write('<img src=\"images/img_whichMalt.jpg\" alt=\"THE BALVENIE\" width=\"430\" height=\"101\" /><br class=\"clear\">Flash player not available. Please click <a href=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\" class=\"alterLink\" >here<\/a> to install<br \/><br \/>');	
}
function alterws()
{
	document.write('Flash player not available. Please click <a href=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\" class=\"alterLink\" >here<\/a> to install<br \/><br class=\"clear\"><img src=\"images/img_WSFlash.gif\" alt=\"THE WHISKY SHELF\" width=\"862\" height=\"602\" /><br \/>');	
}



// ONLINE TOUR flash page popup resize toggle
function fullScreenToggle(toggle) {
	if (toggle == "true")
	{
		window.moveTo(0,0);
	    
		var OpSys = checkOS();
		if (OpSys == "Macintosh") {
			var agt=navigator.userAgent.toLowerCase();
			if (agt.indexOf("firefox") != -1)
			{
					window.moveTo(1,1);
			}
		}
		
		window.resizeTo(screen.width, screen.height);
		thisMovie("tour").width=screen.width;
		thisMovie("tour").height=screen.height-100;
	}
	else if (toggle == "false")
	{
		var width = 1024;
		var height = 768;
		window.resizeTo(1034,848);
		wndLeft = CenterWndLeft(width);
		wndTop = CenterWndTop(height);
		window.moveTo(wndLeft,wndTop);
		thisMovie("tour").width=width;
		thisMovie("tour").height=height;
	}
}

function thisMovie(movieName){
    if (navigator.appName.indexOf("Microsoft") != -1){
        return window[movieName]
    }else{		
        return document[movieName]		
    }
}
function checkOS() {
	if(navigator.userAgent.indexOf('Mac') != -1){
		return  "Macintosh";
	}
}
function CenterWndLeft(width) {
	return screen.width/2 - width/2;
}
function CenterWndTop(height) {
	return screen.height/2 - height/2;
}


// ONLINE TOUR flash page popup close
function exitNow(exitPop) {
	if (exitPop == "1")
	{	
		window.close();
	}
	else if
	(exitPop == "2")
	{
		window.close();
		window.opener.location.href='ourRange.php'
	}
}

/* W24 The Whisky Shelf - flash gallery */
function setFlashHeight(val){
	//alert(val);
	//WS_main.height=val;
	thisMovie("WS_main").height=val;
	window.scrollTo(0,0);
	window.scroll(0,0);
	//document.getElementById("WS_main").style.height=val;
}
function scrollWindow(){
	window.scrollTo(0,0);
	alert("window")
	window.scroll(0,0);
}

// Home page image change on refresh
function swapPic() 
{
	var bgNum = Math.round(Math.random() * 4)
	bgSel = new Array(5);
	bgSel[0] = "img_hmImg01.jpg";
	bgSel[1] = "img_hmImg02.jpg";
	bgSel[2] = "img_hmImg03.jpg";
	bgSel[3] = "img_hmImg04.jpg";
	bgSel[4] = "img_hmImg05.jpg";
	document.getElementById('hmImg').src="images/"+bgSel[bgNum];
}


/* W24 malt slider flash funtionality */
/*
var num = 0;
var value = 0;
var divIdName ="slider";
var chk = "drink"+num;
function addMore() {
	  ///alert(numLinesAdded);
  var ni = document.getElementById('slider').innerHTML;
  var numi = document.getElementById('theValue');
  num++;
  divIdName = "my"+num+"Div";
  var txtName = "maltName"+num;
  var newdiv = document.createElement('div');
  newdiv.setAttribute("id",divIdName);
  document.getElementById('myDiv').appendChild(newdiv);
  document.getElementById(divIdName).innerHTML+='<label for="maltName">Malt Name</label><input type="text" id="maltName'+num+'" name="maltName[]" value="" onkeyup="chk(\'maltName'+num+'\')" class="inputBox3" />';
  AC_FL_RunContent2('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width', '430','height', '101','src', 'flash/externalSlider','quality', 'high','pluginspage', 'http://www.macromedia.com/go/getflashplayer','align', 'center','play', 'true','loop', 'true','scale', 'scale', 'wmode', 'transparent','devicefont', 'false','id', 'externalSlider','name', 'externalSlider','menu', 'false','allowScriptAccess','sameDomain','movie', 'flash/externalSlider','salign', 'lt');  
  document.getElementById(divIdName).innerHTML+='<input type="hidden" value="0" id="theValue'+num+'" name="4[]" /><input type="hidden" value="0" id="noofmaltz'+num+'" name="noofmaltz[]" /><p><a href="javascript:removeMoreElement('+num+');" title="REMOVE MALT" class="remove">REMOVE MALT</a></p><div class="clear"></div>';
  if(num==1)
  {
	document.getElementById("myDummy").innerHTML='<p><a href="javascript:removeMoreElement('+num+');" title="REMOVE MALT" class="remove">REMOVE MALT</a></p>';
  }
}
function editMore(vals,valuel) {
  value=valuel;
  //alert(value);
  var ni = document.getElementById('slider').innerHTML;
  var numi = document.getElementById('theValue');
  num++;
  divIdName = "my"+num+"Div";
  var newdiv = document.createElement('div');
  newdiv.setAttribute("id",divIdName);
  document.getElementById('myDiv').appendChild(newdiv);
  document.getElementById(divIdName).innerHTML+='<label for="maltName">Malt Name</label><input type="text" id="maltName'+num+'" name="maltName[]" value="'+vals+'" onkeyup="chk(\'maltName'+num+'\')" class="inputBox3" />';
  AC_FL_RunContent4('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width', '430','height', '101','src', 'flash/externalSlider','quality', 'high','pluginspage', 'http://www.macromedia.com/go/getflashplayer','align', 'center','play', 'true','loop', 'true','scale', 'scale',
  'wmode', 'transparent','devicefont', 'false','id', 'externalSlider','name', 'externalSlider','menu', 'false','allowScriptAccess','sameDomain','movie', 'flash/externalSlider','salign', 'lt');
  document.getElementById(divIdName).innerHTML+='<input type="hidden" value="'+num+'" id="theValue'+num+'" name="4[]" /><input type="hidden" value="0" id="noofmaltz'+num+'" name="noofmaltz[]" /><p><a href="javascript:removeMoreElement('+num+');" title="REMOVE MALT" class="remove">REMOVE MALT</a></p><div class="clear"></div>';

 if(num==1)
  {
	document.getElementById("myDummy").innerHTML='<p><a href="javascript:removeMoreElement('+num+');" title="REMOVE MALT" class="remove">REMOVE MALT</a></p>';	
  }
}
function setSliderValue(sliderValue, compId) {
	
	var vals1="theValue"+compId;
	var vals2="noofmaltz"+compId;
	document.getElementById(vals1).value=sliderValue;
	document.getElementById(vals2).value=compId;
}

function removeMoreElement(divNum) {
	var rmvDivIdName = "my"+divNum+"Div";
	var vals21="noofmaltz"+divNum;
	document.getElementById(vals21).value="no";
	document.getElementById(rmvDivIdName).style.display = "none";
	var theValue="theValue"+divNum;
	var maltName = "maltName"+divNum;
	document.getElementById(theValue).value="";
	document.getElementById(maltName).value="";
}
*/

/* W24 sets The Balvenie as default value */
function setMaltTheBalvenie(maltNameID) {
	var maltName = maltNameID;
	//alert(maltNameID);
	//alert(document.getElementById("theBalvenie1").checked);
	if(document.getElementById("theBalvenie1").checked==true) 
	{
		document.getElementById(maltName).value="The Balvenie";
	}
	else
	{
		for(var j=0; j<totalno; j++)
		{
			var maltnamechk="maltName"+j;
			var maltvaluechk="theValue"+j;
			var namechk=$(maltnamechk).value.toLowerCase()
			if (namechk.indexOf("balvenie") != -1)
			{
				$(maltnamechk).value="";
				$(maltvaluechk).value=1;
			}
		}
	}
	store_val('0');
}

/* W24 welcome page downloads based on pc or mac */
function downloads() {
	var OpSys = checkOS();
	var downMac = "Install_The_Balvenie.bin";
	var downPc = "Install_The_Balvenie.exe";
	if (OpSys == "Macintosh") {
		window.open("downloads/"+downMac);
	}
	else {
		window.open("downloads/"+downPc);
	}
}

/* LDA page text size for mac */
function ldaBaseBig() {
	var OpSys = checkOS();
	if (OpSys == "Macintosh") {
		document.getElementById('ldaBase').style.fontSize= "13px";
		var agt=navigator.userAgent.toLowerCase();
		if (agt.indexOf("firefox") != -1)
		{
		document.getElementById('ldaBase').style.paddingTop= "22px";
		}
	}
}

/* Submit button hover background */
function hoverIn() {
	document.getElementById('submit').style.background = "url(../images/int_btnSubmitComOn.gif) repeat-x top";
	document.getElementById('submit').style.cursor = "pointer";
}
function hoverOut() {
	document.getElementById('submit').style.background = "url(../images/int_btnSubmitCom.gif) repeat-x top";
}


/* W24 malt slider functionality */
var agt=navigator.userAgent.toLowerCase();
var x;
var obj="";
var slidvale=0;
var poxmov=0;
function Browser()
{

  var ua, s, i;
  this.isIE    = false;
  this.isNS    = false;
  this.version = null;
  ua = navigator.userAgent;
  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0)
  {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) 
  {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) 
  {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}
var browser = new Browser();
// Global object to hold drag information.
var dragObj = new Object();
dragObj.zIndex = 0;
function dragStart(event, id) 
{
	obj=id;
	var el;
	var x, y;
	
	if (id)
    dragObj.elNode = document.getElementById(id);
	else
	{
		if (browser.isIE)
        dragObj.elNode = window.event.srcElement;
	    if (browser.isNS)
    	dragObj.elNode = event.target;
		// If this is a text node, use its parent element.
	    if (dragObj.elNode.nodeType == 3)
    	dragObj.elNode = dragObj.elNode.parentNode;
  	}

	if (browser.isIE)
	{
    	x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
	}
	if (browser.isNS) 
	{
    	x = event.clientX + window.scrollX;
  	}
	dragObj.cursorStartX = x;
	dragObj.cursorStartY = y;
	dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
	dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);
	if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
	if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;
	dragObj.elNode.style.zIndex = ++dragObj.zIndex;
	if (browser.isIE) 
	{
    	document.attachEvent("onmousemove", dragGo);
	    document.attachEvent("onmouseup",   dragStop);
	    window.event.cancelBubble = true;
    	window.event.returnValue = false;
	}
	if (browser.isNS) 
	{
    	document.addEventListener("mousemove", dragGo,   true);
	    document.addEventListener("mouseup",   dragStop, true);
		event.preventDefault();
	}
}
function dragGo(event) 
{
	if (browser.isIE) 
	{
    	x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
	}
	if (browser.isNS) 
	{
    	x = event.clientX + window.scrollX;
  	}
	poxmov=dragObj.elStartLeft + x - dragObj.cursorStartX
	if(poxmov <=0)
	{
		document.getElementById(obj).style.left = "0px";
	}
	else if(poxmov >=400)
	{
		document.getElementById(obj).style.left = "383px";
	}
	else
	{	
		dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
	}
	if (browser.isIE) 
	{
    	window.event.cancelBubble = true;
	    window.event.returnValue = false;
  	}
	if (browser.isNS)
	event.preventDefault();
}
function dragStop(event) 
{
	

	// Stop capturing mousemove and mouseup events.
	if (browser.isIE) 
	{
    	document.detachEvent("onmousemove", dragGo);
	    document.detachEvent("onmouseup",   dragStop);
	}
	if (browser.isNS) 
	{
	    document.removeEventListener("mousemove", dragGo,   true);
    	document.removeEventListener("mouseup",   dragStop, true);	
	}
	objsp=obj.replace("glass","");
	var setval="theValue"+objsp;
	
	if(poxmov<=20 && poxmov!=0)
	{
		$(setval).value='0';
		document.getElementById(obj).style.left="0px";	
	}
	if(poxmov<=90 && poxmov>=20)
	{
		$(setval).value='1';
		document.getElementById(obj).style.left="30px";	
	}
	else if(poxmov>=90 && poxmov<=180)
	{
		$(setval).value='2';
		document.getElementById(obj).style.left="119px";	
	}
	else if(poxmov>=180 && poxmov<=270)
	{
		$(setval).value='3';
		document.getElementById(obj).style.left="208px";	
	}
	else if(poxmov>=270 && poxmov<=360)
	{
		$(setval).value='4';
		document.getElementById(obj).style.left="295px";	
	}
	else if(poxmov>=360 && poxmov<=450)
	{
		$(setval).value='5';
		document.getElementById(obj).style.left="383px";	
	}
}
function moves(seq,no)
{
	slidvale=no;
	obj="glass"+seq;
	var setval="theValue"+seq;
	if(no==0)
	{
		$(setval).value=no;
		$(obj).style.left="0px";	
	}
	if(no==1)
	{
		$(setval).value=no;
		$(obj).style.left="30px";	
	}
	else if(no==2)
	{
		$(setval).value=no;
		$(obj).style.left="119px";	
	}
	else if(no==3)
	{
		$(setval).value=no;
		$(obj).style.left="208px";	
	}
	else if(no==4)
	{
		$(setval).value=no;
		$(obj).style.left="295px";	
	}
	else if(no==5)
	{
		$(setval).value=no;
		$(obj).style.left="383px";	
	}
}
function moves_load(pos,no)
{
	slidvale=no;
	obj="glass"+pos;
	var setval="theValue"+pos;
	if(no==0)
	{
		$(setval).value=no;
		$(obj).style.left="0px";
	}
	if(no==1)
	{
		$(setval).value=no;
		$(obj).style.left="30px";
	}
	else if(no==2)
	{
		$(setval).value=no;
		$(obj).style.left="119px";	
	}
	else if(no==3)
	{
		$(setval).value=no;
		$(obj).style.left="208px";	
	}
	else if(no==4)
	{
		$(setval).value=no;
		$(obj).style.left="295px";	
	}
	else if(no==5)
	{
		$(setval).value=no;
		$(obj).style.left="383px";	
	}
}
var posno=0;
var slival=0;
var malt='';
var totalno;
var totalchk;
var glno=0;
var textval=new Array();
var ttnum=0;
function show_slider()
{
	totalchk=totalno;
	if(totalno == 1)
	{
	var moveids="glass"+posno;
	$("myDummy").innerHTML+='<div id="slid'+posno+'" class="slids"><label for="maltName0">Malt Name</label><input type="text" id="maltName'+posno+'" name="maltName[]" class="inputBox3'+error+'" value="'+malt+'" onchange="store_val('+posno+')" onclick="chkno('+posno+')" onfocus="chkno('+posno+')" autocomplete="off" /><input type="hidden" value="'+slival+'" id="theValue'+posno+'" name="4[]"/><div class="slider_holder"><img src="images/move_bg.gif" usemap="#boxAMap'+posno+'" style="float:left; border:0px;" /><map name="boxAMap'+posno+'" id="boxAMap'+posno+'"><area shape="rect" coords="364,35,409,73" href="javascript:moves(\''+posno+'\',5);" alt="" /><area shape="rect" coords="277,35,322,73" href="javascript:moves(\''+posno+'\',4);" alt="" /><area shape="rect" coords="188,35,233,73" href="javascript:moves(\''+posno+'\',3);" alt="" /><area shape="rect" coords="100,35,145,73" href="javascript:moves(\''+posno+'\',2);" alt="" /><area shape="rect" coords="12,35,57,73" href="javascript:moves(\''+posno+'\',1);" alt="" /><area shape="rect" coords="3,62,69,89" href="javascript:moves(\''+posno+'\',1);" alt="" /><area shape="rect" coords="80,61,162,91" href="javascript:moves(\''+posno+'\',2);" alt="" /><area shape="rect" coords="176,62,253,90" href="javascript:moves(\''+posno+'\',3);" alt="" /><area shape="rect" coords="263,59,333,91" href="javascript:moves(\''+posno+'\',4);" alt="" /><area shape="rect" coords="350,60,422,96" href="javascript:moves(\''+posno+'\',5);" alt="" /></map><img id="'+moveids+'" class="slider_glass" src="images/galss.gif" onmousedown="dragStart(event,\''+moveids+'\')" /></div><br /></div>'
	moves_load(posno,slival);
	posno++;
	}
	else
	{
		var moveids="glass"+posno;
		$("myDummy").innerHTML+='<div id="slid'+posno+'" class="slids"><label for="maltName0">Malt Name</label><input type="text" id="maltName'+posno+'" name="maltName[]" class="inputBox3'+error+'" value="'+malt+'" onchange="store_val('+posno+')" onclick="chkno('+posno+')" onfocus="chkno('+posno+')" autocomplete="off" /><input type="hidden" value="'+slival+'" id="theValue'+posno+'" name="4[]"/><div class="slider_holder"><img src="images/move_bg.gif" usemap="#boxAMap'+posno+'" style="float:left; border:0px;" /><map name="boxAMap'+posno+'" id="boxAMap'+posno+'"><area shape="rect" coords="364,35,409,73" href="javascript:moves(\''+posno+'\',5);" alt="" /><area shape="rect" coords="277,35,322,73" href="javascript:moves(\''+posno+'\',4);" alt="" /><area shape="rect" coords="188,35,233,73" href="javascript:moves(\''+posno+'\',3);" alt="" /><area shape="rect" coords="100,35,145,73" href="javascript:moves(\''+posno+'\',2);" alt="" /><area shape="rect" coords="12,35,57,73" href="javascript:moves(\''+posno+'\',1);" alt="" /><area shape="rect" coords="3,62,69,89" href="javascript:moves(\''+posno+'\',1);" alt="" /><area shape="rect" coords="80,61,162,91" href="javascript:moves(\''+posno+'\',2);" alt="" /><area shape="rect" coords="176,62,253,90" href="javascript:moves(\''+posno+'\',3);" alt="" /><area shape="rect" coords="263,59,333,91" href="javascript:moves(\''+posno+'\',4);" alt="" /><area shape="rect" coords="350,60,422,96" href="javascript:moves(\''+posno+'\',5);" alt="" /></map><img id="'+moveids+'" class="slider_glass" src="images/galss.gif" onmousedown="dragStart(event,\''+moveids+'\')" /></div><p id="removediv"><a href="javascript:remove_slider('+posno+');" title="REMOVE MALT" class="remove">REMOVE MALT</a></p><br /></div>'
		moves_load(posno,slival);
		posno++;	
	}
}
function add_slider()
{
	for(var j=0;j<=ttnum;j++)
	{
		var str="maltName"+j;
		if($(str))
		{
			textval[j]=$(str).value;
		}
	}
	totalchk++;
	if(totalchk > 1)
	{
		if($("removediv"))
		{
			$("removediv").style.display="block";
		}
	}
	if(posno==1)
	{
		var firval=$("maltName0").value;
		var moveids="glass"+posno;
		$("slid0").innerHTML+='<p><a href="javascript:remove_slider(0);" title="REMOVE MALT" class="remove">REMOVE MALT</a></p>';
		$("myDummy").innerHTML+='<div id="slid'+posno+'" class="slids"><label for="maltName0">Malt Name</label><input type="text" id="maltName'+posno+'" name="maltName[]" class="inputBox3'+error+'" onchange="store_val('+posno+')" onclick="chkno('+posno+')" onfocus="chkno('+posno+')" autocomplete="off" /><input type="hidden" id="theValue'+posno+'" name="4[]"/><div class="slider_holder"><img src="images/move_bg.gif" usemap="#boxAMap'+posno+'" style="float:left; border:0px;" /><map name="boxAMap'+posno+'" id="boxAMap'+posno+'"><area shape="rect" coords="364,35,409,73" href="javascript:moves(\''+posno+'\',5);" alt="" /><area shape="rect" coords="277,35,322,73" href="javascript:moves(\''+posno+'\',4);" alt="" /><area shape="rect" coords="188,35,233,73" href="javascript:moves(\''+posno+'\',3);" alt="" /><area shape="rect" coords="100,35,145,73" href="javascript:moves(\''+posno+'\',2);" alt="" /><area shape="rect" coords="12,35,57,73" href="javascript:moves(\''+posno+'\',1);" alt="" /><area shape="rect" coords="3,62,69,89" href="javascript:moves(\''+posno+'\',1);" alt="" /><area shape="rect" coords="80,61,162,91" href="javascript:moves(\''+posno+'\',2);" alt="" /><area shape="rect" coords="176,62,253,90" href="javascript:moves(\''+posno+'\',3);" alt="" /><area shape="rect" coords="263,59,333,91" href="javascript:moves(\''+posno+'\',4);" alt="" /><area shape="rect" coords="350,60,422,96" href="javascript:moves(\''+posno+'\',5);" alt="" /></map><img id="'+moveids+'" class="slider_glass" src="images/galss.gif" onmousedown="dragStart(event,\''+moveids+'\')" /></div><p id="removediv"><a href="javascript:remove_slider('+posno+');" title="REMOVE MALT" class="remove">REMOVE MALT</a></p><br /></div>'
		slival=0;
		$("maltName0").value=firval;
		moves_load(posno,slival);
		posno++;
		
	}
	else
	{
		var tcval="maltName"+(posno-1);
		if($(tcval))
		{
			var firval=$(tcval).value;
		}
		var moveids="glass"+posno;
		$("myDummy").innerHTML+='<div id="slid'+posno+'" class="slids"><label for="maltName0">Malt Name</label><input type="text" id="maltName'+posno+'" name="maltName[]" class="inputBox3'+error+'" onchange="store_val('+posno+')" onclick="chkno('+posno+')" onfocus="chkno('+posno+')" autocomplete="off" /><input type="hidden" id="theValue'+posno+'" name="4[]"/><div class="slider_holder"><img src="images/move_bg.gif" usemap="#boxAMap'+posno+'" style="float:left; border:0px;" /><map name="boxAMap'+posno+'" id="boxAMap'+posno+'"><area shape="rect" coords="364,35,409,73" href="javascript:moves(\''+posno+'\',5);" alt="" /><area shape="rect" coords="277,35,322,73" href="javascript:moves(\''+posno+'\',4);" alt="" /><area shape="rect" coords="188,35,233,73" href="javascript:moves(\''+posno+'\',3);" alt="" /><area shape="rect" coords="100,35,145,73" href="javascript:moves(\''+posno+'\',2);" alt="" /><area shape="rect" coords="12,35,57,73" href="javascript:moves(\''+posno+'\',1);" alt="" /><area shape="rect" coords="3,62,69,89" href="javascript:moves(\''+posno+'\',1);" alt="" /><area shape="rect" coords="80,61,162,91" href="javascript:moves(\''+posno+'\',2);" alt="" /><area shape="rect" coords="176,62,253,90" href="javascript:moves(\''+posno+'\',3);" alt="" /><area shape="rect" coords="263,59,333,91" href="javascript:moves(\''+posno+'\',4);" alt="" /><area shape="rect" coords="350,60,422,96" href="javascript:moves(\''+posno+'\',5);" alt="" /></map><img id="'+moveids+'" class="slider_glass" src="images/galss.gif" onmousedown="dragStart(event,\''+moveids+'\')" /></div><p id="removediv"><a href="javascript:remove_slider('+posno+');" title="REMOVE MALT" class="remove">REMOVE MALT</a></p><br /></div>'
		slival=0;
		for(var j=0;j<textval.length;j++)
		{
			var pretext="maltName"+j;
			if($(pretext))
			{
				$(pretext).value=textval[j];
			}
		}
		if($(tcval))
		{
			$(tcval).value=firval;
		}
		moves_load(posno,slival);
		posno++;	
	}
	totalno++;
}
function chkno(nos)
{
	glno=nos;
	var strs="maltName"+nos;
	AutoSuggest(strs,whiskyName);
}
function remove_slider(no)
{
	totalchk--;
	var rediv="slid"+no;
	$(rediv).innerHTML='';
	if(totalchk == 1)
	{
		if($("removediv"))
		{
			$("removediv").style.display="none";
		}
	}
	$(rediv).style.display="none";
	totalno--;
}
function store_val(no)
{
	ttnum=no;
	for(var j=0;j<=no;j++)
	{
		var str="maltName"+j;
		if($(str))
		{
			textval[j]=$(str).value;
		}
	}
}
/*		Video player for w24		*/
function ChangeVideoClip(media,video_duration)
{
	var video_player = document.getElementById("video_player");
	video_player.innerHTML = "<embed src='flash/balveniePlayer.swf' width='511' height='316' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' flashvars='video_size=169&VideoDuration=" + video_duration + "&media=" + media + "&BufferSecs=12' allowfullscreen='true'>";
}
/*		w24	landing poll radio buttons	*/
var elem;
var strd='';
function radioBtn(){
	elem=document.getElementById('radioBtn');
	if(elem!=null){
		radioLength=elem.getElementsByTagName('li').length
		for(i=0;i<radioLength;i++){
			elem.getElementsByTagName('img')[i].onclick=new Function('selected('+i+')');
		}
	}
}
function selected(iPass){
	if(strd!=''){
		elem.getElementsByTagName('img')[strd].src="images/btn_radio.gif";
		elem.getElementsByTagName('input')[strd].checked =false;
	}else{
		elem.getElementsByTagName('img')[0].src="images/btn_radio.gif";
		elem.getElementsByTagName('input')[0].checked =false;
	}
	elem.getElementsByTagName('img')[iPass].src="images/btn_radio_sld.gif";
	elem.getElementsByTagName('input')[iPass].checked =true;
	strd=iPass;
}

/*		Lightbox 	*/
var nml = 0;
var nmdl = 0;
function lightBoxMap() {
    mlinks = document.getElementsByTagName('a');
    mdivs = document.getElementsByTagName('div');

    for (ml = 0; ml < mlinks.length; ml++) {
        if (mlinks[ml].rel == 'lighboxMap') {
            nml++
            mlinks[ml].id = 'mapLink' + nml;
            roundedNml = Math.round(nml / 2)
            mlinks[ml].setAttribute('href', 'javascript:showLighboxMap(' + roundedNml + ')')
        }
    }
    for (md = 0; md < mdivs.length; md++) {
        if (mdivs[md].className == 'LightBoxOuterContainer') {
            nmdl++
            mdivs[md].id = 'mapDiv' + nmdl;
            mdivs[md].style.display = 'none';
        }
    }
}
function showLighboxMap(nmlId) {
    getid('lightboxMap').style.display = 'block';
    mapCnt = '<div class="LightBoxOuterContainer"><a href="javascript:closepopup()" class="imgClose"><img src="../images/img-close-lb.jpg" /></a>' + getid('mapDiv' + nmlId).innerHTML + '</div>';
    getid('lightboxMap').innerHTML = mapCnt;
    pagecenter();
    popupLeft = (viewportWidth - getid('lightboxMap').offsetWidth) / 2;
    popupTop = (viewportHeight - getid('lightboxMap').offsetHeight) / 2;
    getid('lightboxMap').style.left = popupLeft + 'px';
    getid('lightboxMap').style.top = (popupTop + scrollTop) + 'px';
    getid('cover').onclick = closepopup;
    document.documentElement.onkeyup = checkKeycode;
}
function closepopup() {
    if (getid('lighboxCnt')) {
        getid('lighboxCnt').removeChild(getid('lighboxCnt').firstChild)
        getid('lighboxCnt').removeChild(getid('lighboxCnt').firstChild)
        getid('lighboxCnt').removeChild(getid('lighboxCnt').firstChild)
        getid('lighboxCnt').removeChild(getid('lighboxCnt').firstChild)
        getid('lighboxCnt').removeChild(getid('lighboxCnt').firstChild)
        getid('lighboxCnt').style.display = 'none';
        getid('cover').style.display = 'none';
    }
    if (getid('lightboxMap')) {
        getid('lightboxMap').style.display = 'none';
        getid('cover').style.display = 'none';
    }
}
function checkKeycode(e) {
    var keycode;
    if (window.event) {
        keycode = window.event.keyCode
    } else if (e) {
        keycode = e.which;
    }
    if (keycode == 27) {
        closepopup();
    }
}

function pagecenter() {
    if (typeof window.innerWidth != 'undefined') {
        viewportWidth = window.innerWidth;
        viewportHeight = window.innerHeight;
    } else if (document.documentElement != 'undefined') {
        viewportWidth = document.documentElement.clientWidth;
        viewportHeight = document.documentElement.clientHeight;
    } else {
        viewportWidth = document.body.clientWidth;
        viewportHeight = document.body.clientHeight;
    }
    bodyHeight = document.documentElement.scrollHeight;
    if (bodyHeight > viewportHeight) {
        bodyHeightN = bodyHeight;
        if (typeof window.innerWidth != 'undefined') {
            viewportWidth = viewportWidth - 17;
            scrollTop = document.documentElement.scrollTop;

            if (navigator.userAgent.indexOf('Safari') != -1) {
                scrollTop = document.body.scrollTop;
            }
        } else if ((document.documentElement != 'undefined')) {
            viewportWidth = viewportWidth;
            scrollTop = document.documentElement.scrollTop;
        } else {
            viewportWidth = viewportWidth;
            scrollTop = document.body.scrollTop;
        }
    } else {
        bodyHeightN = viewportHeight;
        scrollTop = 0;
    }
    getid('cover').style.display = 'block';
    getid('cover').style.width = viewportWidth + 'px';
    getid('cover').style.height = bodyHeight + 'px';
}

/*	lightbox flash resize according to flv size	*/
function setFlvPlayerWH(width,height)
{
if(document.getElementById('lightboxMap'))
{
	document.getElementById('lightboxMap').style.width = width+'px';
	document.getElementById('lightboxMap').style.height = height+'px';
}
if(document.getElementById('video'))
{
	document.getElementById('video').style.width = width+'px';
	document.getElementById('video').style.height = height+'px';
}
if (window.document['player2']) {
	window.document['player2'].width=width;
	window.document['player2'].height=height;
   }
   if (navigator.appName.indexOf("Microsoft Internet")==-1) {
      if (document.embeds && document.embeds['player2']) {
		document.embeds['player2'].width=width;
		document.embeds['player2'].height=height;
      }
   } else {
	document.getElementById('player2').width=width;
	document.getElementById('player2').height=height;
   }
}