﻿
function changePassword()
{
	__doPostBack('changePassword', '');
}

function displayCustomerSessions()
{
	__doPostBack('displaySessions', '');
}

function displaySession(id)
{
	__doPostBack('displaySession', id);
}

function addToCart(anchor, path)
{
	document.getElementById('txtPath').value = path;
	var pos = Position.get(anchor);
	var area = document.getElementById('addToCartArea');
	//var element = anchor;
    var left = pos.left;//element.offsetLeft;
    var top  = pos.top;//element.offsetTop - element.scrollTop;
    /*while(element=element.offsetParent)
    {
        left += element.offsetLeft;
        top  += element.offsetTop - element.scrollTop;
    }*/
	area.style.left = left + 'px';
	area.style.top = top + 'px';
	area.style.display = 'block';
}

function addSelectionToCart(sizesId, quantityId)
{
	__doPostBack('addSelectionToCart', document.getElementById('txtPath').value);
}

function cancelSelection() { document.getElementById('addToCartArea').style.display = 'none'; }

function cartCheckout() { __doPostBack('cartCheckout', ''); }

function cartConfirmCheckout(firstNameId, lastNameId, addressId, cityId, stateId, zipId, phoneNumberId)
{
	var firstName = document.getElementById(firstNameId).value;
	var lastName = document.getElementById(lastNameId).value;
	var address = document.getElementById(addressId).value;
	var city = document.getElementById(cityId).value;
	var state = document.getElementById(stateId).value;
	var zip = document.getElementById(zipId).value;
	var phoneNumber = document.getElementById(phoneNumberId).value;
	if (firstName == '' || lastName == '' || address == '' || city == '' || state == '' || zip == '' || phoneNumber == '')
		window.alert('Please fill in the first name, last name, address, city, state, zip, and phone number fields.');
	else
		__doPostBack('cartConfirmCheckout', '');
}

function clearCartContents()
{
	if (window.confirm("Are you sure you want to clear your saved cart? This action cannot be undone."))
	{
		__doPostBack('clearCartContents', '');
	}
}

function deleteCartItem(id) { __doPostBack('deleteCartItem', id); }

function cartViewCart() { __doPostBack('cartViewCart', ''); }

function useSpecialPricing(checkbox) { __doPostBack('useSpecialPricing', checkbox.checked.toString()); }
