jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);  
      }; 
$(document).ready(function(){
        $(document).pngFix(); 
		
if (product == "yes") {
$('#bigone').lightBox(); 

$('#menos').click( function() {
		if ($('#quantity').val() == 1) {
			return false;
		} 
		$('#quantity').val(parseInt($('#quantity').val())-parseInt(1));
		return true;
		});
		
$('#mas').click( function() {
		$('#quantity').val(parseInt($('#quantity').val())+parseInt(1));
		return true;
		});
						   }
	$('A[rel="deleteCart"]').click( function() {
		$("#totalprice").load("/delete.php?id="+$(this).attr( 'title' ),false,function(responseText){
	   if (responseText == 'no') {
		   $("#totalprice").html("0 &euro;");
		   $().ajaxStop($.unblockUI);
			$.blockUI();
		  $("#col_der").load("/show.php?tipo=1");												   
	  }
		});

		$("#"+$(this).attr( 'title' )).hide(400);
		return false;
	});
	$("#clearCart").click( function () {
		$.blockUI();
		$("#totalprice").load("/delete.php?tipo=1",false,function(responseText){
		   $("#totalprice").html("0 &euro;");
			
		  $("#col_der").load("/show.php?tipo=2",false,function() {
			$.unblockUI();
															   });
		});
	});
	$("#tipo1").click( function() {
		/* Empresa */					   
		value = $("#nombre").val();
		string = $("#persona").html();
		/* Persona de contacto */
		value1 = $("#apellido").val();
		string1 = $("#ape").html();
		/* NIF */
		value2 = $("#nif").val();
		string2 = $("#nifChange").html();
				$("#persona").html(string.replace("Empresa","Nombre"));
				$("#ape").html(string1.replace("Persona de contacto","Apellidos"));
				$("#nifChange").html(string2.replace("CIF","NIF"));		
		
		$("#nombre").val(value);
		$("#apellido").val(value1);
		$("#nif").val(value2);
	});
	$("#tipo").click( function() {
		/* Empresa */					   
		value = $("#nombre").val();
		string = $("#persona").html();
		/* Persona de contacto */
		value1 = $("#apellido").val();
		string1 = $("#ape").html();
		/* NIF */
		value2 = $("#nif").val();
		string2 = $("#nifChange").html();							   
				$("#persona").html(string.replace("Nombre","Empresa"));
				$("#ape").html(string1.replace("Apellidos","Persona de contacto"));
				$("#nifChange").html(string2.replace("NIF","CIF"));		
		$("#nombre").val(value);
		$("#apellido").val(value1);
		$("#nif").val(value2);
							   });
	
	$("#mismo").click( function() {
	$("#s_destinatario").val($("#nombre").val()+" "+$("#apellido").val());
	$("#s_telefono").val($("#telefono").val());	
	$("#s_direccion").val($("#direccion").val());
	$("#s_cp").val($("#cp").val());
	$("#s_ciudad").val($("#ciudad").val());
	$("#s_provincia").val($("#provincia").val());
	$("#displaying").hide();
								});
	$("#mismo1").click( function() {
	$("#s_destinatario").val("");
	$("#s_telefono").val("");	
	$("#s_direccion").val("");
	$("#s_cp").val("");
	$("#s_ciudad").val("");
	$("#s_provincia").val("");
	$("#displaying").show();
								});

});

function Change(id) {
	if (id == prin) {
		return false;
	}
	$("#div-"+id).css({fontWeight:"bold"});
	$("#div-"+prin).css({fontWeight:""});
	$("#hide-"+id).show();
	$("#hide-"+prin).hide();
	prin = id;
}

function SetColor(id,color,rgb) {
	$("#color-"+id).css({backgroundColor: 'rgb('+rgb+')'});
	document.getElementById(id).value = color;		
	return false;
}
function SetBackground(color) {
	document.getElementById("background").value = color;
	return;
}
function Abrir(file) {
 window.open(file, "popup_id", "scrollbars,resizable,width=730,height=600");
 return false;
}
function resizeIframe(iframeID) {
if(self==parent) return false; /* Checks that page is in iframe. */
else if(document.getElementById&&document.all) /* Sniffs for IE5+.*/

var FramePageHeight = framePage.scrollHeight + 10; /* framePage
is the ID of the framed page's BODY tag. The added 10 pixels prevent an
unnecessary scrollbar. */

parent.document.getElementById(iframeID).style.height=FramePageHeight;
/* "iframeID" is the ID of the inline frame in the parent page. */
} 

