/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*^^^^Mapping menu options function ^^^^*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
function getCategory(cat,fcat){
	var objCategory = {
		sitebuilder : {last: 'buildawebsite', first:'communicate'}
		,safety : {last: 'buildawebsite', first:'communicate'}
		,security : {last: 'securitysoftware', first:'communicate'}
		,bankandsave : {last: 'bankingandsaving', first:'money'}
		,creditreports : {last: 'creditrating', first:'money'}
		,calculatorsandtools : {last: 'calculatorsandtools', first:'money'}
		,mortgage : {last: 'mortgages', first:'money'}
		,grocery : {last: 'foodanddrink', first:'shopping'}
		,health : {last: 'healthandbeauty', first:'shopping'}
		,phonespocketpcs : {last: 'phonesandpdas', first:'shopping'}
		,formulaone : {last: 'formula1home', first:'sport'}
		,late : {last: 'lateavailability', first:'travel'}
		,wintersports : {last: 'skiholidays', first:'travel'}
		,money : {last: 'travelmoney', first:'travel'}
		,products : {last: 'products', first:'mediapack'}
		,research : {last: 'researchcentre', first:'mediapack'}
		,news : {last: 'newsandviews', first:'mediapack'}
		,contact : {last: 'contactus', first:'mediapack'}
	};

	if (cat && fcat){
		if(objCategory[cat] && fcat == objCategory[cat].first)
	 		return objCategory[cat].last;
	}
	 return cat;  

}//Fin FUNCTION getCategory...

function changeMenu(){
	var url = window.location.pathname;
	var lastIndex = url.lastIndexOf("/");
	url = url.substring( 1, lastIndex); 
	var urlArr = url.split("/");
	var currentChannel = getCategory(urlArr[urlArr.length - 1],urlArr[urlArr.length - 2]);
	var lastChannel = urlArr[urlArr.length - 2] || getCategory(urlArr[urlArr.length - 1],urlArr[urlArr.length - 2]);
	var lienv = document.getElementById( currentChannel + "_env" );
	if( lienv ) lienv.style.display =  "block";
	else{
		var lienv = document.getElementById( lastChannel + "_env" );
		if( lienv ) lienv.style.display =  "block";
	}
	var aselected = document.getElementById( currentChannel );
	var alcselected = document.getElementById( lastChannel );
	if( aselected ){
		aselected.style.backgroundColor = "#E9E9E9";
		aselected.style.color="#000";
		aselected.style.fontWeight="bold";
		aselected.style.backgroundImage="url(/img/leftnav_arrow_on.gif)";
		aselected.style.backgroundPosition="5px 7px";
		if( alcselected )aselected.style.backgroundPosition="10px 7px";
	}
	if( alcselected ){
		alcselected.style.backgroundColor = "#E9E9E9";
		alcselected.style.color="#000";
		alcselected.style.fontWeight="bold";
		alcselected.style.backgroundImage="url(/img/leftnav_arrow_on.gif)";
		alcselected.style.backgroundPosition="5px 7px";
	}
	
}


