function changeImage(chart,filter,param) {
 document.char.src=chart+"?"+filter+"="+param;
}
var elemento;
function cargarExtra(extra,id)
{
 if(elemento==null)
 {
  elemento=document.createElement("div");
  elemento.setAttribute("id","contenidoextra");
  elemento.style.backgroundColor="white";
  document.body.appendChild(elemento);
 }
 var html = $.ajax({
  type: "POST",
  url: "/mapa.php",
  data: "extra="+extra,
  async: false
 }).responseText;
 elemento.innerHTML="<table width='100%' cellspacing='0'><tr><td align='right' style='background-color:#666699;;'><b style='color:white;cursor:pointer;' onclick='descargarExtra();'>[Close]</b></td></tr></table>"+html;
 elemento.style.position="absolute";
 elemento.style.left=$("#"+id).position().left+"px";
 elemento.style.top=($("#"+id).position().top+$("#"+id).height())+"px";
 $(elemento.getElementsByTagName("input")[3]).click(
  function(){
    params="txtname="+elemento.getElementsByTagName("input")[1].value+"&txtemail="+elemento.getElementsByTagName("input")[2].value+"&subscribeme="+elemento.getElementsByTagName("checkbox")[3].value;
    $.ajax({
      type: "POST",
      url: "forms-extra.php",
      data: params,
      success: function() {
        $(document.getElementById("contenidoextra")).html("<div id='message'>Your message was sent.</div>");
      }
     });
  }
 );
}

function descargarExtra(){
 if(elemento)
  {
   document.body.removeChild(elemento);
   elemento=null;
  }
}

var Lst;
function ChangeColor1(obj){
 Fst = document.getElementById(obj);
 Fst.className='tab';
 if (Lst) Lst.className='tab';
    Fst.className='tab2';
    Lst=Fst;
 }

var Lstx
function ChangeColor2(xvar){
 Fst = document.getElementById(xvar);
 Fst.className='tab';
 if (Lstx) Lstx.className='tab';
    Fst.className='tab2';
    Lstx=Fst;
 }

var Lstz
function ChangeColor3(zvar){
 Fst = document.getElementById(zvar);
 Fst.className='tab';
 if (Lstz) Lstz.className='tab';
    Fst.className='tab2';
    Lstz=Fst;
 }

/*var Lst2;
function ChangeColor2(obj){
 if (Lst2) Lst2.className='tab';
    obj.className='tab2';
    Lst2=obj;
 }*/

var clic=false;
var conteo=-1;
var seleccionado=-1;

function changeStar(star){
	for(i=0;i<=parseInt(star.getAttribute("id"));i++){
		document.getElementById("0"+i).setAttribute("src","/images/estrella2.png");
                document.getElementById("0"+i).className="";
	}
	for(j=parseInt(star.getAttribute("id"))+1;j<=4;j++)
	{
	 document.getElementById("0"+j).setAttribute("src","/images/estrella1.png");
         document.getElementById("0"+j).className="";
	}
	conteo=parseInt(star.getAttribute("id"));
}

function outStar(){
	if(clic==false)
	{
		for(k=0;k<=4;k++){
			document.getElementById("0"+k).setAttribute("src","/images/estrella1.png");
   			document.getElementById("0"+k).className="";
		}
	}
        else
        {
         changeStar(document.getElementById("0"+seleccionado));
        }
}

function clicStar(){
	clic=true;
	document.getElementById("score").value=(conteo+1);
        seleccionado=conteo;
}

function toggleDisplay2(me) {
  if (document.getElementById(me).style.display == 'none') {
    document.getElementById(me).style.display='block';
    document.getElementById(me+"2").style.display='none';
  } else { 
    document.getElementById(me+"2").style.display='block';
    document.getElementById(me).style.display='none';
  }
}

