
//function to get data from form
function addProduct (super_product_id) {
	
	//------------------------------------------------------------------------------
	// THE FOLLOWING LINES WILL LAUNCH THE SHOP-CLOSED POPUP WHEN ADDING TO BASKET
	
		//display alert
			alert("Sorry online shopping is currently suspended");
	
		//display shop closed popup
			shopClosedPopup();
	
		//prematurely exit function
			return;
	
	
	//------------------------------------------------------------------------------
	
	
	
	
	
	
	
	
	//extract data from form
	var frm = eval('document.frmBuyProduct_' + super_product_id);

		
		//if selection not made then don't submit form
	if (frm.product_id.value == 'null') {
		window.alert ('Please select required attributes');
		return
	}
		
	
	//check to see if product is sold out
	var is_sold_out = parseInt(frm.is_sold_out.value);
	if (is_sold_out == -1) {
		window.alert('The product you have selected is currently sold out');
	}
	else {
		frm.submit();
	}
	
}


//function to open product details pop up
//takes arg of super_product_id and view type, and vars from main page of product_line id and base path info
function viewProduct (super_product_id, view_type, product_id) {
	
	//set width and heights for popup
	var win_width=462;
	var win_height=550;
	
	//determine x y pos of centered window base on width and height
	//called from general_functions.js
	var win_pos = getWinXY(win_width,win_height);
	
	//window.alert(product_id)
	if (!product_id) product_id = 0;
	
	var the_url = base_path + 'view_product_details.asp?super_product_id=' + super_product_id + '&product_line_id=' + product_line_id + '&view_type=' + view_type + '&product_id=' + product_id;
	
	//open window
	if (document.layers) the_url = (base_path + 'ns47_jump.asp?the_url=' + escape(the_url));
	
	window.open(the_url,'product_details','width='+win_width+',height=' + win_height + win_pos + ',scrollbars=no,resizable=no');
	
}


//function to switch add to basket button on
function lightBasket(lyr_ref,form_ref,img_ref) {
	
	//get ref to form
	var frm = eval(lyr_ref + 'document.frmBuyProduct_' + form_ref);
	
	//get current sold out status
	//window.alert(frm.sold_out_status.value);
	var sold_out_array = frm.sold_out_status.value.split(',');	//turn string into array
	var crnt_item_status = sold_out_array[(frm.select_attribute.selectedIndex - 1)];	//get current item value
	frm.is_sold_out.value = parseInt(crnt_item_status);	//set is sold out status
	//window.alert(crnt_item_status);
	if (crnt_item_status == -1) {
		window.alert('The product you have selected is currently sold out');
	}
	else if (frm.select_attribute[frm.select_attribute.selectedIndex].value != 'null') {
		eval(lyr_ref + 'document.images.add_to_basket' + img_ref + '.src = "images/add_to_basket_on.gif"');
	}
	
}


//function to pop up call for delivery info box
function popCallForDelivery() {
	
	//set width and heights for popup
	var win_width=460;
	var win_height=435;
	
	//determine x y pos of centered window base on width and height
	//called from general_functions.js
	var win_pos = getWinXY(win_width,win_height);
	
	//open window
	window.open('call_for_delivery.asp','call_for_delivery','width='+win_width+',height=' + win_height + win_pos + ',scrollbars=no,resizable=no');

}
