//carga un CSS en caso de tener Javascript activado
function javascript_css(quin){
	document.write("<link rel= \"stylesheet\" type=\"text/css\" media=\"all\" href=\""+quin+"\" />");
}

function midatext(mida){
	SetCookie ("lletra",mida);
	window.location.reload();
}

function midalletra(path){
	mida=GetCookie("lletra");
	if(mida=="2"){
		javascript_css(path+"big.css");
	}
	else if(mida=="3"){
		javascript_css(path+"bigger.css");
	}
}

function SetCookie (name, value) { 
	var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : "/";
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value)+((expires == null) ? "" : ("; expires=" + expires.toGMTString()))+((path == null) ? "" : ("; path=" + path))+((domain == null) ? "" : ("; domain=" + domain))+((secure == true) ? "; secure" : "");
}

function getCookieVal (offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)  endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
	var arg = name + "=";
    var alen = arg.length;        
	var clen = document.cookie.length;
    var i = 0;       
	while (i < clen) {        
	     var j = i + alen;
    	 if (document.cookie.substring(i, j) == arg)
    	 return getCookieVal (j);
	     i = document.cookie.indexOf(" ", i) + 1;
         if (i == 0) break;         
	 }
	return null;
}

visSitemap=false;
function showsitemap(){
	sitemapobj=document.getElementById("sitemap")
	if(visSitemap) sitemapobj.style.display="none";
	else sitemapobj.style.display="block";
	visSitemap=!visSitemap;
}
visNews=false;
function shownews(){
	relatednewsobj=document.getElementById("relatednews")
	if(visNews) relatednewsobj.style.display="none";
	else relatednewsobj.style.display="block";
	visNews=!visNews;
}

function deletecontent(input,texto){
	if(input.value==texto) input.value="";
}

function thisMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

/*function foto(str,str2) {
	document.getElementById("youneedhelp").style.display="none";
	if(version['major'] > 0) thisMovie("cortinilla").cargarFoto(str,str2);
}*/

/* tickers */
// omada
function start(){
	new Ticker("ticker1", 25);
	new Ticker("ticker2", 25);
} 

var iedom = !!(document.all || document.getElementById);

function firstElementChild(node)
{
	var children = node.childNodes;
	for (var i = 0; i < children.length; i++) {
		if(children[i].tagName) return children[i];
	}
}

function styledDiv(style)
{
   var element = null;
   try {
      element = document.createElement("<div style='"+style+"'>");
   }
   catch (e) { }

   if (!element || element.nodeName != "DIV") {
      element = document.createElement("div");
      element.setAttribute("style", style);
   }

   return element;
}

function Ticker(id, ms)
{
	if (!iedom) return; // do nothing

	this.id = document.getElementById(id);
	this.copyspeed = 1;

	this.tickerWidth = parseInt(this.id.clientWidth);

	this.content = this.id.innerHTML;
	this.contentWidth = parseInt(firstElementChild(this.id).offsetWidth);

	var w2 = this.contentWidth;

	this.inner1 = styledDiv("position:absolute; left:0px;");
	this.inner1.innerHTML = this.content;

	this.inner2 = styledDiv("position:absolute; left:"+w2+"px;");
	this.inner2.innerHTML = this.content;

	this.id.innerHTML = "";
	this.id.appendChild(this.inner1);
	this.id.appendChild(this.inner2);

	var mythis = this;
	var closure = function() {
		mythis.scroll.call(mythis);
	}
	
	coco = setInterval(closure, ms);
}

Ticker.prototype.scroll = function ()
{
	if (parseInt(this.inner1.style.left) > -this.contentWidth)
	{
		this.inner1.style.left = parseInt(this.inner1.style.left)-this.copyspeed+"px";
	}
	else
	{
		this.inner1.style.left = this.contentWidth+"px";
	}

	if (parseInt(this.inner2.style.left) > -this.contentWidth)
	{
		this.inner2.style.left = parseInt(this.inner2.style.left)-this.copyspeed+"px";
	}
	else
	{
		this.inner2.style.left = this.contentWidth+"px";
	}
}

function  switchopen(item){
	father=document.getElementById(item);
	divchild=father.getElementsByTagName('div');

	shown=divchild[0].style.display;
	if(shown=="none" || shown==""){
		divchild[0].style.display="block";
		father.className="unfold";
	}
	else{
		divchild[0].style.display="none";
		father.className="fold";
	}
}

function loadsection()
{	
	//empty - no debe utilizarse esta funcion
}