
/*===============================================================================
	neshuiShop.js
	John Larson
	5/07/08
	
	All page-specific JavaScript for neshuiShop.asp

===============================================================================*/


window.addEvent('domready', function() {
	
	$$('.productImage').each(function(theImage, index) {
		theImage.addEvent('click', function() {
			$('productImagePopUp' + index).style.display = 'block';
		});
	});
	
});


	function closeProductImagePopUp(index) {
		Effect.Fade('productImagePopUp' + index);
//		$('productImagePopUp' + index).style.display = 'none';
	}


/****************************************************************************
//	SECTION::Buy Now Handling
*/
	
	function prepCartInputs() {
		var productIndex = 0;
		var isEmptyOrder = true;
		$ES('.quantityInput', 'shopForm').each(function(theQuantityInput, index) {
			dbug.log(index + ' : ' + theQuantityInput.value);
			if(parseInt(theQuantityInput.value) > 0) {
				
				isEmptyOrder = false;
				
				// This item is desired!  Create a new valid cart item for PayPal:
				productIndex++;
				
				$('quantity_'    + productIndex).name  = 'quantity_' + productIndex;
				$('quantity_'    + productIndex).value = theQuantityInput.value;
				
				$('item_name_'   + productIndex).name  = 'item_name_' + productIndex;
				$('item_name_'   + productIndex).value = $('productName_' + index).value;
				
				$('item_number_' + productIndex).name  = 'item_number_' + productIndex;
				$('item_number_' + productIndex).value = 'Neshui00' + (index+1);
				
				$('amount_'      + productIndex).name  = 'amount_' + productIndex;
				$('amount_'      + productIndex).value = $('price_' + index).value;
			}
		});
		
		if(isEmptyOrder) {
			alert('You must indicate at least 1 non-zero quantity item you wish to purchase.');
			return false;
		}
	}
	
        
/*
//	End SECTION::Buy Now Handling
****************************************************************************/