function saveCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000))
		var expires = "; expires="+date.toGMTString()
	}
	else expires = ""
	document.cookie = name+"="+value+expires+"; path=/"
}

function readCookie(name) {
	var nameEQ = name + "="
	var ca = document.cookie.split(';')
	for(var i=0;i<ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length)
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
	}
	return null
}

function deleteCookie(name) {
	saveCookie(name,"",-1)
}

function redirigir(idioma) {
	location = '/index.htm'
}

function redirigir() {
	location = '/index.htm'
}

function fijarCookie() {
	return;
	/*idioma=readCookie('idiomaJS')
	if (idioma==null) {
		saveCookie('JSProbarCookie','probar',1)
		cookieValue=readCookie('JSProbarCookie')
		if (cookieValue!=null) {
			deleteCookie('JSProbarCookie')
			openWinNew('/eligeIdioma.htm',400,245,'no','no')
		}
		else return
	}*/
}

function setIdioma(idioma) {
//	saveCookie('idiomaJS',idioma,365);
//	redirigir(idioma);
	if (idioma == "port") return;
	location = "/web/"+idioma+"/";
}

function QueryString( param )
{
  var begin,end;
  if(self.location.search.length>1)
  {
    begin=self.location.search.indexOf(param) +param.length+1;
    end=self.location.search.indexOf("&",begin);
    if(end==(-1)) end=self.location.search.length;
    return(self.location.search.substring(begin,end));
  }
  else if(self.location.hash.length>1)
  {
    begin=self.location.hash.indexOf(param) +param.length+1;
    end=self.location.hash.indexOf("&",begin);
    if(end==(-1)) end=self.location.hash.length;
    return(self.location.hash.substring(begin,end));
  }
  else return("");
}
