function show_digibrochure()
{
	Lightview.show({
						/*href: 'http://www.luminati.co.uk/digibrochure/',*/
						href: 'http://www.luminati.co.uk/luminati-brochure.pdf',
						options: 
						{
							width:800,
							height: 600,
							closeButton: 'large',
							menubar: 'bottom'
						}
				   });
}

function continue_shopping()
{
	// hide the lightbox first
	Lightview.hide();
	
	// then refresh the current page
	refresh();
}

function refresh()
{
    window.location.reload(false);
}

function pass_item()
{	
	// get the id
	var theID_field = window.frames[(window.frames.length-1)].document.getElementById('sc_product_number');
		
	var theID = theID_field.value;
	
	// add the item to the cart
	cart_add_item(theID);
}

function buy_item(node)
{
	Lightview.show({
						href: '/get_product_options.php?n=' + encodeURIComponent(node),
						options: 
						{
							width: 525,
							height: 220,
							closeButton: false
						}
				   });
}

function cart_add_item(id)
{
	if ((xml_request.readyState == 4) || (xml_request.readyState == 0))
	{
		if(id == undefined)
		{
			// get the id
			var theID_field = document.getElementById('sc_product_number');
				
			var theID = theID_field.value;
			
			// get the amount of cards selected
			if(document.getElementById('sc_product_quantity'))
			{
				var amount_field = document.getElementById('sc_product_quantity');
				var amount = amount_field.value;
			}
			else
			{
				var amount = 1;
			}
		}
		else
		{
			var amount = 1;
			
			var theID = id;
		}
		
		var post_variables = "sc_product_number=" + encodeURIComponent(theID) + "&sc_product_quantity=" + encodeURIComponent(amount);

		xml_request.open("POST", "/shopping_cart_add_item.php", true);
		xml_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xml_request.onreadystatechange = card_add_item_response;
		xml_request.send(post_variables);
	}
}

function card_add_item_response()
{
	// find the summary cart
	if(xml_request.readyState == 4)
	{
		var doc = xml_request.responseXML;
		
		var response = doc.getElementsByTagName('response')[0].firstChild.nodeValue;
		
		var message = doc.getElementsByTagName('message')[0].firstChild.nodeValue;
		
		if(doc == null || response == 'Fail')
		{			
			Lightview.show({
								href: '/add_error.php?m=' + encodeURIComponent(message) + '&t=' + encodeURIComponent(response),
								options: 
								{
									width: 522,
									height: 170,
									closeButton: false
								}
						   });
		}
		else if(response == 'Success')
		{
			var groupref = doc.getElementsByTagName('group_ref')[0].firstChild.nodeValue;
			
			Lightview.show({
								href: '/added_to_basket.php?m=' + encodeURIComponent(message) + '&t=' + encodeURIComponent(response) + '&gr=' + encodeURIComponent(groupref),
								options: 
								{
									width: 525,
									height: 200,
									closeButton: false
								}
						   });
		}
	}
}
