function changeContent(content){
	document.getElementById('content').src = content;
	var contentId = content.substring(0,content.indexOf('.'));
	node = document.getElementById('submenu');
	
	if(node!=null){
	for (i = 0; i < node.childNodes.length; i++) {
			ul = node.childNodes[i];
			if (ul.nodeName == "LI") {
				ul.className = 'submenu'
			}
		}
	document.getElementById(contentId).className = 'current';
	}

}
function autoResize(id){ 
    var newheight; 
    var newwidth; 
    if(document.getElementById){ 
        newheight=document.getElementById(id).contentWindow.document .body.scrollHeight; 
        newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth; 
    } 
	var minheight = 500;
	if(newheight<minheight){
		newheight = minheight;
	}
    document.getElementById(id).height= (newheight) + "px"; 
    document.getElementById(id).width= (newwidth) + "px"; 
} 



var cont = 0; 
var arr = [ 
["http://www.globe3.org","img/av.jpg"], 
["http://www.globe3.org","img/av2.jpg"], 
["http:/www.globe3.org","img/av3.jpg"],
["http://glob3.sourceforge.net/mobile.html","img/av4.jpg"] 
] 
function cambia() { 
var d = document.getElementById("imgCabecera"); 
cont = cont % arr.length; 
d.innerHTML = "<img width=650px height=200px src='"+arr[cont][1]+"'/>"; 
cont++; 
} 
function initHeadImg() { 
cambia(); 
setInterval(cambia, 5000); 
} 


// Obtenemos el elemento por su identificador 
var d = document.getElementById("imgCabecera"); 
d.innerHTML = "El contenido ha sido modificado! <img src='img/av.jpg'/>"; 

 

function readUrlParams(){
	
	var url = String(window.location.href);
	var params = String(window.location.search);
	var aux1 = new Array();
	var aux2 = new Array();
	var cont = 0;
	var tot = 0;

	//si hay parametros
	if (params.length > 0){
		//eliminamos el primer caracter '?'
		params = params.substr(1);

		//insertamos en un array las parejas nombre=valor
		aux1 = params.split("&");
		tot = aux1.length;
		for (cont = 0; cont < tot; cont++){
			//separo el nombre del valor
			aux2 = aux1[cont].split("=");

			//trabajo con cada parámetro
			if (aux2[0].toLowerCase() == "page"){
			    changeContent(aux2[1]);
			}
		}

	}
}



