var $_returnvalue = false;
// JavaScript Document
//Funcion que realiza la consulta de cuenta productos hay en la lista del usuario
function contarLista()
{
	//	$("#countL").empty();
	var user = $('#idpersona').html();
	
	$.get("transaccion/Consultas.php", 
		  { criterio: "contarListaPersona", idp: user},
		  mostrarContLista);	
}

//Funcion que despliega el resultado de la consulta
function mostrarContLista(data)
{
	
	var cont=eval("(" + data + ")");
	
	cuenta = cont[0]['cuenta'];	
	
	if(cuenta>0) {
		$("#countL").html(cuenta);
	} else {
		$("#countL").html('0');
	}
}
function so_init() {
  if(!d.getElementById || !d.createElement)return;
  imgs = d.getElementById("imageContainer").getElementsByTagName("img");
  for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
  imgs[0].style.display = "block";
  imgs[0].xOpacity = .99;
  setTimeout(so_xfade,5000);
}

function so_xfade() {
  cOpacity = imgs[current].xOpacity;
  nIndex = imgs[current+1]?current+1:0;
  nOpacity = imgs[nIndex].xOpacity;
  cOpacity-=.05; 
  nOpacity+=.05;
  imgs[nIndex].style.display = "block";
  imgs[current].xOpacity = cOpacity;
  imgs[nIndex].xOpacity = nOpacity;
  setOpacity(imgs[current]); 
  setOpacity(imgs[nIndex]);
  if(cOpacity<=0) {
    imgs[current].style.display = "none";
    current = nIndex;
    setTimeout(so_xfade,5000);
  } else {
    setTimeout(so_xfade,50);
  }
  function setOpacity(obj) {
    if(obj.xOpacity>.99) {
      obj.xOpacity = .99;
      return;
    }
   obj.style.opacity = obj.xOpacity;
    obj.style.MozOpacity = obj.xOpacity;
    obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
  }
}

function ucfirst(str) 
{ var firstLetter = str.substr(0, 1); return firstLetter.toUpperCase() + str.substr(1); }

function presionar(e)
	{
	//Esta parrte es para IE
	if (window.event)
	  {
	           if (window.event.keyCode==13)
		{buscarPorClaves();}// Aqui escribe el nombre tu funcion que hace la busqueda...
	  }
	  else
                    //Esto es para Firefox y creo otros navegadores
		if (e)
		{
		  if(e.which==13)
		  	{buscarPorClaves();}//Igual que arriba
		}
	}

function addEvent(elemento,nomevento,funcion,captura)
{
  if (elemento.attachEvent)
  {
    elemento.attachEvent('on'+nomevento,funcion);
    return true;
  }
  else  
    if (elemento.addEventListener)
    {
      elemento.addEventListener(nomevento,funcion,captura);
      return true;
    }
    else
      return false;
}

function pulsar(e) {
  tecla = (document.all) ? e.keyCode :e.which;
  return (tecla!=13);
} 

$(document).ready(function($){

	$("a#iframe").fancybox({
		'width' : 600,
		'height': 720,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'type' : 'iframe'
	});	
	$("a#iframe2").fancybox({
		'width' : 600,
		'height': 720,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'type' : 'iframe'
	});	
	$("a#iframe3").fancybox({
		'width' : 600,
		'height': 720,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'type' : 'iframe'
	});	
});	
