function OpenWindow(url, width, height, scroll, resize) {
	win = window.open(url,'new','top=0,left=100,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+width+',height='+height);
	return win;
}

function OpenImage(url, width, height, scroll, resize, title) {
	win = window.open('_blank','new','top=0,left=0,toolbar=no,location=no,status=no,menubar=no,scrollbars=scroll,resizable=resize,width='+width+',height='+height);
	win.document.write('<html><head><title>'+title+'</title></head><body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"><a href="#" onclick="window.close();"><img src='+url+' alt="'+title+'" border="0"></body></html>');
	return false;
}

var tgs = new Array( 'div','td','tr','a','p', 'font');
function textzoom( trgt,sz ) {
	if (!document.getElementById) return
	var d = document,cEl = null,i,j,cTags;
	
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = sz;

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = sz; //szs[ sz ];
	}
}

function buyNow(bookID) {
	$('#'+bookID).html("Now adding your book to the cart <img src=\"/images/design/loading.gif\" width=\"16\" height=\"16\" alt=\"spinning\" />");
	$.get(
		"/cart/buy/",
		{param:bookID},
		function(data) { 
			if (data == 'OK') {
				$('#'+bookID).html("Your book has been added to the cart. <a href=\"/cart/view/\" class=\"more\">View the cart here</a>");
			}
		}
	);
}

function preorderNow(bookID) {
	$('#'+bookID).html("Adding to your wishlist <img src=\"/images/design/loading.gif\" width=\"16\" height=\"16\">");
	$.get(
		"/cart/preorder/",
		{param:bookID},
		function(data) { 
			if (data == 'OK') {
				$('#'+bookID).html("Added to your wishlist");
			}
		}
	);
}
