﻿<!--

var parentObj;
var rotatorobjects = 0;
var rotatorObjects = new Array();
var rotatorObjIDS = new Array();

var pos = '';
var inObj = 0;
var outObj = 0;
var cycleTimer = 5000;
var cycleTimeID = null;
var inTimeID = null;
var outTimeID = null;
var selectTimeID = null;
var selectBool = false;
var fadeBool = false;
var choice = 0;
var hoverBool;

var isHeroRotationRequired = true;

function getRotatorObjects(parentObject) {
        if (isHeroRotationRequired == false) return;
		parentObj = document.getElementById(parentObject);

		if (parentObj.hasChildNodes) 
		{	
			for (i=0; i < parentObj.childNodes.length; i++) 
			{
			if (parentObj.childNodes[i].nodeType == 1) 
				{
					rotatorObjects[rotatorobjects] = new Object();
					rotatorObjects[rotatorobjects] = parentObj.childNodes[i];
					rotatorObjIDS[rotatorobjects] = parentObj.childNodes[i].attributes.id.nodeValue;
					rotatorobjects++;
				}
			}
		}	
		 startCycle(0, 1, cycleTimer); 
}

function objectTracker(outRef, inRef)
{
	outObj = outRef;
	inObj = inRef;
	//alert(outObj);
	//alert(inObj);
}


function startCycle(outPos, inPos, time)
{
	pos = 'rotate(' + outPos + ', ' + inPos + ')';	
	cycleTimeID = setTimeout(pos, time);
}

function rotate(outRef, inRef) {
	selectBool = true;
	clearTimeout(cycleTimeID);
	objectTracker(outRef, inRef);
	if (outObj < (rotatorObjects.length - 1))
	{
		fadeOut(outObj,100);
		fadeIn(inObj,0);
		outObj++;
		inObj++;
		if (inObj > rotatorObjects.length - 1)
		{inObj = 0;}
		objectTracker(outObj, inObj)
	}
	else
	{
		fadeOut(outObj,100);
		objectTracker(0,0);
		fadeIn(inObj,0);
		objectTracker(0,1);
	}
	
	cycleTimeID = setTimeout('rotate(outObj, inObj)', cycleTimer);
}


function select(selected)
{
if (fadeBool != true)
	{
        //START: MCK Modification - pause();
	    pause('select');
	    //END: MCK Modification		
		fadeOut(outObj,100);
		fadeIn(selected,0);
		choice = selected;	
		if (selected == (rotatorObjects.length - 1))
		{
			inObj = 0;
			outObj = selected;
			objectTracker(outObj, inObj);
		}
		else
		{
			outObj = selected;
			inObj = selected + 1;
			objectTracker(outObj, inObj);
		}
				
	}
}

function play()
{
	if (fadeBool == true) {return;}
	else
	{
	hide('play');
	show('pause');

			fadeOut(outObj,100);
			fadeIn(inObj,0);
			if (inObj == (rotatorObjects.length - 1))
				{
					startCycle(inObj, 0, cycleTimer);
					objectTracker(inObj, 0);
				}
				else
				{
					startCycle(inObj, inObj + 1, cycleTimer);
					objectTracker(inObj, inObj + 1);
				}
	        //START: MCK Modification
            if (typeof (onPausePlay) == "function") {
                onPausePlay('play');
            }
            //END: MCK Modification	
				
	}

}

function pause(type) // MCK Added type parameter
{
	show('play');
	hide('pause');
	clearTimeout(cycleTimeID);
	//START: MCK Modification
    if ((type != 'select') && typeof (onPausePlay) == "function") {
        onPausePlay('pause');
    }
    //END: MCK Modification
}

function clear()
{
	clearTimeout(cycleTimeID);
	clearTimeout(outTimeID);
	clearTimeout(inTimeID);
}

var opacitystep = 5;

function fadeOut(objOut,opacity) {
	obj = rotatorObjects[objOut];
	if (opacity >= 0) {
		fadeBool = true;
		Opacity(obj, opacity);
		opacity -= opacitystep;
		outTimeID = setTimeout("fadeOut("+objOut+","+opacity+") ", 50);
		}
	else {obj.style.visibility = 'hidden'; clearTimeout(outTimeID);}

}

