var enableCache = true;
var jsCache = new Array();

var dynamicContent_ajaxObjects = new Array();

function objetoAjax()
{
  var xmlhttp=false;
  try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
  try {
  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
  xmlhttp = false;
  }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;}

function actzContCata(){
	divZona = document.getElementById("CantAddcat");
	ajax=objetoAjax();
	ajax.open("POST", "CantAddcat.php" );
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1) {
			
		}
		if (ajax.readyState==4) {
			divZona.innerHTML = ajax.responseText;
		}
	} 
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	ajax.send(null)}


function addCatalogo(ID,Nombre){ 
	var el = document.getElementById(ID);
	ajax=objetoAjax();
	ajax.open("POST", "AddTocat.php" );
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1) {
				//Cargando
        }
		if (ajax.readyState==4) {
			el.className=ajax.responseText
			actzContCata();

			if(el.className=="led_1"){
				$(function() {
				
					var selectedEffect = 'transfer';
					var options = { to: "#CantAddcat", className: 'ui-effects-transfer' };
					$("#fx_"+ID).effect('transfer',options,500);
				
				});
				
			}
			
			
		} 
	} 
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
		ajax.send("ID="+ID+"&Nombre="+Nombre)
	
	}
	
	
function DeletCatalogo(ID){ 
	var el = document.getElementById(ID);
	ajax=objetoAjax();
	ajax.open("POST", "DeletTocat.php" );
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1) {
				//Cargando
        }
		if (ajax.readyState==4) {
			
			$(function() {
				$("#"+ID).hide('blind',{},'slow', function () {
					$("#"+ID).remove();
					actzContCata();
				});// end hide
			});//end function
		
		actzContCata();
		} 
	} 
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
		ajax.send("ID="+ID)
	
	}	
	
function DeletCatAll(){ 
	
	ajax=objetoAjax();
	ajax.open("GET", "DeletTocat.php?ALL=true" );
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1) {
				//Cargando
        }
		if (ajax.readyState==4) {
			
			$(function() {
				$("#Cat_Cont").hide('blind',{},'slow', function () {
					
					$("#Cat_Cont").empty();
					actzContCata();
					$("#Cat_Cont").html('No hay Productos seleccionados para la lista de catalogo');
					$("#Cat_Cont").show('blind',{},'slow');
				});// end hide
			});//end function
		} 
	} 
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
		ajax.send("null")
	
	}

function currenter(variable){
	current_pos=$('#current_'+variable).position();
	current_height=$('#current_'+variable).height();
	
//alert(current_height);

$("#Currente_anima").animate({"top": current_pos.top, "height":current_height},0);
	$('#Currente_anima').css('visibility','visible');


}

