	/**
	 *	js.index,js
	 *
	 *	"Configura acciones y eventos para la portada INDEX."
	 *
	 *	@date 11/Mayo/2010, 7:16pm
	 *	@version 1.0
	 *	@author Ralph Moran
	 *	@contact ralphmoran2003@gmail.com
	 *
	 *	@ChangeLog:
	 *	-----------------------------------------
	 *		@update 17/Junio/2010, 1:36am
	 *		@author Ralph Moran
	 *		"Agrego bloqueo del boton derecho del mouse"
	*/
	
	//_PAYPAL_CHECKOUT   = 'https://www.paypal.com/cgi-bin/webscr';
	_PAYPAL_CHECKOUT 	 = 'https://www.sandbox.paypal.com/cgi-bin/webscr';	
	_UPDATE_CART     	 = '?tipo=cart&str_View=cart&str_SeccionCart=procesoPago&btn_ActualizarCarrito=1';
	_URL_CONTRAREEMBOLSO 	 = '?tipo=cart&str_View=cart&str_SeccionCart=success';
	_URL_TRANFERENCIA 	 = '?tipo=cart&str_View=cart&str_SeccionCart=success&str_TipoPago=trans';
	_URL_CONTROLLERS 	 = 'controllers/';
	_URL_TPV		 = 'https://tpv01.cajarural.com/nuevo_tpv/tpv/jsp/tpvjp_validaComercio.jsp';
	//_URL_URI_BASE ='http://localhost/fabiola';
	 _URL_URI_BASE ='http://www.fabiola.info';
	
	$(function()
	{				
		// Bloquear el boton derecho de manera general y tambien la combinacion de teclas
		$(this).bind("contextmenu", function(e) { e.preventDefault(); });
		$(this).bind('keydown', 'ctrl+c', function(){return false;});
		
		//Regla para que la imagen de detalle grande se muestre segun la seleccionada
		$("#detalle_producto_izquierda ul li img").hover( 
			function () 
			{
				$("#detalle_producto_izquierda_img").attr({src:'files/originales/'+$(this).attr("name")});					
				
				if( $("#detalle_producto_izquierda_img").parent().hasClass("fancy-detalle-item") )
					$("#detalle_producto_izquierda_img").parent().attr({href:'files/'+$(this).attr("name")});
			},
			function (){}
		);
										
		// Regla para cambiar la imagen tradicional de Paypal por la que deseamos		
		$("form[target='paypal'] input[type='image'],form[target='paypal'] img").attr({src:'imgs/btn-agregar.png'});
		
		// Regla para que cuando le den click al boton de a�adir al carrito se lleve un informe aproximado de ventas
		$("form[target='paypal'] input[type='image']").click(function()
		{
			$.post('controllers/controllerBuscador.php?tipo=ventas',{tfh_idArt:$("#tfh_idArt").val()},function(resp)
			{
				//alert(resp);
			});
		});		

		$("#str_DatoBuscar").autocomplete( "controllers/controllerAutoComplete.php?tipo=articulos",{selectFirst:false, minChars:2});
		
		/**
		 *	Mostrar aviso de compatibilidad.
		*/
		
		// No compatible para IE6-
		if( $.browser.msie && parseInt($.browser.version) < 7 )
		{
			$("#div_Central .alerta").css({display:"block"});
			$("#div_Central").css({width:"580px"});
		}		
		
		/**
		 * Activacion de JCarouseles
		*/
		
		$('#jc-sugerencias').jcarousel({
			//itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt){carousel.remove(i);}}, // Descomentar si se quiere eliminar items del DOM, los que estan fuera de vista.
			scroll:1,
			itemLoadCallback: itemsLoadSugerencias
		});
		
		$('.jc-mas-vistos').jcarousel({
			//itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt){carousel.remove(i);}}, // Descomentar si se quiere eliminar items del DOM, los que estan fuera de vista.
			scroll:1,
			itemLoadCallback: itemsLoadMasVistos
		});
		
		$('#jc-vistos-recientes').jcarousel({
			//itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt){carousel.remove(i);}}, // Descomentar si se quiere eliminar items del DOM, los que estan fuera de vista.
			scroll:1,
			itemLoadCallback: itemsLoadVistosRecientes
		});
		
		
		$(".click").click(function()
		{
			$.post("models/modelClicksBanners.php",{idB:this.id}, function(data)
			{
				//alert(data);
			});		
		});
		
		/***
		*	Configuracion del Dialog
		*/
		
		// Dialogo para agregar imagenes.
		$("#div_Contenedor").dialog(
		{
			modal:true,
			overlay: 
			{
				backgroundColor: '#ffffff',
				opacity: 0.5
			},
			draggable: true,
			resizable: true,
			height: 200,
			width: 300,
		/*	buttons: 
			{
				'Cerrar': function() 
				{					
					$(this).dialog('close');
					//$(this).dialog('destroy'); 
					$("#div_Contenedor *").remove();
				}
			},*/
			close: function(event, ui) 
				{ 
					
					$("#div_Contenedor *").remove();
					
				},
			autoOpen: false
			
		});
		
		
		/* Codigo para el formulario de favoritos (loggeo) */
		$(".btn-favoritos").click(function()
		{
			/// Crear un dialog que solicite los datos del cliente
			$("#div_Contenedor").dialog("open");
			
			ContenidoDiv = '<label style="display:block">Email </label><input name="tfd_Mail" id="tfd_Mail" type="text"" />';
			ContenidoDiv +='<label style="display:block">Password </label><input name="tfd_Pass" id="tfd_Pass" type="password" />';
			ContenidoDiv += '<input name="btn_Validar" id="btn_Validar" type="button" value="Guardar en mis favoritos" />';
			ContenidoDiv += '<!--<a name="link_Reg" id="link_Reg" href="">Registrarme</a>-->';
			
			$("#div_Contenedor").append(ContenidoDiv);
			
			$("#btn_Validar").unbind("click").click(function()
			{
				$.fancybox.showActivity();
				
				//Enviar estas variables al controller buscador para verificar que el usuario existe y asignar las variables de session
				$.post(_URL_CONTROLLERS+"controllerBuscador.php?tipo=clienteFavoritos", {email : $("#tfd_Mail").val(), psw : $("#tfd_Pass").val(), int_IDArt : $("#tfh_IDArticuloFav").val() }, function(resp)
				  {
					  //alert(resp);
					  
					  if( resp == "1" )
					  {
					  	  $("#div_Contenedor").dialog("close");
					  }
					  else
					  {
						  alert( "Los datos no son correctos." );
					  }					  
					  
					  $.fancybox.hideActivity();
				  });
			});
				
		});
		
		
		/**
		 *	Formulario de contacto
		*/
		
		$("#form_Contacto").validate(
		{						
			rules:{
					tfd_De:{
						required: true,
						email: true
						},
					tarea_Mensaje:{required: true},
					tfd_Nombre:{required: true}
				},	
			messages:{
					tfd_De:{
						required: "Obligatorio.",
						email:"Por favor escribe un email valido!"
						},
					tarea_Mensaje:{required: "Obligatorio."},
					tfd_Nombre:{required: "Obligatorio."}
				},
			submitHandler:function()
				{					
					$.fancybox.showActivity();
					$.ajaxSetup({async: false});
					
					$.post("controllers/controllerMails.php?tipoMail=contactos", $("#form_Contacto").serialize(), function(data)
					{
						$("#tarea_Mensaje").val("");	
						$("#tfd_De").val("");
						$("#tfd_Nombre").val("");
						$("#tfd_Apellidos").val("");
						$("#tfd_Tel").val("");
						
						$.ajaxSetup({async: true});
						$.fancybox( data );									
					});
				}
		});
		
		/**/
		$("#form_Boletines").validate(
		{						
			rules:{
					Email:{
						required: true,
						email: true
						}
				},	
			messages:{
					Email:{
						required: "Obligatorio.",
						email:"Por favor escribe un email valido!"
						}
				},
			submitHandler:function()
				{	$("#img_Email").show();
					$.post("controllers/controllerBuscador.php?tipo=EmailCorrecto", $("#form_Boletines").serialize(), function(data)
					{	if(data == "1")
						{
							alert( "La cuenta de correo dada ya existe en nuestra base de datos" );
						}
						else
							alert( "Tu registro fue hecho con exito.\n\nPronto recibiras los boletines de http://www.fabiola.info." );
						$("#tfd_EmailBoletin").val("");					
						$("#img_Email").hide();
					});
				}
		});		
		
		// Accion para el boton de pago en Paypal
		$('#btn_CheckOut').unbind('click').click(function()
		{
			//$('#custom').val("CompraNueva");
			checkoutPP( document.form_Cart );
		});
		
		// Evitar error de guardar en ventas
		$('#btn_ActualizarCarrito').unbind('click').click(function()
		{
			$('#custom').val("");
		});
		
		
		// Agregar evento para eliminar item del carrito de compras
		$("img.delete-item-cart")
			.unbind("click")
			.click(function()
				{
					$("#quantity_"+$(this).attr("name")).val(0);
					$("#btn_ActualizarCarrito").trigger("click");
				}
			);
		
		/**
		 *	Para las subcategorias
		*/
		
		$('ul.sf-menu').supersubs({ 
			//pathClass: 'left_menu',
			minWidth:    12,   // minimum width of sub-menus in em units 
			maxWidth:    27,   // maximum width of sub-menus in em units 
			extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
							   // due to slight rounding differences and font-family 
		})
		.superfish({
			speed: 'fast',
			autoArrows: false,
			delay: 600
		});
		
		/**
		 *
		*/
		
		$("#tfd_EmailBoletin")
			.unbind("click")
			.click(function()
				{
					( $(this).val() === "registro a boletines" ) ? $(this).val("") : "" ;
				})
			.blur(function()
				{
					( $.trim($(this).val()) === "" ) ? $(this).val("registro a boletines") : "" ;
				})
			
		
		$("#form_EmailBoletines").validate(
		{						
			rules:{
					tfd_EmailBoletin:{
						required: true,
						email: true
						}
				},	
			messages:{
					tfd_EmailBoletin:{
						required: "Email obligatorio",
						email: "Por favor, escribe un correo valido!"
						}
				},
			submitHandler:function()
				{	
					$.post("controllers/controllerBuscador.php?tipo=EmailCorrecto", $("#form_EmailBoletines").serialize(), function(data)
					{	
						if(data == "1")
							alert( "La cuenta de correo dada ya existe en nuestra base de datos" );
						else
							alert( "Tu registro fue hecho con exito.\n\nPronto recibiras los boletines de http://www.fabiola.info." );
														
						//$("#img_Email").hide();
						$("#tfd_EmailBoletin").val("registro a boletines");
					});
				}
		});		
		
		
		/**
		 *	Acciones para el formulario de PAGO/ENVIO/CARGOS EXTRAS.
		*/
		
		$(".pasos_compra")
			.unbind("click")
			.click(function()
				{
					$pasosCart = $("#"+ this.id + " + .contenedor_pasos_compra");
					$pasosCart.is(":visible") ? $pasosCart.slideUp("normal") : $pasosCart.slideDown("normal") ;
				})
			.css({"cursor":"pointer"});
		
		$(".pasos_compra + .contenedor_pasos_compra").slideUp(300);
		
		var chk;
		$("#chk_DirIgualFacturacion").click(function()
			{				
				$.fancybox.showActivity();
				$.ajaxSetup({async: false});
				
				$.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=chksess" , {chk : $("#chk_DirIgualFacturacion").val()}, function(resp)
				{
					if(resp != 'on')
					{
						$("#ul_DatosNvoCliente").slideDown("normal");	
					}else
					{
						if( $("#ul_DatosNvoCliente").is(":visible") )
						{
							$("#ul_DatosNvoCliente").slideUp("normal");
							$("#datos-envio").html($("#chk_DirIgualFacturacion").val() +'-'+ $("#datos-facturacion").html() );
						}
					}
					//$("#datos-envio").html( resp );
					$.ajaxSetup({async: true});
					$.fancybox.hideActivity();
				});	
				
				if( !$("#chk_DirIgualFacturacion").is(":checked") )
				{
					$("#btn_DatosEnvio").trigger("click");
					
				}
			/*	
				
				if( $("#ul_DatosNvoCliente").is(":visible") )
				{
					$("#ul_DatosNvoCliente").slideUp("normal");
					$("#datos-envio").html($("#chk_DirIgualFacturacion").val() +'-'+ $("#datos-facturacion").html() );
				}
				else
				{
					$("#ul_DatosNvoCliente").slideDown("normal");
				//	$("#datos-envio").html( $("#chk_DirIgualFacturacion").val() + " ---  Nombre: <br />Apellidos: <br>Direcci&oacute;n: <br>Ciudad, Provincia, CP<br>Tel:" );
				}*/
			});
		
		
		
		
		
		
		// Validacion de los formularios CART
		$(".form-cart input[type='button']").click(function()
			{
				if( confirm("\u00BFEstas seguro de los datos?") )				
					$(this).parent().parent().parent().submit();
			});
		
		// Forma de envio y tipo de pago
		$(".tipo-envio")
			.unbind("click")
			.click(function()
				{
					
					$.fancybox.showActivity();
					//$.ajaxSetup({async: false});
					
					var rbn_FormaEnvio = $(this).val();
					
					
					$.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=Envio" , {rbn_Envio : rbn_FormaEnvio}, function(resp)
					{
						
						var arr_decimas = $("#total-art").html().split(",");
						
						if( $("#tfh_CargoFormaPago").val() !== undefined )
							var $flo_CargoFormaPago = parseFloat($("#tfh_CargoFormaPago").val());
						else
							var $flo_CargoFormaPago = 0;
							
					
						//alert(resp);
						
					
						switch( resp )//$(this).val() )
						{
						/*	case "ordinario":							
								$("#span_Envio").html("");
								
								var $flo_TotalConEnvio = new Number( parseFloat( $("#tfh_TipoPago").val() ) + parseFloat( $("#amountPP").val() ) );
								$("#tfh_TipoEnvio").val("0");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_GastosEnvio").html( "Ordinario" );
							break;
							
							case "urgente":
								$("#span_Envio").html("12,00 € + ");
								
								var $flo_TotalConEnvio = new Number( parseFloat( $("#tfh_TipoPago").val() ) + parseFloat( $("#amountPP").val() ) + 12.00 );
								$("#tfh_TipoEnvio").val("12.00");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );	
								
								$("#p_GastosEnvio").html( "Urgente <em>(+12,00 €)</em>" );							
							break;*/
							
							
							case "96hrs":							
								var str_envio =  parseFloat( $("#total-art").html()) >= 50 ? "0.00" : "7.00";
								$("#span_Envio").html(str_envio);
							
								$("#tfh_TipoEnvio").val(7);
								var $total = new Number(parseFloat( $("#total-art").html()) + parseFloat($("#span_Envio").html()) +  $flo_CargoFormaPago + parseFloat('0.'+arr_decimas[1]));
								$("#span_TotalEnvio").html( $total.toFixed(2));
								
								$("#p_GastosEnvio").html( "Entrega 96 hrs." );
							break;
							
							case "urgente":
								
								var str_envio =  parseFloat( $("#total-art").html()) >= 100 ? "0.00" : "8.00";
								$("#span_Envio").html(str_envio);
							
								$("#tfh_TipoEnvio").val(8);
								 var $total = new Number(parseFloat( $("#total-art").html()) + parseFloat($("#span_Envio").html()) + $flo_CargoFormaPago + parseFloat('0.'+arr_decimas[1]));
								
								$("#span_TotalEnvio").html( $total.toFixed(2));
								
								$("#p_GastosEnvio").html( "Urgente 24 hrs." );
											
							break;
							
						}
						$.fancybox.hideActivity();
						
					});
				});
		
		$(".tipo-pago")
			.unbind("click")
			.click(function()
				{
					$.fancybox.showActivity();
				//	$.ajaxSetup({async: false});
					
				/*	$(".tipo-pago").each(function()
					{							
						if( $(this).is(":checked"))
							rbn_TipoEnvio = $(this).val();
					}); */
					
					var rbn_TipoEnvio = $(this).val();
					
					$.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=TipoEnvio" , { str_TipoEnvio : rbn_TipoEnvio}, function(resp)
					{						 
						var arr_decimas = $("#total-art").html().split(",");
						
						switch( resp )
						{
							case "tarjeta":
								/*var $flo_TotalConEnvio = new Number( parseFloat( $("#tfh_TipoEnvio").val() ) + parseFloat( $("#amountPP").val() ) );
								$("#tfh_TipoPago").val("0");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Tarjeta de credito" )
								$("#span_CargoFormaPago").html( "Tarjeta de credito" );*/
								
								var $flo_TotalConEnvio = new Number(parseFloat( $("#total-art").html())+ parseFloat( $("#span_Envio").html()) + parseFloat('0.'+arr_decimas[1])  );
								$("#tfh_TipoPago").val("0");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Tarjeta de crédito" )
								$("#span_CargoFormaPago").html( '<input name="tfh_CargoFormaPago" id="tfh_CargoFormaPago" type="hidden" value="0.00" />Tarjeta de credito' )
								
							break;
							
							case "contrareembolso":
								/*var $flo_TotalConEnvio = new Number( parseFloat( $("#tfh_TipoEnvio").val() ) + parseFloat( $("#amountPP").val() ) + 3.00 );
								$("#tfh_TipoPago").val("3.00");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Contrareembolso <em>(+3,00 €)</em>" );
								$("#span_CargoFormaPago").html( "Contrareembolso <em>(+3,00 €)</em>" );*/
								
								var $flo_TotalConEnvio = new Number(parseFloat( $("#total-art").html()) + parseFloat( $("#span_Envio").html() )+ parseFloat('0.'+arr_decimas[1]) + 3.00 );
								$("#tfh_TipoPago").val("3.00");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Contrareembolso <em>(+3,00 &euro;)</em>" );
								$("#span_CargoFormaPago").html( '<input name="tfh_CargoFormaPago" id="tfh_CargoFormaPago" type="hidden" value="3.00" />Contrareembolso <em>(+3,00 &euro;)</em>' )
								
							break;
							
							case "paypal":
								/*var $flo_TotalConEnvio = new Number( parseFloat( $("#tfh_TipoEnvio").val() ) + parseFloat( $("#amountPP").val() ) + 3.00 );
								$("#tfh_TipoPago").val("3.00");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Paypal <em>(+3,00 €)</em>" );
								$("#span_CargoFormaPago").html( "Paypal <em>(+3,00 €)</em>" );*/
								
								var $flo_TotalConEnvio = new Number(parseFloat( $("#total-art").html()) + parseFloat( $("#span_Envio").html() )+ parseFloat('0.'+arr_decimas[1]) + 3.00 );
								//var $flo_TotalConEnvio = new Number(parseFloat( $("#total-art").html())+ parseFloat( $("#tfh_TipoEnvio").val()) + parseFloat('0.'+arr_decimas[1]) + 3.00 );
								$("#tfh_TipoPago").val("3.00");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Paypal <em>(+3,00 &euro;)</em>" );
								$("#span_CargoFormaPago").html( '<input name="tfh_CargoFormaPago" id="tfh_CargoFormaPago" type="hidden" value="3.00" />Paypal <em>(+3,00 &euro;)</em>' );
								
							break;
							
							case "tarjeta_4B":
																
								var $flo_TotalConEnvio = new Number(parseFloat( $("#total-art").html())+ parseFloat( $("#span_Envio").html()) + parseFloat('0.'+arr_decimas[1])  );
								$("#tfh_TipoPago").val("0");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Tarjeta de credito" )
								$("#span_CargoFormaPago").html( '<input name="tfh_CargoFormaPago" id="tfh_CargoFormaPago" type="hidden" value="0.00" />Tarjeta de credito' )
								
							break;


							case "transferencia":
								
								/*alert( $("#tfh_TipoEnvio").val() +' - '+ $("#amountPP").val() );
								var $flo_TotalConEnvio = new Number( parseFloat( $("#tfh_TipoEnvio").val() ) + parseFloat( $("#amountPP").val() ) );
								$("#tfh_TipoPago").val("0");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Tarjeta de credito" )
								$("#span_CargoFormaPago").html( "Tarjeta de credito" );*/
								
								var $flo_TotalConEnvio = new Number(parseFloat( $("#total-art").html())+ parseFloat( $("#span_Envio").html()) + parseFloat('0.'+arr_decimas[1]) + 0 );
								$("#tfh_TipoPago").val("0");
															
								$("#span_TotalEnvio").html( $flo_TotalConEnvio.toFixed(2) );
								
								$("#p_FormaPago").html( "Transferencia" )
								$("#span_CargoFormaPago").html( '<input name="tfh_CargoFormaPago" id="tfh_CargoFormaPago" type="hidden" value="0" />Transferencia' )
								
							break;
						}
						
					//	$.ajaxSetup({async: true});
						$.fancybox.hideActivity();
					});
				});
		
		// Accion para actualizar el carrito
		$(".btn-actualizar")
			.unbind("click")
			.click(function()
				{
					$("#form_Cart").attr({"action":_UPDATE_CART});
				});
		
		// Para guardar los datos de envio
		$("#btn_DatosEnvio")
			.unbind("click")
			.click(function()
				{
					var $bol_DatosEnvio = true;
					
					$(".form-envio").each(function()
					{							
						if( $.trim( $(this).val() ) == "" )
							$bol_DatosEnvio = false;
					});
					
					if( $bol_DatosEnvio ) 
					{
						$.post(_URL_CONTROLLERS+"controllerCart.php?" + $("#form_DatosEnvio").serialize(), {str_AccionCart:"guardaDatosEnvio"}, function(resp)
						{
							$("#datos-envio").html( resp );
						});
					}else
						alert( "Es necesario llenar todos los campos para su direccion de envio!" )					
					
				});
		
		// Configurar el boton de pago a PP
		$(".a-pp")
			.unbind()
			.click(function()
				{
					var $bol_TipoEnvio  = false;
					var $bol_TipoPago   = false;
					var $bol_DatosEnvio = false;
					var $bol_Talla       = true;
					var $str_TipoPago   = "";
					var $str_TipoEnvio  = "";
					
					$(".tipo-envio").each(function()
					{
						if( $(this).is(":checked") )
						{
							$bol_TipoEnvio = true;
							$str_TipoEnvio = $(this).val();
						}
					});
					
					$(".tipo-pago").each(function()
					{
						if( $(this).is(":checked") )
						{
							$bol_TipoPago = true;
							$str_TipoPago = $(this).val();
						}
					});
					
					$(".tallas").each(function()
					{
						if( $(this).val() == 'Seleccione' )
							$bol_Talla = false;
					});
					
					// Validar los datos de envio
					if( $("#chk_DirIgualFacturacion").is(":checked") )
						$bol_DatosEnvio = true;
					else
					{
						$bol_DatosEnvio = true;
						$(".form-envio").each(function()
						{							
							if( $.trim( $(this).val() ) == "" )
								$bol_DatosEnvio = false;
						});
						
					}
					
					// Validar que se dieron los datos correctamente
					if( $("#tfh_ClnLogged").val() == 1 && $bol_DatosEnvio && $bol_TipoPago && $bol_TipoEnvio && $bol_Talla)
					{
						if( $("#tfd_Clave").val() != "")
						{
							alert("Se ha actualizado el carrito para tomar en cuenta la clave de descuento.");
							$("#btn_ActualizarCarrito").trigger("click");
							
						}else{
							if( confirm("\u00BFTodos los datos son correctos?") )
							{							
								$.fancybox.showActivity();
								//$.ajaxSetup({async: false});
								
								if($("#tfh_TipoDesc").val() == 1)
								{
									$("#amountPP").val( $("#amountPP").val()*(1-($("#tfh_MontoDesc").val()/100)) );
								}
								else if($("#tfh_TipoDesc").val() == 2)
								{
									$("#amountPP").val($("#amountPP").val() -  $("#tfh_MontoDesc").val());
								}
								
								
								if(parseFloat($("#amountPP").val()) >= 50 && $str_TipoEnvio == "96hrs")
									$("#tfh_TipoEnvio").val(0);
								else if(parseFloat( $("#amountPP").val()) >= 100 && $str_TipoEnvio == "urgente")
								 	$("#tfh_TipoEnvio").val(0);
	
								//var $flo_TotalConEnvio = new Number( parseFloat($("#tfh_TipoPago").val()) + parseFloat($("#tfh_TipoEnvio").val()) + parseFloat( $("#amountPP").val()) );
								//var $flo_Envio         = new Number( parseFloat($("#tfh_TipoPago").val()) + parseFloat($("#tfh_TipoEnvio").val()) + parseFloat($("#shipping_1PP").val()) );
								
								var $flo_TotalConEnvio = new Number( parseFloat($("#tfh_TipoPago").val()) + parseFloat($("#tfh_TipoEnvio").val()) + parseFloat( $("#amountPP").val()) );
								var $flo_Envio         = new Number( parseFloat($("#tfh_TipoPago").val()) + parseFloat($("#tfh_TipoEnvio").val()) ); // + parseFloat($("#shipping_1PP").val()) );
													
								$("#amountPP").val( $flo_TotalConEnvio.toFixed(2) );
								$("#shipping_1PP").val( $flo_Envio.toFixed(2) );				
								
								//alert( "Shipping: " + $("#shipping_1PP").val() + " - Amount: " + $("#amountPP").val() );							
								
								$.post(_URL_CONTROLLERS+"controllerCart.php?"+$("#form_DatosEnvio").serialize(), {str_AccionCart:"guardarPedido", igualFact:$("#chk_DirIgualFacturacion").is(":checked"), totalEnvio:$("#shipping_1PP").val(), tipoPago:$str_TipoPago, tipoEnvio:$str_TipoEnvio, transaccion:$("#transaccion").val() }, function(resp)
								{
									//alert( "Recuerda CONFIRMAR TU PEDIDO para darle el seguimiento correcto. Viene el dato: " + $str_TipoPago );
									//alert($str_TipoPago);
									switch ($str_TipoPago) {
										case "tarjeta":
											$str_URLSubmit = _URL_TPV;
											$("#cn").val("tarjeta de credito");
											break;
										case "tarjeta_4B":
											$str_URLSubmit = _URL_TPV_4B;
											$("#cn").val("tarjeta de credito");
											break;
										case "transferencia":
											$str_URLSubmit = _URL_TRANFERENCIA;
											$("#cn").val("transferencia");
											break;
										case "contrareembolso":
											$str_URLSubmit = _URL_CONTRAREEMBOLSO;
											$("#cn").val("contrareembolso");
											break;
										case "paypal":
											$str_URLSubmit = _PAYPAL_CHECKOUT;
											$("#cn").val("paypal");
											break;
										default:
											$str_URLSubmit = _URL_CONTRAREEMBOLSO;
											$("#cn").val("contrareembolso");
										break;
									}
									
									//$.ajaxSetup({async: true});
									
									$("#form_Cart")
									.attr({"action":$str_URLSubmit})
									.submit();	
								});
							}
						}
					}else{
						alert("Es necesario llenar los campos marcados con *");
						$(".pasos_compra + .contenedor_pasos_compra").slideDown(300);
					}
				});
		
		// FancyBox para formulario +INFO
		$("#masinfo_error").hide();
		
		$("#btn_MasInfo").click(function()
		{
			$("a.mas-info-item").trigger("click");
		});
		
		$("#btn_Ingredientes").click(function()
		{
			$("a.fancy-ingredientes").trigger("click");
		});
		
		
		$("#div_Ingredientes").hide();
		
		$("a.fancy-ingredientes").fancybox({
			'scrolling': 'no',
			'titleShow': false,
			'height': 'auto',
			'onStart':function()
			{
				$("#div_Ingredientes").show();
			},
			'onClosed':function() 
			{
				$("#div_Ingredientes").hide();
			}
		});
		
		
		$("a.mas-info-item").fancybox({
			'scrolling'		: 'no',
			'titleShow'		: false,
			'onClosed'		: function() {
				$("#masinfo_error").hide();				
				$("#tfd_NombreMasInfo").val("");
				$("#tfd_EmailMasInfo").val("");
			}
		});
		
		
		$("#form_MasInfo").bind("submit", function() {

			//$ereg_Email = /^[_a-z0-9]+(.[_a-z0-9]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3,4})$/;  // \w+([-.]?\w+)*@\w+([-.]?\w+)*(\.\w(2,3,4))+
			
			/*$ereg_Email = /^[_a-z0-9]+(.[_a-z0-9]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3,4})$/; || !$ereg_Email.test($("#tfd_EmailMasInfo").val())*/
			
			if ( $("#tfd_NombreMasInfo").val().length < 1 || $("#tfd_EmailMasInfo").val().length < 1 )
			{
				//alert( $ereg_Email.test($("#tfd_EmailMasInfo").val()) );
				$("#masinfo_error").show();
				$.fancybox.resize();
				return false;
			}
		
			$.fancybox.showActivity();
			$.ajaxSetup({async: false});
		
			$.ajax({
				type	: "POST",
				cache	: false,
				url		: _URL_CONTROLLERS + "controllerCart.php",
				data	: $(this).serializeArray(),
				success : function(data) {
					$.ajaxSetup({async: true});
					$.fancybox(data);
				}
			});
		
			return false;
		});
		
		
		
		
		// Fancybox para solicitar recordar contraseña
		$("#div_RecuperarPsw").hide();
		
		$("a.recuperar-psw").fancybox({
			'scrolling': 'no',
			'titleShow': false,
			'width': 320,
			'height': 180,
			'onStart':function()
			{
				$("#div_RecuperarPsw").show();
			},
			'onClosed':function() 
			{
				$("#div_RecuperarPsw").hide();
				$("#tfd_Email").val("");
			}
		});
		
		
		$("#form_RecuperarPsw").bind("submit", function() 
		{			
			/*if ( $("#tfd_NombreMasInfo").val().length < 1 || $("#tfd_EmailMasInfo").val().length < 1 )
			{
				//alert( $ereg_Email.test($("#tfd_EmailMasInfo").val()) );
				$("#masinfo_error").show();
				$.fancybox.resize();
				return false;
			}*/
		
			$.fancybox.showActivity();
			$.ajaxSetup({async: false});
		
			$.ajax({
				type	: "POST",
				cache	: false,
				url		: _URL_CONTROLLERS + "controllerCart.php",
				data	: $(this).serializeArray(),
				success : function(data) {
					$.ajaxSetup({async: true});
					$.fancybox(data);
				}
			});
		
			return false;
		});
	
	
	
			$("#div_RegistroCliente").hide();
		
		$("a.registrarse").fancybox({
			'scrolling': 'yes',
			'titleShow': false,
			'width': 320,
			'height': 180,
			'onStart':function()
			{
				$("#div_RegistroCliente").show();
			},
			'onClosed':function() 
			{
				$("#div_RegistroCliente").hide();
				$("#tfd_Nombre").val("");
				$("#tfd_Apellidos").val("");
				$("#tfd_Email").val("");
				$("#tfd_Psw").val("");
				$("#tfd_NIF").val("");
				$("#tfd_Direccion").val("");
				$("#tfd_Poblacion").val("");
				$("#tfd_Provincia").val("");
				$("#tfd_CP").val("");
				$("#tfd_Telefono").val("");
				$("#NombreEnvio").val("");
				$("#ApellidosEnvio").val("");
				$("#EmailEnvio").val("");
				$("#DireccionEnvio").val("");
				$("#PoblacionEnvio").val("");
				$("#ProvinciaEnvio").val("");
				$("#CPEnvio").val("");
				$("#TelefonoEnvio").val("");
				
			}
		});
		
		
		/*******************************************/
		
		$("#chk_Acepto").click( function()
		{
			if($("#chk_Acepto").is(":checked"))
			{
				$("#btn_RegNvoCliente").removeAttr("disabled");
			}
			else
				$("#btn_RegNvoCliente").attr("disabled","disabled");	
		});
		
		
		$("#btn_RegNvoCliente").unbind("click").click(function()
		{	
			var $bol_DatosEnvio = true;
			
			$(".datos-cliente").each(function()
			{							
				if( $.trim( $(this).val() ) == "" )
					$bol_DatosEnvio = false;
			});
			
			if( $bol_DatosEnvio ) 
			{
				if( confirm("\u00BFEstas seguro de los datos?") )	
				{

				   $.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=RegistroCliente", 
				   $("#form_RegNvoClienteCompra").serialize(), 
				   function(resp)
				   { 
						arr_resp = resp.split(',');
						
						if(resp == "correoExist")
						{
							window.location.href = _URL_URI_BASE+"/?tipo=cart&str_View=cart&str_SeccionCart=correoExist";	
						}
						else if (arr_resp[0] == "confirmEmail")
						{
							window.location.href = _URL_URI_BASE+"/?tipo=cart&str_View=cart&str_SeccionCart=confirmEmail&Email="+arr_resp[1];
						}
						$.ajaxSetup({async: true});
						$.fancybox(resp);
						//$("#div_RegistroCliente").hide();
				   });
						
			  
					return false;
				}
				
			}else
				alert( "Es necesario llenar todos los campos para su direccion de envio!" )		
			

		});
		
		
		
		
		/**************CODIGO P/REG***********************/
		$("#chk_Acepto").click( function()
		{
			
			if($("#chk_Acepto").is(":checked"))
				$("#btn_Registrar").removeAttr("disabled");
			else
				$("#btn_Registrar").attr("disabled","disabled");	
		});
		
		$("#btn_Registrar").unbind("click").click(function()
		{	
			var $bol_DatosEnvio = true;
			
			$(".datos-cliente").each(function()
			{							
				if( $.trim( $(this).val() ) == "" )
					$bol_DatosEnvio = false;
			});
			
			if( $bol_DatosEnvio ) 
			{
				if( confirm("\u00BFEstas seguro de los datos?") )	
				{
				   
					 if($("#chk_DirIgualFacturacion").is(":checked") )
					 {
			   
						   $.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=RegistroCliente", 
						   $("#form_RegistroCliente").serialize(), 
						   function(resp)
						   { 
								//alert(resp);
								arr_resp = resp.split(',');
								
								if(resp == "correoExist")
								{
									window.location.href = _URL_URI_BASE+"/?tipo=cart&str_View=cart&str_SeccionCart=correoExist";	
								}
								else if (arr_resp[0] == "confirmEmail")
								{
									window.location.href = _URL_URI_BASE+"/?tipo=cart&str_View=cart&str_SeccionCart=confirmEmail&Email="+arr_resp[1];
								}
								$.ajaxSetup({async: true});
								$.fancybox(resp);
								$("#div_RegistroCliente").hide();
						   });
						
								
					  }else
					  {
						 
						   var $bol_DatosEnvio = true;
					
							$(".form-envio").each(function()
							{							
								if( $.trim( $(this).val() ) == "" )
									$bol_DatosEnvio = false;
							});
							
							if( $bol_DatosEnvio ) 
							{
								
							   $.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=RegistroCliente", 
							   $("#form_RegistroCliente").serialize(), 
							   function(resp)
							   { 
									//alert(resp);
									arr_resp = resp.split(',');
									
									if(resp == "correoExist")
									{
										window.location.href = _URL_URI_BASE+"/?tipo=cart&str_View=cart&str_SeccionCart=correoExist";	
									}
									else if (arr_resp[0] == "confirmEmail")
									{
										window.location.href = _URL_URI_BASE+"/?tipo=cart&str_View=cart&str_SeccionCart=confirmEmail&Email="+arr_resp[1];
									}
									$.ajaxSetup({async: true});
									$.fancybox(resp);
									$("#div_RegistroCliente").hide();
							   });	
								
							}else
								alert("Es necesario marcar la casilla de datos de envio o llenar los datos correspondientes");
					   }
					  
					return false;
				}
				
			}else
				alert( "Es necesario llenar todos los campos para su direccion de envio!" )		
			

		});
		
	
	
	
				
		// Fancy para la imagen detalle, Quienes somos y SKINCEUTICALS
		$(".fancy-detalle-item").fancybox({
			'titlePosition':'over',
			'onComplete':function() 
				{
					$("#fancybox-wrap").hover(function() {
						$("#fancybox-title").show();
					}, function() {
						$("#fancybox-title").hide();
					});
				}
		});
		
				
		// JQZoom para ampliar las imagenes
		$(".jqzoom").jqzoom({
			zoomWidth:530,
			zoomHeight:470,
			preloadText: "Cargando...",
			title: false
		});
		
		
		// Acciones para los forms de Datos de envio y Datos de Facturacion en panel del cliente
		$("#btn_DatosEnvio").unbind("click").click(function()
		{
			$.fancybox.showActivity();
			//$.ajaxSetup({async: false});
			
			$.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=GuardaDatosCliente", 
				   $("#form_DatosEnvio").serialize(), 
				   function(resp)
				   { 
				   		//alert(resp);
						//$.ajaxSetup({async: true});
						$.fancybox.hideActivity();
				   });
		});
		
		$("#btn_DatosFactura").unbind("click").click(function()
		{
			$.fancybox.showActivity();
			//$.ajaxSetup({async: false});
			
			$.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=GuardaDatosCliente", 
				   $("#form_DatosFactura").serialize(), 
				   function(resp)
				   { 
				   		//alert(resp);
					//	$.ajaxSetup({async: true});
				   		$.fancybox.hideActivity();
				   });
			
		});
		
		
		$(".nvos-datos").unbind("click").click( function ()
		 {
			$.fancybox.showActivity();
		//	$.ajaxSetup({async: false});
			
			$.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=GuardaDatosCliente", 
				   $("#form_DatosCliente").serialize(), 
				   function(resp)
				   { 
				   	//	alert(resp);
					//	$.ajaxSetup({async: true});
				   		$.fancybox.hideActivity();
				   });
		 });
		
		
		$(".nvos-datos-envio").unbind("click").click( function ()
		 {
			
			$.fancybox.showActivity();
			//$.ajaxSetup({async: false});
			
			$.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=GuardaDatosCliente", 
				   $("#form_DatosEnvioCliente").serialize(), 
				   function(resp)
				   { 
				   	//	alert(resp);
					//	$.ajaxSetup({async: true});
				   		$.fancybox.hideActivity();
				   });
		 });
		
		
		
		$("#btn_EnviarEmail").click(function ()
		{
			$.post(_URL_CONTROLLERS+"controllerCart.php?str_AccionCart=ActualizarEmail", 
			   $("#form_NvoEmail").serialize(), 
			   function(resp)
			   { 
					alert(resp);
				
			   });
		});
		
		
		//////////////////////////////////////////////////
		//
		//	Clase de Titulos en Quienes Somos
		//
		//////////////////////////////////////////////////
		
		$("a.titulos-pdf")
		.click(function()
		{			
			if($.browser.msie)
			{
				window.open( "./files/pdfs/"+this.name+".pdf", "_blank", "menubar=0,location=0,directories=0,status=0,titlebar=0,toolbar=0,width=800,height=600,resizable=1" );
				
				/*myWIN = window.open( "", "", "menubar=0,location=0,directories=0,status=0,titlebar=0,toolbar=0,width=800,height=600,resizable=1" );
				myWIN.document.write('<a href="./files/pdfs/'+this.name+'.pdf" target="_self" style="text-decoration:none; font:12px \'Trebuchet MS\'; color:#333"><img src="./imgs/download.png" alt="Descargar reporte" width="25" height="25" border="0" align="absmiddle" title="Descargar reporte" /> Ver informe</a>');
				myWIN.focus();*/
			}
			// En caso de cualquier explorador diferente a IE
			else
				window.open( "./files/pdfs/"+this.name+".pdf", "_blank", "menubar=0,location=0,directories=0,status=0,titlebar=0,toolbar=0,width=800,height=600,resizable=1" );
				
			return false;
		});
		
		
		// Info tallas //
		
		/*$(".content-img-tallas").each( function()
		{*/
			$('.content-img-tallas').hover(
			 function () 
			 {
				$("#div_Tallas").show();
			  }, 
			  function () {
				$("#div_Tallas").hide();
			  }
			);	
			
			$('.content-img-tallas-zap').hover(
			 function () 
			 {
				$("#div_Tallas_zap").show();
			  }, 
			  function () {
				$("#div_Tallas_zap").hide();
			  }
			);	
	//	});
		
	/*	$('#content').hover(
			 function () 
			 {
				$("#div_Tallas").show();
			  }, 
			  function () {
				$("#div_Tallas").hide();
			  }
			);*/
	
		///////////////////////////////////////////
		//
		//	Tomar el valor de tallas en detalle de item
		//
		//////////////////////////////////////////
		
		$(".tallas").each( function()
		{			
			$("#thf_Talla").val($("#sel_Tallas").val());
			$(".tallas").change( function()
			{
				$("#thf_Talla").val($("#sel_Tallas").val());
			});
			
		});
		
		
		/**
		 *	
		*/
		
		$("#form_LogginClientesImgs").bind("submit", function() {

			if ( $("#tfd_Email", $(this)).val().length < 1 || $("#tfd_Psw", $(this)).val().length < 1 )
			{
				$("#div_Error", $(this)).show();
				//$.fancybox.resize();
				return false;
			}
			
			$("#div_Error", $(this)).hide();
			
			$.fancybox.showActivity();
		
			$.ajax({
				type	: "POST",
				cache	: false,
				url		: "/old/admin/imgsClientes.php",
				data	: $(this).serializeArray(),
				success : function(data) {
					if( data == "0" || parseInt(data) == 0 )
					{
						$("#imgs_cls_fancy").hide();
						$.fancybox.hideActivity();
						
						alert("Datos incorrectos");
						
						//$.fancybox('<div id="div_Error"><strong>&iexcl;ERROR!</strong> Los datos son incorrectos.</div>');
					}else
					{
						$.fancybox(data);
						$("#imgs_cls_fancy").show();
					}
				}
			});
		
			return false;
		});
		
		
		// Efecto circle
		$('#div_circle').cycle
		({ 
			fx:     'scrollDown', 
			easing: 'easeOutBounce', 
			delay:  -2000 
		});
	
	}); // Fin: $(function(){...});
	
	
	EliminarFavorito = function(int_Id)
	{
		//icon-borrar-archivo	
		if( confirm("\u00BF Estas seguro de eliminar este registro de tus favoritos ?") )
		{

			$.fancybox.showActivity();
			var int_Id;
			$.post(_URL_CONTROLLERS+ 'controllerABM.php?str_Accion=borrarFavorito',{int_Id:int_Id}, function( resp )
			{
				alert(resp);
				$("#cl_fav_"+int_Id).remove();
				$.fancybox.hideActivity();
			});		
		}else
		return false;
	}
	
	
	/**
	 * Carga items de sugerencias.
	*/
	
	itemsLoadSugerencias = function(carousel, state)
	{		
		traerItems(carousel, 'sugerencias');
	};
	
	
	/**
	 * Carga items de mas vistos.
	*/
	
	itemsLoadMasVistos = function(carousel, state)
	{				
		traerItems(carousel, 'masvistos');
	};
	
	
	/**
	 * Carga items de vistos recientes.
	*/
	
	itemsLoadVistosRecientes = function(carousel, state)
	{				
		traerItems(carousel, 'vistosrecientes');
	};
	
	
	/**
	 *	trearItems(carousel, $str_Tipo);
	 *
	 *	"Carga por POST y agrega los elementos que se presentaran en los JCarouseles."
	 *
	 *	@usage traerItems(objJC, 'vistosrecientes');
	 *	@access public
	 *	@param {object} objJC: Objeto JCarousel.
	 *	@param {string} $str_Tipo: Cadena TIPO que se evalua en 'controllerCarruseles.php'.
	 *	@return {void|false} En caso de mostrarse los mismos elementos no se hace peticion. Y se encarga de agregar elementos al carrusel que se indica.
	*/
	
	traerItems = function(carousel, $str_Tipo)
	{	
		// Varificar si exiten ya items
		if ( carousel.has(carousel.first, carousel.last) ) 
			return;
			
		$.post(
			'controllers/controllerCarruseles.php?str_Tipo='+$str_Tipo+'&tfh_Busqueda='+$("#tfh_Busqueda").val()+'&tfh_Categoria='+$("#tfh_Categoria").val(),
			{first: carousel.first,	last: carousel.last},
			function(xml){ itemAdd(carousel, carousel.first, carousel.last, xml); },
			'xml'
		);
	}
	
	
	/**
	 *	itemAdd(carousel, first, last, xml);
	 *
	 *	"Agrega items al carrusel."
	 *
	 *	@usage itemAdd(objJC, objJC.first, objJC.last, 'datos.xml');
	 *	@access public
	 *	@param {object} carousel: Elemento JCarousel.
	 *	@param {int} first: La primera posicion del JC, solo de los elementos que se estan mostrando.
	 *	@param {int} last: La primera posicion del JC, solo de los elementos que se estan mostrando.
	 *	@param {archivo XML} xml: ��... pues eso, un archivo xml.
	 *	@return void. Solo actualiza el objeto JCarousel.
	*/	
	
	itemAdd = function(carousel, first, last, xml)
	{
		// Dar largo al carrusel desde el nodo TOTAL del documento XML...
		carousel.size( parseInt( $('total', xml).text() ) );
	
		// Para cada nodo ELEMENTO dentro del documento XML hacer...
		$('elemento', xml).each(function(i) 
		{	
			//alert( $(this).find('img').text() +"-"+ $(this).find("desc").text() +"-"+ $(this).find("precio").text() );
			carousel.add(first + i, getItemHTML({ categoria:$(this).find('Categoria').text(),id:$(this).find('id').text(), titulo:$(this).find('titulo').text(), img:$(this).find('img').text(), desc:$(this).find("desc").text(), precio:$(this).find("precio").text() }) );
		});
	};
	
	
	/**
	 *	getItemHTML($str_Img, $str_Desc);
	 *
	 *	"Crea un item HTML para los JCarruseles."
	 *
	 *	@usage getItemHTML('../imgs/gato.jpg', 'Gato de Angora.');
	 *	@access public
	 *	@param {string} $str_Img: PATH de la imagen a mostrar.
	 *	@param {string} $str_Desc: Descripcion del elemento.
	 *	@return {string|HTML} Cadena de HTML que forma un elemento para los JCarruseles.
	*/
	 
	getItemHTML = function( $obj_Elemento )
	{
		var $str_Elemento = '';
		
		/*$str_Elemento += '<div class="item-jc">';
		$str_Elemento += 	'<a href="?int_IdItem='+$obj_Elemento.id+'&str_View=detalleItem&tipo=DetalleItem&sel_Categorias='+$obj_Elemento.categoria+'" title="' + $obj_Elemento.titulo + '">';
		$str_Elemento += 		'<img src="' + $obj_Elemento.img + '" alt="' + $obj_Elemento.titulo + '" title="' + $obj_Elemento.titulo + '" />';
		$str_Elemento += 		'<div class="item-titulo">' + $obj_Elemento.titulo + '</div>';		
		$str_Elemento += 	'</a>';
		$str_Elemento += 	'<div class="item-desc">' + (($obj_Elemento.desc.toString().length <= 25)?$obj_Elemento.desc:$obj_Elemento.desc.substr(0, 24)+'<a href="?int_IdItem='+$obj_Elemento.id+'&str_View=detalleItem&tipo=DetalleItem&sel_Categorias='+$obj_Elemento.categoria+'" title="' + $obj_Elemento.titulo + '">[...]</a>') + '</div>';
		$str_Elemento += 	'<div class="item-precio">' + $obj_Elemento.precio + '</div>';
		$str_Elemento += '</div>';*/		
		
		$str_Elemento += '<a href="?int_IdItem='+$obj_Elemento.id+'&str_View=detalleItem&tipo=DetalleItem&sel_Categorias='+$obj_Elemento.categoria+'"><img src="' + $obj_Elemento.img + '" alt="' + $obj_Elemento.titulo + '" title="' + $obj_Elemento.titulo + '" /></a>';
		$str_Elemento += '<p>'+(($obj_Elemento.desc.toString().length <= 25)?$obj_Elemento.desc:$obj_Elemento.desc.substr(0, 60)+'<a href="?int_IdItem='+$obj_Elemento.id+'&str_View=detalleItem&tipo=DetalleItem&sel_Categorias='+$obj_Elemento.categoria+'" title="' + $obj_Elemento.titulo + '">[...]</a>')+'</p>';
		$str_Elemento += '<div>' + $obj_Elemento.precio + '</div>';
		$str_Elemento += '<table cellpadding="0" cellspacing="0" border="0">';
		$str_Elemento += '<tr>'
		$str_Elemento += '<td><a href="?int_IdItem='+$obj_Elemento.id+'&str_View=detalleItem&tipo=DetalleItem&sel_Categorias='+$obj_Elemento.categoria+'">ver</a></td>';
		$str_Elemento += '<td class="right"><a href="?int_IdItem='+$obj_Elemento.id+'&str_View=detalleItem&tipo=DetalleItem&sel_Categorias='+$obj_Elemento.categoria+'">comprar</a></td>';
		$str_Elemento += '</tr>';
		$str_Elemento += '</table>';		
		
		return $str_Elemento;
	};
	
	
	/**
	 *	checkoutPP();
	 *	
	 *	"Se encarga de enviar los items del carrito a Paypal."
	 *
	 *	@usage checkoutPP();
	 *	@access public
	 *	@return void
	*/
	
	checkoutPP = function( form_Cart )
	{				
		form_Cart.action = _UPDATE_CART;
		form_Cart.submit();
	}
	
$.ajaxSetup({async: false});

