﻿
		function isIE()
		{
			var browserName=navigator.appName; 
			if (browserName=="Microsoft Internet Explorer")
			{ 
				//alert("Hi Explorer User!");
				return true;
			}
			else 
			{ 
				//alert("Hi, Other User!");
				return false;
			}
		}
		function ReChangeSize()
		{
			var pos;
			if (isIE() == true)
			{
				pos = 0;
			}
			else
			{
				pos = 1;
			}
			
			//alert("Entro a ReChangeSize");
			var p = document.getElementById("divCentro");
			if (p != null)
			{
				var maximo = 0;
				for (i=0;i<p.childNodes.length;i++) 
				{			
					if(p.childNodes[i].nodeType == 1) 
					{
						if (p.childNodes[i].attributes["class"].value != "divClear")
						{
							//alert("Id: "+p.childNodes[i].childNodes[pos].attributes["id"].value);
							//alert("Longitud Externo: "+p.childNodes[i].offsetHeight);
							//alert("Longitud Interno: "+p.childNodes[i].childNodes[pos].offsetHeight);
							if (p.childNodes[i].childNodes[pos].offsetHeight > maximo)
					    	{
					    		maximo = p.childNodes[i].childNodes[pos].offsetHeight;
					    	}
				    	}
				    }
				}
				//alert('El maximo es:'+maximo);
				for (i=0;i<p.childNodes.length;i++) 
				{		
					if(p.childNodes[i].nodeType == 1) 
					{
						if (p.childNodes[i].attributes["class"].value != "divClear")
						{
							p.childNodes[i].style.height = maximo + "px";
						}
					}
				}
			}
		}

		function ChangeSize()
		{
			//alert("Entro a ChangeSize");
			var p = document.getElementById("divCentro");
			if (p != null)
			{
				var maximo = 0;
				for (i=0;i<p.childNodes.length;i++) 
				{			
					if(p.childNodes[i].nodeType == 1) 
					{
						if (p.childNodes[i].attributes["class"].value != "divClear")
						{
							//alert("Clase: "+p.childNodes[i].attributes["class"].value);
							//alert("Longitud: "+p.childNodes[i].offsetHeight);
							if (p.childNodes[i].offsetHeight > maximo)
					    	{
					    		maximo = p.childNodes[i].offsetHeight;
					    	}
				    	}
				    }
				}
				//alert('El maximo es:'+maximo);
				for (i=0;i<p.childNodes.length;i++) 
				{		
					if(p.childNodes[i].nodeType == 1) 
					{
						if (p.childNodes[i].attributes["class"].value != "divClear")
						{
							p.childNodes[i].style.height = maximo + "px";
						}
					}
				}
			}
		}
		
		//Temporizador que compruebe cada cierto tiempo el tamaño de fuente
	
		var tid;
		function Inicializar()
		{
			ChangeSize();
			
			//alert('TamBase:');
			setTimeout("comprobarTam()",500);
		}

		
		//setTimeout("clearInterval("+tid+")",20000);		
		function comprobarTam()
		{
			ReChangeSize();
		}
		
		window.onresize = ReChangeSize;
		
		function addLoadEvent(func) {
			var oldonload = window.onload;
		  if (typeof window.onload != 'function') {
		    window.onload = func;
		  } else {
		    window.onload = function() {
		      if (oldonload) {
		        oldonload();
		      }
		      func();
		    }
		  }
		}
		
		
		
		window.location.querystring = (function() {
 		    var collection = {};
		    // Gets the query string, starts with '?'
		    var querystring = window.location.search;
		    // Empty if no query string
		    if (!querystring) {
		        return { toString: function() { return ""; } };
		    }
		    // Decode query string and remove '?'
		    querystring = decodeURI(querystring.substring(1));
		   // Load the key/values of the return collection
		    var pairs = querystring.split("&");
		    for (var i = 0; i < pairs.length; i++) {
		        // Empty pair (e.g. ?key=val&&key2=val2)
		        if (!pairs[i]) {
		            continue;
		        }
		        // Don't use split("=") in case value has "=" in it
		        var seperatorPosition = pairs[i].indexOf("=");
		        if (seperatorPosition == -1) {
		            collection[pairs[i]] = "";
		        }
		        else {
		            collection[pairs[i].substring(0, seperatorPosition)] 
		                = pairs[i].substr(seperatorPosition + 1);
		        }
		    }
		    // toString() returns the key/value pairs concatenated
		    collection.toString = function() {
		        return "?" + querystring;
		    };
		    return collection;
		})();
		
		
//Public Web Area Selector		
function selectCurrentArea()
{
	var indexLow = window.location.href.indexOf('.com/') + 5;
	//alert(indexLow);
	var cadAux = window.location.href.substring(indexLow);
	//alert(cadAux);
	var indexHigh = cadAux.indexOf('/');
	//alert(indexHigh);
	var val = cadAux.substring(0,indexHigh);
	val = '/' + val;
	//alert(val);
	var objParent = document.getElementById('listAreasRegions');
	var obj = objParent.childNodes[1];
	//alert(obj);
	for(i=0;i<obj.length;i++)
	{
		//alert('optionsValue: ' + obj.options[i].value + ', val: ' + val);
		if(obj.options[i].value == val)
		{
			obj.selectedIndex=i;
			break;
		}
	}	
}

		


//Home Public Web
//function to get random number upto m
function randomXToY(minVal,maxVal,floatVal)
{
  var randVal = minVal+(Math.random()*(maxVal-minVal));
  return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
}

function activateDiv(id)
{
	var ob = document.getElementById(id);
	if (ob != null)
	{
		ob.style.display="block";
	}
}
function deactivateDiv(id)
{
	var ob = document.getElementById(id);
	if (ob != null)
	{
		ob.style.display="none";
	}										
}













		
		