var discount_flag=0;
var print_id = 0;
var orig_id = 0;

/* Begin function for setting up buy button code for Mary-Clare's prints - arg 1 is title of piece, arg 2 is for url name (unused at present)
	arg 3 is the Shopping basket code 
	arg 4 is discount code (D or N) - passed from enlargement pages only 
	the main page uses dhtml (on submission of a valid password) to change prices dynamically */ 
function new_print_buy_buttons(print_title,url_name,basket_code,discount_code)
{
print_id += 1;
var uf_price = 40;
var code_suffix = '';
if (discount_code == 'D')
	{
	uf_price = 30;
	code_suffix = '-D';
	}
document.write('<span style="font-size:6pt;"><br /><br /></span>');
document.write('print - &pound;<span id="print_price'
	+ print_id +
	'">' 
	+ uf_price +
	'</span><a target="_blank" id="print_add_link'
	+ print_id +
	'" class="add" href="http://www.romancart.com/cart.asp?storeid=16119&itemcode=ART-MCB-' 
	+ basket_code + 
	'-U'
	+ code_suffix +
	'" title="click here to add a print of \''
	 + print_title +
	'\' to your Shopping Basket - you can remove it later if you change your mind">Add to basket</a>');
}
/* END */

/* Begin function for setting up buy button code for Mary-Clare's prints - arg 1 is title of piece, arg 2 is for url name (unused at present) 
	arg 3 is the Shopping basket code
	arg 4 is price 
	arg 5 is discount code (D, DF, N, NF, DU or NU) - passed from enlargement pages only 
	the main page uses dhtml (on submission of a valid password) to change prices dynamically */ 
function new_orig_buy_button(orig_title,url_name,basket_code,price,discount_code)
{
var code_suffix = '';
var code_presuffix = '-O';
if ((discount_code == 'DF') || (discount_code == 'NF'))
	{
	code_presuffix = '-FO';
	}
if ((discount_code == 'DU') || (discount_code == 'NU'))
	{
	code_presuffix = '-UO';
	}
if ((discount_code == 'D') || (discount_code == 'DF') || (discount_code == 'DU'))
	{
	code_suffix = '-D';
	}
document.write('<span style="font-size:6pt;"><br /><br /></span>');
document.write('The original of this piece is also available:<br />')  
document.write('original - &pound;<span id="'
	+ basket_code +
	'_price">'  
	+ price +
	'</span><a target="_blank" class="add" href="http://www.romancart.com/cart.asp?storeid=16119&itemcode=ART-MCB-' 
	+ basket_code  
	+ code_presuffix 
	+ code_suffix +
	'" title="click here to add the original of \''
	 + orig_title +
	'\' to your Shopping Basket - you can remove it later if you change your mind">Add to basket</a>');
}
/* END */

/* begin function for validating customer discount password form and making dhtml changes if its valid */
function validate_customer_form()
{
if (document.customer_discount_form.password.value.toLowerCase() == 'email2006')
	{
	discount_flag = 1;
	for (var i=0; i<document.links.length; i++)
		{
		if ((document.links[i].search.indexOf('itemcode')>-1) && (document.links[i].search.indexOf('U',document.links[i].search.length-1)>-1))
			{
			document.links[i].href += '-D'	
			}
		if (document.links[i].search.indexOf('id=0')>-1)
			{
			document.links[i].search = '?id=1'	
			}
		}
	for (var i=1; i<=print_id; i++)
		{
		var spanid = 'print_price' + i;
		var spantochange = new getObj(spanid);
		spantochange.obj.innerHTML = '30';
		}
	var divtochange = new getObj('custbox1div');
	divtochange.obj.innerHTML = '<b>Thanks - the prices now show your special discounts.<p>We look forward to your order!</p>';
	}
else
	{alert('that password is incorrect - please try again');}
}
