 	var currentList;
	var currentListR;
	var skcurrentList;
	var pre_img_obj=new Array();
	 
	var intID=setInterval('checkLoad()',500);
	var intID2;
	var skMain;
	
	
	pre_img_obj[0] = document.createElement('img');
	pre_img_obj[0].src = 'images/bodyB2B.jpg';
	
	pre_img_obj[1]= document.createElement('img');
	pre_img_obj[1].src = 'images/bodyEatRight.jpg';
	
	pre_img_obj[2] = document.createElement('img');
	pre_img_obj[2].src = 'images/bodyLiveRight.jpg';
	
	pre_img_obj[3] = document.createElement('img');
	pre_img_obj[3].src = 'images/bodyNutInst.jpg';
	
	pre_img_obj[4] = document.createElement('img');
	pre_img_obj[4].src = 'images/bodySK.jpg';
	
	pre_img_obj[5] = document.createElement('img');
	pre_img_obj[5].src = 'images/popUpEatRight.png';
	
	pre_img_obj[6] = document.createElement('img');
	pre_img_obj[6].src = 'images/SearchResultsbg.jpg';
	
	function checkLoad(){
		
		id=document.body.id;
		
		if(id == 'b2b')
			var i=0;
		else if(id == 'nutIns')
			var i=3;
		else if(id == 'sk')
			var i=4;
		else if(id == 'liveRight')
			var i=2;
		else if(id == 'srchRslt')
			var i=6;	
		else
			var i=1;
		
		var chk= false;
	
		if($(pre_img_obj[i].complete)){
			chk=true;
		}
		else
			chk=false;
			
		if(chk){
			$('topdiv').style.display='block';
			if(id == 'sk'){
				$('wrap').style.paddingTop='1px';
				$('skleftMenu').style.paddingTop='26px';
				var t=$A($$('.menuSKBtm'));
				t[0].style.paddingTop='23px';
				
				var t1=$A($$('.menuSKBtmBdy'));
				t1[0].style.marginTop='1px';
			}
			clearInterval(intID);
		}
		
   }
	
	

	function showPop(id,left,top){
		document.getElementById(id).style.left = left+'px';
		document.getElementById(id).style.top = top+'px';
		document.getElementById(id).style.display = 'block';
	}
	function hidePop(id){
		document.getElementById(id).style.display = 'none';
	}
	
	
	function showPopMid(id,left,top){
		showPop(id,left,top);
		var bTag=$A($$('.description .wholeBlue b'));
		
		bTag[0].addClassName('open');
	}
	
	function hidePopMid(id){
		hidePop(id);
		
		var bTag=$A($$('.description .wholeBlue b'));
		if(bTag[0].hasClassName('open'))
			bTag[0].removeClassName('open');
	}
	
	

	
	function leftNav(){
		Nav('left');	
	}
	
	function rightNav(){
		Nav('right');
	}
	
	function skleftNav(){
		Nav('skleft');	
	}
	
	function Nav(menu){
		
		if(menu=='left'){
			var ultags =  $A($$('#leftMenu li.parent'));
			var cls1 = 'subListON';
			var cls2 = 'selectedList';
			var cur = currentList;
		}
		else if(menu=='right'){
			var ultags =  $A($$('#rightMenu li.parent'));
			var cls1 = 'subListON';
			var cls2 = 'selectedListR';
			var cur = currentListR;
		}
		else if(menu=='skleft'){
			var ultags =  $A($$('#skleftMenu li.parent'));
			var cls1 = 'selected';
			var cls2 = 'selected';
			var cur = skcurrentList;
			
		}
		

		ultags.each(function(child,i){		
			
			var obj = child.down('ul li');
			
			
			if(!obj.empty())
				var curClass=cls1;
			else
				var curClass=cls2;
			
			
			if( i==cur ){
				if(!child.hasClassName(curClass)){
					child.addClassName(curClass);
				}
			}
			else {
				if(child.hasClassName(curClass))
					child.removeClassName(curClass);
			}	
			

			child.down('a').onclick=function(){

				var parent=this.parentNode;
				var inner = parent.down('ul li');

				var on=0;
				
				if(parent.hasClassName(cls1))
					on=1;
					
				
				if(!inner.empty())
					var curClass=cls1;
				else
					var curClass=cls2;


				ultags.each(function(innerChild){
					if(innerChild.hasClassName(cls1)){
						innerChild.removeClassName(cls1);	

						//for ie background problem
						var h=innerChild.down('a').offsetHeight;
						innerChild.down('a').style.height=(h+1)+'px';
						innerChild.down('a').style.height=h+'px';
						
						/*if(menu!='skleft')
							innerChild.down('a').style.backgroundPosition='-100px 0px';*/
					}
					
					if(innerChild.hasClassName(cls2)){
						innerChild.removeClassName(cls2);

						//for ie background problem
						var h=innerChild.down('a').offsetHeight;
						innerChild.down('a').style.height=(h+1)+'px';
						innerChild.down('a').style.height=h+'px';

						/*if(menu!='skleft')
							innerChild.down('a').style.backgroundPosition='-100px 0px';*/
					}
				});
				
				if(on == 0){
					if(!parent.hasClassName(curClass)){
						/*if(menu!='skleft')
							this.style.backgroundPosition=pos;*/
						parent.addClassName(curClass);
					}
				}
				
				if(menu!='skleft'){
					if(on == 1){
						if(!parent.hasClassName(cls2)){	
							parent.addClassName(cls2);
						}
					}
				}
				
				
				if(menu=='skleft'){
					skHeight();
				} 

			}
		});
		if(menu=='skleft'){
			intID2=setInterval('waitMenu()',1000);
			
		}
	}
	
	
	function waitMenu(){
		var arr2=$A($$('.maincontentSK'));
		var banner=$A($$('.bnrSK'));
		skMain= arr2[0].offsetHeight+banner[0].offsetHeight;
		skHeight();
		clearInterval(intID2);
	}
	
	
	function skHeight(){
		var arr1=$A($$('.menuSK'));
		var arr2=$A($$('.maincontentSK'));
		
		var h1= arr1[0].offsetHeight-1800;
		var h2= skMain;
		 
		//alert(h1+'-'+h2);
		if(h1 > h2){
			arr2[0].style.paddingBottom=(h1-h2)+'px'; 
		}
		else
			arr2[0].style.paddingBottom='20px'; 	
		
	}
	
	/*function bottomSelect(){
		 new Autocompleter.SelectBox('options');	
	}*/

	if (window.addEventListener){
		window.addEventListener("load", leftNav, false);	
		window.addEventListener("load", rightNav, false);
		//window.addEventListener("load", bottomSelect, false);
	}
	else if (window.attachEvent){
		window.attachEvent("onload", leftNav);	
		window.attachEvent("onload", rightNav);	
		//window.attachEvent("onload", bottomSelect);	
	}
	
	var superFoodLeft=0;
	var superFoodLandLeft=0;
	var moveDoleLeft=0;
	var moveOn=0;
	
	function moveSuperFood(id,elem){
		if(moveOn==1)
			return;	
		
		var allA=$A($$('#doleSfRgtImgInner object'));
		var width=allA.length*96;

		//var width=$('doleSfRgtImgInner').offsetWidth;
		var gap=width-502;
		
		if(id==1){
			
			
			if(superFoodLeft >= -gap){
				moveOn=1;
				new Effect.Move($('doleSfRgtImgInner'), { x: -96, y: 0 ,mode:'relative', duration: 0.5,afterFinishInternal:function(effect){moveOn=0;}});
				superFoodLeft = superFoodLeft-96;
			}
			
			if(superFoodLeft <= -gap){
					if(!$(elem).hasClassName('btnNextFade'))
						$(elem).addClassName('btnNextFade');

			}
			
			if(superFoodLeft < 0){
				
				if($(elem).previous().hasClassName('btnBackFade')){
					$(elem).previous().removeClassName('btnBackFade');	
					
				}
			}
			
			
		}
		if(id == 2){
			
			if(superFoodLeft < 0){
				moveOn=1;
				new Effect.Move($('doleSfRgtImgInner'), { x: 96, y: 0 ,mode:'relative', duration: 0.5,afterFinishInternal:function(effect){moveOn=0;}});
				superFoodLeft = superFoodLeft+96;
			}
			
			if(superFoodLeft >= 0){
				if(!$(elem).hasClassName('btnBackFade'))
					$(elem).addClassName('btnBackFade');
				
			}
			if(superFoodLeft > -gap){
				if($(elem).next().hasClassName('btnNextFade'))
					$(elem).next().removeClassName('btnNextFade');	
			}
			
		}
			
	}
	
	
	
	
	
	function moveSuperLandFood(id,elem){
		if(moveOn==1)
			return;	
		
		var allA=$A($$('#doleSfRgtImgInner a'));
		var width=allA.length*120;

		var gap=width-502;
		
		if(id==1){
			

			if(superFoodLandLeft >= -gap){
				moveOn=1;
				new Effect.Move($('doleSfRgtImgInner'), { x: -120, y: 0 ,mode:'relative', duration: 0.5,afterFinishInternal:function(effect){moveOn=0;}});
				superFoodLandLeft = superFoodLandLeft-120;
				
				if(superFoodLandLeft <= -gap){
					if(!$(elem).hasClassName('btnNextFade'))
						$(elem).addClassName('btnNextFade');

				}
				
				
				if(superFoodLandLeft < 0){
					if($(elem).previous().hasClassName('btnBackFade')){
						$(elem).previous().removeClassName('btnBackFade');	
						
					}
				}
			}
		}
		if(id == 2){
				
			if(superFoodLandLeft < 0){
				moveOn=1;
				new Effect.Move($('doleSfRgtImgInner'), { x: 120, y: 0 ,mode:'relative', duration: 0.5,afterFinishInternal:function(effect){moveOn=0;}});
				superFoodLandLeft = superFoodLandLeft+120;
				if(superFoodLandLeft >= 0){
					if(!$(elem).hasClassName('btnBackFade'))
						$(elem).addClassName('btnBackFade');
					
				}
				if(superFoodLandLeft > -gap){
					if($(elem).next().hasClassName('btnNextFade'))
						$(elem).next().removeClassName('btnNextFade');	
				}
					
			}
			
		}
			
	}
	
	
	
	function moveDoleTV(id,elem){
		if(moveOn==1)
			return;	
		
		var allA=$A($$('#doleTVScroll a'));
		var width=allA.length*101;

		var gap=width-624;
	
		if(id==1){
			
			if(moveDoleLeft >= -gap){
				moveOn=1;
				new Effect.Move($('doleTVScroll'), { x: -101, y: 0 ,mode:'relative', duration: 0.5,afterFinishInternal:function(effect){moveOn=0;}});
				moveDoleLeft = moveDoleLeft-101;
				
				
				if(moveDoleLeft <= -gap){
					if(!$(elem).hasClassName('imgNextFade')){
						$(elem).removeClassName('imgNext');
						$(elem).addClassName('imgNextFade');		
					}

				}
				
				
				if(moveDoleLeft < 0){
					if($(elem).previous().hasClassName('imgBackFade')){
						$(elem).previous().addClassName('imgBack');
						$(elem).previous().removeClassName('imgBackFade');	
						
					}
				}
			}
			
			
			
		}
		if(id == 2){
			if(moveDoleLeft < 0){
				moveOn=1;
				new Effect.Move($('doleTVScroll'), { x: 101, y: 0 ,mode:'relative', duration: 0.5,afterFinishInternal:function(effect){moveOn=0;}});
				moveDoleLeft = moveDoleLeft+101;
				
				if(moveDoleLeft >= 0){
					if(!$(elem).hasClassName('imgBackFade')){
						$(elem).removeClassName('imgBack');
						$(elem).addClassName('imgBackFade');	
					}
					
				}
				if(moveDoleLeft > -gap){
					if($(elem).next().hasClassName('imgNextFade')){
						$(elem).next().addClassName('imgNext');
						$(elem).next().removeClassName('imgNextFade');
					}
				}
			}
			
		}
			
	}
	
	
	function setScrollerPos(val){

		if(val=='moveDole'){
			perWidth=101;	
			id='doleTVScroll';
			num=6;
		}
		else if(val=='superFood'){
			perWidth=96;	
			id='doleSfRgtImgInner';
			num=5;	
		}
		else if(val=='superFoodLand'){
			perWidth=120;	
			id='doleSfRgtImgInner';
			num=4;	
		}
		
		
		var allA=$A($$('#'+id+' a'));
		var width=allA.length*perWidth;
		var wrapWidth=perWidth*num;
		var gap=width-wrapWidth;

		$(id).style.left=-gap+'px';
		
		if(val=='moveDole')
			moveDoleLeft=-gap;
		else if(val=='superFood')
			superFoodLeft=-gap;		
		else if(val=='superFoodLand')
			superFoodLandLeft=-gap;	
	}
	
	function populatedoletv(id,title,desc,image,video,duration)
	{
		document.getElementById("doletvtitle").innerText=document.getElementById(title).value; //for IE
		document.getElementById("doletvtitle").textContent=document.getElementById(title).value;
		document.getElementById("doletvdesc").innerText=document.getElementById(desc).value; //for IE
		document.getElementById("doletvdesc").textContent=document.getElementById(desc).value;
		
		var flashvars = true;
		var params = {  menu: "false",  flashvars: "type=video&image="+image+"&file="+video+"&duration="+duration+"&autostart=false;",allowfullscreen:"true",allowscriptaccess:"always"};
		var attributes = {  id: id,  name:id};
		swfobject.embedSWF("/player/player.swf", "doletvcontainer", "637", "305", "9.0.0","/player/expressInstall.swf", flashvars, params, attributes);
		return false;
	}
	
	function populatedoletvdetails(id,title,desc)
	{
		document.getElementById("doletvtitle").innerText=title; //for IE
		document.getElementById("doletvtitle").textContent=title;
		document.getElementById("doletvdesc").innerText=desc; //for IE
		document.getElementById("doletvdesc").textContent=desc;	
	}
	
	function populatedoletvonload(id,image,video,duration)
	{
		var flashvars = true;
		var params = {  menu: "false",  flashvars: "type=video&image="+image+"&file="+video+"&duration="+duration+"&autostart=false;",allowfullscreen:"true",allowscriptaccess:"always"};
		var attributes = {  id: id,  name:id};
		swfobject.embedSWF("/player/player.swf", "doletvcontainer", "637", "305", "9.0.0","/player/expressInstall.swf", flashvars, params, attributes);
	
	}
	
	function populatedoletvlists(id)
	{
		var dropdownIndex = document.getElementById(id).selectedIndex;
		var dropdownValue = document.getElementById(id)[dropdownIndex].value;
		
		var arr= dropdownValue.split("_");
		if(arr.length > 0)
		{
			var id=arr[0];
			var count=arr[1];
			for (i=1;i<=count;i++)
			{
				var ctrlid = id + "_" + count + "_" + i;
				var control = document.getElementById(ctrlid);            
				control.style.display = "none";
			}
		}
		var control1 = document.getElementById(dropdownValue);            
		control1.style.display = "block";
	}
	
	function populatearchives(id)
	{
		var dropdownIndex = document.getElementById(id).selectedIndex;
		var dropdownValue = document.getElementById(id)[dropdownIndex].value;
		
		var arr= dropdownValue.split("_");
		if(arr.length > 0)
		{
			var id=arr[0];
			var count=arr[1];
			for (i=1;i<=count;i++)
			{
				var ctrlid = id + "_" + count + "_" + i;
				var control = document.getElementById(ctrlid);            
				control.style.display = "none";
			}
		}
		var control1 = document.getElementById(dropdownValue);            
		control1.style.display = "block";
	}

function RedirectToInvestors() {
    document.location = "http://investors.dole.com";
    //window.open('http://investors.dole.com', 'Dole | Investors'); 
}
