// JavaScript Document
var muestra="block";
var oculta="none";
function addOnload(newFunction){
var oldOnload = window.onload;
if (typeof oldOnload == "function"){
window.onload = function(){
if(oldOnload){
oldOnload();
}
newFunction();
}
}else{
	window.onload = newFunction;
	}
}
function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}
addOnload(rolloverInit);
function rolloverInit(){
	var img = document.getElementById("navMenu").getElementsByTagName("img");
	for(var i =0 ; i< img.length; i++){
		if(img[i].parentNode.tagName == "A"){
			setupRollover(img[i]);
		}
	}
}
function setupRollover(thisImage){
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;
	
	thisImage.overImage = new Image();
	thisImage.overImage.src = "/images/menu/" + thisImage.id + "_on.png";
	thisImage.onmouseover = rollOver;

}
function rollOut(){
this.src = this.outImage.src;
this.title = this.id;
this.alt = this.id;
}
function clearAll(){
var ul = document.getElementById("navMenu").getElementsByTagName("ul");
	for(var i =0 ; i< ul.length; i++){
		ul[i].style.display = oculta;
	}
}
function rollOver(){
	clearAll();
	this.src = this.overImage.src;
	this.title = this.id.toUpperCase();
	this.alt = this.id + "_hover";
	var lista = "ul"+this.id;
	var ul = document.getElementById(lista);
	if(ul){
	ul.style.display = muestra;
	}
}
function bandsBlocks(current){
	document.getElementById("bandsIndex").style.display = oculta;
	document.getElementById("bandsMost").style.display = oculta;
	document.getElementById("searchingBand").style.display = oculta;
	document.getElementById(current).style.display = muestra;
	document.getElementById("liIndex").className = "";
	document.getElementById("liMost").className = "";
	document.getElementById("liBus").className = "";
	if(current=="bandsIndex"){
	document.getElementById("liIndex").className = "selected";
	}else if(current=="bandsMost"){
		document.getElementById("liMost").className = "selected";
	}else if(current=="searchingBand"){
		document.getElementById("liBus").className = "selected";
	}
}
function dispBlock(b1,action){
	document.getElementById(b1).style.display=action;
}
function showResult(b1,b2){
document.getElementById(b1).style.display=oculta;
document.getElementById(b2).style.display=muestra;
}
//controladores tamaņo fuente
var maxValue=16;
var minValue=10;
function increaseFontSize(bloque) {
   var p = document.getElementById(bloque).getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
	if(p[i].className == "textBlog"){
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=maxValue) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
  }
}
function decreaseFontSize(bloque) {
   var p = document.getElementById(bloque).getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
	   if(p[i].className == "textBlog"){
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=minValue) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   		}   
	}
}
function resetFontSize(bloque){
	   var p = document.getElementById(bloque).getElementsByTagName('p');
	    for(i=0;i<p.length;i++) {
		if(p[i].className == "textBlog"){
	   if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
		  } else {
         var s = 12;
		  }
		 p[i].style.fontSize = "12px";
		}
		}
}
function MM_jumpMenu(targ,selObj,restore){ 
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function altura(){
  al = new Array(); max = 0;
	try{
	  if(document.getElementById){
		  for(i=0;i<arguments.length;i++){
			if(document.getElementById(arguments[i]))
			  al[i] = document.getElementById(arguments[i]).offsetHeight;
		  }
		  max = mayor(al);
		  if(max > 0){
			for(i=0;i<arguments.length;i++){
			  if(document.getElementById(arguments[i]))
				document.getElementById(arguments[i]).style.height = max + 'px';
			  }
		  }
	  }
	}
	catch (exc) {
	  alert("Se ha producido un error en la carga del CSS.");
	  throw exc;
		}
	}
 function mayor(datos){  
  salida = 0;  
  for(i=0;i<datos.length;i++){  
	  if(parseInt(datos[i]) > salida )  
	  	  salida = datos[i];  
  }  
  return salida;
 }
 addOnload(mainLinks);
 function mainLinks(){
	if(document.getElementById("bandsIndex") && document.getElementById("box")){
 var links = document.getElementById("bandsIndex").getElementsByTagName("a");
 for(var i=0; i<links.length; i++){
 if(links[i].className == "prevLink")
 setupLink(links[i]);
 }
 }
//document.getElementById("box").onmouseout = activeBox;
//document.getElementById("box").onmouseout = clearBox;
 }
 function setupLink(thisLink){
	 thisLink.onmouseover = position;
 }
 function position(e){
 	//to make the function works properly you need a parameter or EVENT
	var posX;
	var posY;
	elemPos =  this.offsetWidth;
	var browser = navigator.appName;
	if (browser == "Microsoft Internet Explorer"){
	coorX= event.clientX + document.body.scrollLeft;
	posY = event.clientY + document.body.scrollTop;
	}else{
	coorX = e.layerX;
	posY =  e.layerY;
	}
	posX = divSize(coorX) + elemPos;
	with(document.getElementById("box").style){
	display = "block";
	marginTop = (posY-50) + "px";
	marginLeft = (posX+7) + "px";
	var pos = this.href.lastIndexOf("bandas")+7;
	var posFinal = this.href.lastIndexOf("/");
	var id = this.href.substring(pos,posFinal);
	xajax_previewBand(id);
   }
 }
 function divSize(x){
	 if(x>= 5 && x<183)
	 position = 5;
	 else if(x>= 183 && x<366)
	 position = 183;
	 else if(x>= 366 && x<549)
	 position = 366;
	 else if(x>= 549)
	 position = 549;
	 return position;
 }
 
 function activeBox(){
 document.getElementById("box").style.display = "block";
 }
 function clearBox(){
 document.getElementById("box").style.display = "none";
 document.getElementById("box").innerHTML = "";
 }