function NewWindow(mypage,myname,w,h,Resice){
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=0,resizable='+Resice+',titlebar=0,status=0';
  window.open(mypage,myname,settings);
  return;
}
function furl(fot,s){
//  return '/thumb.php?size='+s+'&fot='+fot+'.jpg';
  return urlfoto+s+'/'+fot+'.jpg';
  urlfoto
}
function foto(s,nf){
  return furl(nf,s);
}
function fg(){
  //imgfoto.src=foto("g",pfg);
  //document.getElementById('fotog').callJavaScript("/g/"+pfg+".jpg");
  document.getElementById('fotog').callJavaScript(furl(pfg,"o"));
}
function f1(){
  if (pf1==""){
    imgespa.style.display='none';
  }else{
    imgespa.style.display='';
    imgespa.src=foto("p",pf1);
  }
}
function f2(){
  if (pf2==""){
    imgdeta.style.display='none';
  }else{
    imgdeta.style.display='';
    imgdeta.src=foto("p",pf2);
  }
}
function cf1(){
  t=pfg;
  pfg=pf1;
  pf1=t;
  fg();
  f1();
}
function cf2(){
  t=pfg;
  pfg=pf2;
  pf2=t;
  fg();
  f2();
}
function imagen(n){

    nf = n;
    f = Vestidos[parseFloat(nf)][0];
    t = Vestidos[parseFloat(nf)][1];
    d = Vestidos[parseFloat(nf)][2];

imgfoto=document.getElementById('foto');
imgespa=document.getElementById('espa');
imgdeta=document.getElementById('deta');
    
    pfg=nf;
    if (t==1){
      pf1=nf+"-2";
      if (d==1){
        pf2=nf+"-3";
      }else{
        pf2="";
      }
    }else{
      pf2="";
      if (d==1){
        pf1=nf+"-3";
      }else{
        pf1="";
      }
    }
    //$("#foto").fadeOut("slow", function () {
//      document.getElementById(\'foto\').src=\'/thumb.php?size=g&fot=\'+n+\'.jpg\';
      fg();
      //$("#foto").fadeIn("slow");
//});
      f1();
      f2();
    bgpos = (d+t)* 180 + 90;
    document.getElementById("contenedor").style.backgroundPosition = "right "+bgpos+"px";

    $('#pane2')[0].scrollTo('#f'+nf);
    lista("in");
    return false;
}
function saludar(nombre){
   alert(nombre);
}
function imagen2(n){

    nf = n;
    f = Vestidos[parseFloat(nf)][0];
    t = Vestidos[parseFloat(nf)][1];
    d = Vestidos[parseFloat(nf)][2];

imgfoto=document.getElementById('foto');
imgespa=document.getElementById('espa');
imgdeta=document.getElementById('deta');
    
    pfg=nf;
    if (t==1){
      pf1=nf+"-2";
      if (d==1){
        pf2=nf+"-3";
      }else{
        pf2="";
      }
    }else{
      pf2="";
      if (d==1){
        pf1=nf+"-3";
      }else{
        pf1="";
      }
    }

      f1();
      f2();
    bgpos = (d+t)* 180 + 90;
    document.getElementById("contenedor").style.backgroundPosition = "right "+bgpos+"px";
    $('#pane2')[0].scrollTo('#f'+nf);
    lista("in");
    return false;
}
function cargaContenido(url, metodo, funcion) {
  peticion_http = inicializa_xhr();
 
  if(peticion_http) {
    peticion_http.onreadystatechange = funcion;
    peticion_http.open(metodo, url, true);
    peticion_http.send(null);
  }
}
 
function inicializa_xhr() {
  if(window.XMLHttpRequest) {
    return new XMLHttpRequest();
  }
  else if(window.ActiveXObject) {
    return new ActiveXObject("Microsoft.XMLHTTP");
  }
}
function milista() {
  if(peticion_http.readyState == READY_STATE_COMPLETE) {
    if(peticion_http.status == 200) {
      var texto;
      texto=peticion_http.responseText;
//      alert(texto);
      if (texto==1){
        document.getElementById("lista").src="/img/estrella2.png";
      }else{
        document.getElementById("lista").src="/img/estrella1.png";
        if (idmenu==8){
          location.reload();
        }
      }
    }
  }
} 
function lista(act) {
  cargaContenido("/lista/?act=" + act + "&nf=" + nf, "GET", milista);
}

