	var sc_File			= SUB_FOLDER+'/shoppingcart.php';
	var docReady        = false;
	var currentBoxOpen	= 0;
	var boxId			= '';
	var prodPrev		= '';
	var prodInfo		= '';
	var prodSpeed		= 500;
	$(document).ready(function(){
		docReady = true;
		$("a.prodSlideLink").click(function(){
			boxId		= $(this).attr('name');
			prodPrev	= '#prod-prev-'+boxId;
			prodInfo	= '#prod-info-'+boxId;
			if ( currentBoxOpen != prodInfo && currentBoxOpen > 0) {
				var oldPrev	= '#prod-prev-'+currentBoxOpen;
				var oldInfo	= '#prod-info-'+currentBoxOpen;
				$(oldInfo).slideUp(prodSpeed,"easeInOutCirc");
				$(oldPrev).slideDown(prodSpeed,"easeInOutCirc");
			}
			slideProds();
		});

		//sc_Content();
	});



	function slideProds()
	{
		if ( $(prodInfo).css('display') == 'block' ) {
			$(prodInfo).slideUp(prodSpeed,"easeInOutCirc");
			$(prodPrev).slideDown(prodSpeed,"easeInOutCirc");
			currentBoxOpen = 0;
		} else {
			$(prodPrev).slideUp(prodSpeed,"easeInOutCirc");
			$(prodInfo).slideDown(prodSpeed,"easeInOutCirc");
			currentBoxOpen = boxId;
		}
	}

	function debug( text )
	{
		$("#debug").append( text+'<br />' );
	}

	function sc_AddItem( cpid )
	{
		var values  = 'do=addItem';
		values += '&cpid='+cpid;
		$.ajax({type: "POST",
				url: sc_File,
				data: unique()+'&'+values,
				success: function( html ){
					sc_Content();
				}
		});

	}

	function sc_RemoveItem( orderItemId )
	{
		var values  = 'do=removeItem';
		values += '&cpid='+orderItemId;
		$.ajax({type: "POST",
				url: sc_File,
				data: unique()+'&'+values,
				success: function( html ){
					sc_checkoutContent();
				}
		});

	}

	function sc_Content()
	{
		if ( document.getElementById('shoppingcart-content') && docReady) {
			$.ajax({type: "POST",
				url: sc_File,
				data: unique()+'&do=getContent',
				success: function( html ){
					if ( html != '' ) {
						$("#shoppingcart-content").html( html );
					}
				}
			});

		}
	}

	function sc_checkoutContent()
	{
		if ( document.getElementById('checkout-cart') && docReady) {
			$.ajax({type: "POST",
				url: sc_File,
				data: unique()+'&do=getCheckoutCart',
				success: function( html ){
					if ( html != '' ) {
						$("#checkout-cart").html( html );
					}
				}
			});

		}
	}


	function urlencode( urlstring ) {
		var string 			= escape( urlstring );
		var encoded_string  = string.replace("+","%2B");
		for (i=0;i < string.length; i++) {
			encoded_string  = encoded_string.replace("+","%2B");
			encoded_string  = encoded_string.replace("/","%2F");
		}
		return encoded_string;
	}

	function unique()
	{
		var hash	= '_';
		var hnow = new Date();
		hash += hnow.getHours();
		hash += hnow.getMinutes();
		hash += hnow.getSeconds();
		return hash;
	}


	function no_spaces(obj)
	{
		if (obj.length > 0) {
			var newObj = '';
			newObj = obj.replace(" ","");
			for (i=0;i<obj.length;i++) {
				newObj = newObj.replace(" ","");
			}
			return newObj;
		} else {
			return '';
		}
	}

	function validate_email(obj)
	{
			var myRegex = new RegExp("^[a-zA-Z^0-9^_^\.\+^-]+@([a-zA-Z^0-9]+[a-zA-Z^0-9^_^\.^-]{1,}\.)+[a-zA-Z]{2,4}$");
			if (!obj.match(myRegex)) {
				return false;
			}
			return true;
	}


