function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}
// end of function CurrencyFormatted()



var machote = '<div id="producto">\n';
machote += '<img src="ed_imagen_listado" border="0" align="left" alt="ed_nombre" />\n';
machote += '<ul>\n';
machote += '<li>ed_nombre</li>\n';
machote += '<li>ed_clave</li>\n';
machote += '<li>ed_descripcion</li>\n';
machote += '<li>Price: $ed_precio usd.</li>\n';
machote += '<li><a href="javascript:popUp(\'ed_imagen_grande\',\'ed_nombre\')"><img src="/img/botones/enlargedview.gif" width="114" height="23" border="0" alt="Enlarged View" /></a></li>\n';
machote += '<li>\n';

//parte de ppal
machote += '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">\n';
machote += '<input type="image" src="/img/botones/addtocart.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!" onClick="javascript: pageTracker._trackPageview(\'/paypal.com\');">\n';
machote += '<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">\n';
machote += '<input type="hidden" name="add" value="1">\n';
machote += '<input type="hidden" name="cmd" value="_cart">\n';
machote += '<input type="hidden" name="business" value="katscents@aol.com">\n';
machote += '<input type="hidden" name="item_name" value="ed_nombre ed_descripcion">\n';
machote += '<input type="hidden" name="item_number" value="ed_clave">\n';
machote += '<input type="hidden" name="amount" value="ed_precio">\n';
machote += '<input type="hidden" name="no_shipping" value="0">\n';
machote += '<input type="hidden" name="no_note" value="1">\n';
machote += '<input type="hidden" name="currency_code" value="USD">\n';
machote += '<input type="hidden" name="lc" value="US">\n';
machote += '<input type="hidden" name="bn" value="PP-ShopCartBF">\n';
machote += '</form>\n';

machote += '</li>\n';
machote += '</ul>\n';
machote += '</div>\n';
var txt = '';

$(document).ready(function() {;
	if (lapagina.length>0){

//    $.getJSON("",

		var i = 0;
		var bol = false;
		var products = xyz["Seajewels_Products"];

		//ordenamos el arreglo
		products.sort(function (obj1, obj2) {
			return obj1.Clave < obj2.Clave ? -1 :
			(obj1.Clave > obj2.Clave ? 1 : 0);
		});

		while(products[i]){
			var j = 0;
			while(products[i].Paginas[j]){
				if (products[i].Paginas[j]==lapagina){
					bol=true;					
				}
				j++;
			}
			if(bol){
				txt = machote;
				txt = txt.replace(/ed_nombre/,products[i].Nombre);
				txt = txt.replace(/ed_nombre/,products[i].Nombre);
				txt = txt.replace(/ed_nombre/,products[i].Nombre);
				txt = txt.replace(/ed_nombre/,products[i].Nombre);

				txt = txt.replace(/ed_imagen_grande/,products[i].Imagen_Grande);
				txt = txt.replace(/ed_imagen_grande/,products[i].Imagen_Grande);

				txt = txt.replace(/ed_clave/,products[i].Clave);
				txt = txt.replace(/ed_clave/,products[i].Clave);

				txt = txt.replace(/ed_imagen_listado/,products[i].Imagen_del_Listado);
				txt = txt.replace(/ed_imagen_listado/,products[i].Imagen_del_Listado);

				txt = txt.replace(/ed_descripcion/,products[i].Descripcion);
				txt = txt.replace(/ed_descripcion/,products[i].Descripcion);
				

				txt = txt.replace(/ed_precio/,CurrencyFormatted(products[i].Precio));
				txt = txt.replace(/ed_precio/,CurrencyFormatted(products[i].Precio));

				writit(txt,'productos');
				bol = false;
			}
			i++;
		}
	
}
 });
	function writit(text,id){
		if (document.getElementById){
			x = document.getElementById(id);
//			x.innerHTML = '';
			x.innerHTML += text;
		}
		else if (document.all){
//			x = document.all[id];
			x.innerHTML += text;
		}
		else if (document.layers){
			x = document.layers[id];
			text2 = '<P CLASS="testclass">' + text + '</P>';
			x.document.open();
			x.document.write(text2);
			x.document.close();
		}
	}



	// Script Source: CodeLifter.com
	// Copyright 2003
	// Do not remove this notice.

	// SETUPS:
	// ===============================

	// Set the horizontal and vertical position for the popup

	PositionX = 100;
	PositionY = 100;

	// Set these value approximately 20 pixels greater than the
	// size of the largest image to be used (needed for Netscape)

	defaultWidth  = 500;
	defaultHeight = 500;

	// Set autoclose true to have the window close automatically
	// Set autoclose false to allow multiple popup windows

	var AutoClose = true;

function popUp(imgURL,imageTitle) {
/*	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=410,height=310,left = 435,top = 245');");
	*/

	// Do not edit below this line...
	// ================================
	if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
	var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
	writeln('width=300-(document.body.clientWidth-document.images[0].width);');
	writeln('height=300-(document.body.clientHeight-document.images[0].height);');
	writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
	if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
	else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	writeln('<img name="George" src='+imgURL+' style="display:block"></body></html>');
	close();
	}
}