function changeMenuNew(){
	var url = window.location.pathname;
	url = url.replace(/\.htm/i,"");
	url = url.replace(/default/i,"");
	var lastIndex = url.lastIndexOf("/");
	if( (lastIndex + 1) != url.length ){ 
		url = url.substring( 1 , lastIndex) + "." + url.substring( lastIndex + 1 );
	}
	else url = url.substring( 1 , lastIndex);

	
	var urlArr = url.split("/");
	var currentChannel = urlArr.join("_");
	var lastChannel = urlArr.slice(0,urlArr.length-1).join("_");
	if( currentChannel && currentChannel.indexOf("pics") != -1 ){
		var currentChannel = urlArr.slice(0,urlArr.length-1).join("_");
		var lastChannel = urlArr.slice(0,urlArr.length-2).join("_");
	}
	var currentChannelDot = currentChannel.split(".")[0];
	var lienv = document.getElementById( currentChannel + "_env" );
	if( lienv ) lienv.style.display =  "block";
	else{
		var lienv = document.getElementById( lastChannel + "_env" );
		if( lienv ) lienv.style.display =  "block";
		else{
			var lienv = document.getElementById( currentChannelDot + "_env" );
			if( lienv ) lienv.style.display =  "block";
		}
	}
	var aselected = document.getElementById( currentChannel );
	var adotselected = document.getElementById( currentChannelDot );
	var alcselected = document.getElementById( lastChannel );
	if( aselected ){
		aselected.style.backgroundColor = "#E9E9E9";
		aselected.style.color="#000";
		aselected.style.fontWeight="bold";
		aselected.style.backgroundImage="url(/img/leftnav_arrow_on.gif)";
		aselected.style.backgroundPosition="5px 7px";
		if( alcselected && urlArr.length > 2 && lienv)aselected.style.backgroundPosition="10px 7px";
	}
	else if( adotselected ){
		adotselected.style.backgroundColor = "#E9E9E9";
		adotselected.style.color="#000";
		adotselected.style.fontWeight="bold";
		adotselected.style.backgroundImage="url(/img/leftnav_arrow_on.gif)";
		adotselected.style.backgroundPosition="5px 7px";
		if( alcselected && urlArr.length > 2 && lienv)adotselected.style.backgroundPosition="10px 7px";
	}
	if( alcselected && urlArr.length > 2 && lienv){
		alcselected.style.backgroundColor = "#E9E9E9";
		alcselected.style.color="#000";
		alcselected.style.fontWeight="bold";
		alcselected.style.backgroundImage="url(/img/leftnav_arrow_on.gif)";
		alcselected.style.backgroundPosition="5px 7px";
	}
}


/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*^^Array sorting from greater to lower^^*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
function ordenaArray(x,y) {
	return ( x > y ) ? -1 : ( x < y ) ? 1 : 0;
}

/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*^^^^To adjust and level rows height in template 2^^^*/
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
function sedRowHeight(rw){
	if(rw){
		var divRow = document.getElementById(rw);
		var tmpHeight = divRow.clientHeight;
		/*Carga los div dependientes de la capa rw*/
		var arrRow = divRow.getElementsByTagName('div');

		/*Crea un array con las alturas de todas las capas*/
		var arrHeight = new Array();
		for (var n = 0; n < arrRow.length; n++){
			arrHeight.push(arrRow[n].clientHeight);
		}//Fin FOR
	
		/*Ordena el array en orden descendente*/
		var nNewHeight = arrHeight.sort(ordenaArray)[0]; 

		/*Recorre el array de hijos y si el class empieza por w le cambia la altura*/
		for (var i = 0; i < arrRow.length; i++){
			if ( arrRow[i].className.indexOf('w') == 0 ){
				arrRow[i].style.height = nNewHeight + 'px';
			}//Fin IF
		}//Fin FOR	
	}//Fin IF
}//Fin Function


/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
/*^^^^To adjust and level rows height in template 12 or any^^^*/
// rw = column number with row indentifier
// str = string that contains de layer identificator 
// example: sedRowHeight('rw4','ep')
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
function sedRowHeightAdv(rw, str){
	if(rw){
		var divRow = document.getElementById(rw);
		var tmpHeight = divRow.clientHeight;
		var arrRow = divRow.getElementsByTagName('div');

		var arrHeight = new Array();
		for (var n = 0; n < arrRow.length; n++){
			arrHeight.push(arrRow[n].clientHeight);
		}//Fin FOR
		var nNewHeight = arrHeight.sort(ordenaArray)[0]; 
		for (var i = 0; i < arrRow.length; i++){
			if ( arrRow[i].className.indexOf("shadow") != -1 || arrRow[i].className.indexOf("poll") != -1 || arrRow[i].className.indexOf(str) == 0 ){
				arrRow[i].style.height = nNewHeight + 'px';
			}//Fin IF
		}//Fin FOR	
}//Fin IF
}//Fin Function


function sendDropDown(f){
 if( f && document[f] ){
  var s_tracked_link = track_dropdown_links(document[f][0].value);
  window.location.href = s_tracked_link;
 }
}




/*

	Flash Detection

*/

<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// the version of javascript supported
var jsVersion = 1.0;
// -----------------------------------------------------------------------------
// -->

document.write( '<' + 'scr' + 'ipt src="/js/flashvs.js" language="VBScript" type="text/vbscript"><' + '/' + 'scr' + 'ipt>' );

<!-- // Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
{
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
   	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];
			
			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
}
// -->


/*
	
	Flash Detection

*/ 