function fadeIn(objIn,opacity) {
	obj = rotatorObjects[objIn];
	obj.style.visibility = 'visible';
	if (opacity <= 100) {
		Opacity(obj, opacity);
		opacity += opacitystep;
		inTimeID = setTimeout("fadeIn("+objIn+","+opacity+") ", 50);
		
		}
	else {selectBool = false; fadeBool = false; clearTimeout(inTimeID); updateControl(objIn);}
}

function Opacity(obj,opacity) {
 if (opacity>100||opacity<0){ return }
 if (obj.style.MozOpacity!=null){ obj.style.MozOpacity=(opacity/100)-.001; }
 else if (obj.style.opacity!=null){ obj.style.opacity=(opacity/100)-.001; }
 else if (obj.style.filter!=null){ obj.style.filter = 'alpha(opacity='+opacity+')';     }
 else if (obj.style.KHTMLOpacity!=null){ obj.KHTMLOpacity=(opacity/100)-.001; }
}

function updateControl(item)
{
	var heroNum = item;
	var controlString = 'select';
	for (k=0; k < rotatorObjects.length; k++)
	{
		document.getElementById(controlString + k.toString()).className = 'rotatorItemOff left';
	}
	document.getElementById(controlString + heroNum.toString()).className = 'rotatorItemOn left';
	//START: MCK Modification
	if (typeof(onHeroRotate)=="function") {
		onHeroRotate(rotatorObjects[item], "auto");
	}
	//END: MCK Modification
}



/*		Show/Hide 		*/
var learn1 = new Array();
var learn2 = new Array();
var learn3 = new Array();
var learn4 = new Array();
var learnobjects = 0;
function getLearnObjects(parentObject, arr) {
		learnParent = document.getElementById(parentObject);
		learnArray = arr;
		if (learnParent.hasChildNodes) 
		{	
			for (i=0; i < learnParent.childNodes.length; i++) 
			{
			if (learnParent.childNodes[i].nodeType == 1) 
				{
					learnArray[learnobjects] = learnParent.childNodes[i].attributes.id.nodeValue;
					learnobjects++;
				}
			}
		}	
		learnobjects = 0;
}

function showLearnItems(arr, item)
{
	for (i=0; i < arr.length; i++)
	{
		document.getElementById(arr[i]).style.display = 'none';
		show(item);
	}
}

function selectArrow(item)
{
	listParent = item.parentNode;
	if (listParent.hasChildNodes) 
	{	
		for (i=0; i < listParent.childNodes.length; i++) 
		{
		if ((listParent.childNodes[i].className != 'triggerTitle') && (listParent.childNodes[i].className == 'selected')) 
			{
				listParent.childNodes[i].className = 'static';
			}
		}
	}	
	item.className = 'selected';
}

function showPillarPane(item)
{
	for (i=1; i < 5; i++) 
	{
	    //START: MCK Modification
	    var status = document.getElementById('campaignContainer_' + i.toString()).style.display;
		if (status && status != 'none') {
		    hide('campaignContainer_' + i);
		}
		//END: MCK Modification
	}
	show(item);
	//START: MCK Modification
	if (typeof (onShowPillarPane) == "function") {
	    onShowPillarPane(item);
	}
	//END: MCK Modification
}

function show(item) 
{
	document.getElementById(item).style.display='block'
}


function hide(item) 
{
	document.getElementById(item).style.display='none'
	//START: MCK Modification
	if ((item.indexOf('campaignContainer_') != -1) && (typeof (onHidePillarPane) == "function")) {   
	    onHidePillarPane(item);
	}
	//END: MCK Modification
}

function timeHide(item)
{
	window.setTimeout("hide('" + item + "')", 1000);
}

/* latest news item rotation */

var xIncrement=2;
var xFadeSpeed=30;
var xImgDelay=3000;


var xCnt=0;

