var ic = 9;     // Number of alternative images
var xoxo = new Array(ic);  // Array to hold filenames
        
xoxo[0] = "img/headerPhoto.jpg";
xoxo[1] = "img/headerPhoto01.jpg";
xoxo[2] = "img/headerPhoto02.jpg";
xoxo[3] = "img/headerPhoto03.jpg";
xoxo[4] = "img/headerPhoto04.jpg";
xoxo[5] = "img/headerPhoto05.jpg";
xoxo[6] = "img/headerPhoto06.jpg";
xoxo[7] = "img/headerPhoto07.jpg";
xoxo[8] = "img/headerPhoto08.jpg";




function pickRandom(range) {
	if (Math.random)
		return Math.round(Math.random() * (range-1));
	else {
		var now = new Date();
		return (now.getTime() / 1000) % range;
	}
}
// Write out an IMG tag, using a randomly-chosen image name.


var choice = pickRandom(ic);

function artContent(pId, pVis){
	try{ 
		if (pVis=='1'){
			document.getElementById(pId).style.position = 'relative';
			document.getElementById(pId).style.visibility = 'visible';
		}
		else{
			document.getElementById(pId).style.position = 'absolute';
			document.getElementById(pId).style.visibility = 'hidden';
		}
		
		var artid_substring = "";
		if (pId!=null)
			artid_substring = pId.substring(4);
			window.location.hash = artid_substring;
	}
	catch (e){
		alert(e);
	}
}

var id,pause=0,position=0;

function replaceAll (streng, soeg, erstat)
{ var st = streng;
  if (soeg.length == 0)
     return st;
  var idx = st.indexOf(soeg);
  while (idx >= 0)        
  {  st = st.substring(0,idx) + erstat + st.substr(idx+soeg.length);
     idx = st.indexOf(soeg);
  }
  return st;
}


function banner()
{
	var obj, i,k,msg=document.lastnews.message.value;
	var auxForImages;
	k=(20/msg.length)+1;
	for(i = 0; i <= k; i++)
		msg += " " + msg;
	
	obj = document.getElementById('ultimahora');
	auxForImages = msg.substring(position, position+99);
	
	 auxForImages = replaceAll(auxForImages, '^', '<img src="img/banderaInd.gif">');
	 auxForImages = replaceAll(auxForImages, '{', '<img src="img/indicador2.gif">');
	 auxForImages = replaceAll(auxForImages, '}', '<img src="img/indicador3.gif">');
	 auxForImages = replaceAll(auxForImages, '_', '<img src="img/indicador4.gif">');
	 auxForImages = replaceAll(auxForImages, "~", '<img src="img/indicador5.gif">');
	 auxForImages = replaceAll(auxForImages, '`', '<img src="img/indicador6.gif">');
	 auxForImages = replaceAll(auxForImages, '|', '<img src="img/indicador7.gif">');
	 auxForImages = replaceAll(auxForImages, "Ç", '<img src="img/indicador8.gif">');
	
	
	
		
	obj.innerHTML = auxForImages;
	
	//if (obj.innerHTML)
	if (position++ == document.lastnews.message.value.length)
		position=0;
	id = setTimeout("banner()", 190); 
}

function goSearch(){
	if(isEmpty(document.search_form.terms,'Debe ingresar los terminos (palabras) que desea buscar en el sitio DAPD'))
		return;
	document.search_form.submit();
	
}

// End -->