function xBannerRotateOpacity(xid,xsi,xcy,xinc,xspd,xdly){
 xp=document.getElementById(xid);
 if (!xp){ return; }
 if (xp.obj){ return; }
 xp.obj=new xAddBannerFade();
 xp.obj.imgary=xp.getElementsByTagName('DIV');
 if (!xcy){ xccy=1; }
 xp.obj.cy=xcy*xp.obj.imgary.length-1;
 xp.obj.cnt=0;
 if (!xsi){ xsi=1; }
 if (xsi>=xp.obj.imgary.length||xsi<1){ xsi=1; }
 xp.obj.cntT=xsi-1;
 xp.obj.cntB=xsi;
 if (xp.obj.cntB==xp.obj.imgary.length){ xp.obj.cntB=0; }
 if (!xinc){ xinc=xIncrement; }
 if (xinc<1||xinc>30){ xinc=xIncrement; }
 xp.obj.inc=xinc;
 if (!xspd){ xspd=xFadeSpeed; }
 if (xspd<5||xspd>70){ xspd=xFadeSpeed; }
 xp.obj.spd=xspd;
 if (!xdly){ xdly=xImgDelay; }
 if (xdly<50){ xdly=xImgDelay; }
 xp.obj.dly=xdly;
 for (x0=0;x0<xp.obj.imgary.length;x0++){
  xOpacity(xp.obj.imgary[x0],0)
 }
 xp.obj.IT=xp.obj.imgary[xp.obj.cntT];
 xOpacity(xp.obj.IT.style,100);
 xp.obj.IT.style.zIndex=1;
 xp.obj.IT.style.visibility='visible';
 xp.obj.setTimeOut0();
}

function xAddBannerFade(){
 this.ref0 = 'timeout0'+xCnt;
 window[this.ref0]=this;
 this.ref1 = 'timeout1'+xCnt;
 window[this.ref1]=this;

 this.setTimeOut0= function(xf,xd){
  setTimeout('window.'+this.ref0+'.rotate()',this.dly);
 }

 this.setTimeOut1= function(xf,xd){
  setTimeout('window.'+this.ref1+'.'+xf,xd);
 }

 this.rotate=function(){
 if (this.cnt>=this.cy){ return; }
  this.fcnt=0;
  this.cnt++;
  this.IT=this.imgary[this.cntT]
  this.IB=this.imgary[this.cntB]
  //MCK: RLR Modification
  if (typeof(onBannerRotate)=="function") {
	    onBannerRotate(this.IB);
  }
  //MCK: RLR Modification
  this.IT.style.zIndex=0;
  this.IB.style.zIndex=1;
  this.IB.style.visibility='visible';
  this.fadebanner();
 }

 this.fadebanner=function(){
  this.fcnt+=this.inc;
  xOpacity(this.IT.style,100-this.fcnt);
  xOpacity(this.IB.style,this.fcnt);
  if (this.fcnt<100){ this.setTimeOut1('fadebanner()',this.spd); }
  else {
   xOpacity(this.IB.style,100);
   xOpacity(this.IT.style,0);
   this.cntT=(this.cntT+1)%this.imgary.length;
   this.cntB=(this.cntB+1)%this.imgary.length;
   this.setTimeOut1('rotate()',this.dly);
  }
 }
 xCnt++;
}

function xOpacity(xobj,xop) {
 if (xop>100||xop<0){ return }
 if (xobj.MozOpacity!=null){ xobj.MozOpacity=(xop/100)-.001; }
 else if (xobj.opacity!=null){ xobj.opacity=(xop/100)-.001; }
 else if (xobj.filter!=null){ xobj.filter = 'alpha(opacity='+xop+')';     }
 else if (xobj.KHTMLOpacity!=null){ xobj.KHTMLOpacity=(xop/100)-.001; }
}

//Added - JJ

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

function onSearchClick(){
	if (!validateSearch()){
	}
	else{
		searchTrack();
		document.bannerSearchForm.submit();
	}
}

function createInputParam(name, value) {
                var el = document.createElement('input');
                el.type = 'hidden';
                el.name = name;
                el.value = value;
                return el;
}

function validateSearch(){
	if (document.bannerSearchForm.q.value==null || document.bannerSearchForm.q.value.length<1 || trim(document.bannerSearchForm.q.value)==''){
		return false;
	}
	else{
		var form = document.forms['bannerSearchForm'];
		form.appendChild(createInputParam('entqr', '3'));
		form.appendChild(createInputParam('client', 'default_frontend'));
		form.appendChild(createInputParam('proxystylesheet', 'default_frontend'));
		form.appendChild(createInputParam('output', 'xml_no_dtd'));
		return true;
	}
}

function submitSearch(){
	if (!validateSearch()){
		return false;
	}
	else{
		searchTrack();
	}
}

function searchTrack(){
	//call rickys method if it exists
	if (typeof (onSearchSubmit) == "function") {
		    onSearchSubmit(document.bannerSearchForm);
	}
}
-->

