// $Header: $
//////////////////////////////////////////////////////////////////////

OnLoad();

function OnLoad()
{
	var lickey = document.getElementById("lickey");
	if (lickey)
	{
		lickey.focus();
		lickey.select();
	}
}

function OnSubmit()
{
	var lickey = document.getElementById("lickey");
	if (lickey.value.length != 19  ||  lickey.value == "XXXX-XXXX-XXXX-XXXX")
	{
		alert("Please enter your License Key in the form XXXX-XXXX-XXXX-XXXX");
		return false;
	}
	
	var submit2 = document.getElementById("submit2");
	if (submit2)
	{
		submit2.disabled = true;
		submit2.value = "Wait...";
	}
		
	return true;
}

// Remove the "Continue Shopping" button.			
function EJEJC_config()
{
	// Border color of of popup shopping cart window.
	EJEJC_BRDRCOLOR = "#009";
					
	// Change the pixel width of the cart window:
	EJEJC_WIDTH = 600;
					
	// Change the pixel height of the cart window:
	EJEJC_HEIGHT = 475;
				
	// Must be set so that the settings in the function below takes effect.
	EJEJC_POSTCALL=true;
}

function EJEJC_shown()
{
	// Do not show the Continue Shopping button.
	jQuery("#btnContShop").remove();

	// Change the amount in the cart.
	// "ejejctable" is the id on the table element of the cart.
	try
	{
		// Disable input text control so price cannot be changed.
		var cart_item_price = jQuery("#ejejctable tr:nth-child(2) td:nth-child(5) :eq(0)")[0];
		cart_item_price.disabled = true;

		// Set background color of the input text control to same as the line item number.
		var line_number = jQuery("#ejejctable tr:nth-child(2) td:nth-child(1)")[0];
		cart_item_price.style.backgroundColor = line_number.style.backgroundColor;
		
		// Hide msg about changing value.
		var msg = jQuery("#tdPmnt")[0];
		msg.style.visibility = 'hidden';

		/*
		// Total item price
		var total_item_price = jQuery("#ejejctable tr:nth-child(2) td:nth-child(5) :eq(1)")[0];
		//total_item_price.value = "1.99";

		// Total amount.
		var total_td = jQuery("#ejejctable tr:nth-child(3) td:nth-child(3)")[0];
		var text_node = getTextNodes(total_td);
		*/
	}
	catch(e)
	{
	}
}


function getTextNodes(el) {
	for (var i=0; i < el.childNodes.length; ++i)
	{
        if (el.childNodes[i].nodeType == 3)
			return el.childNodes[i];
	}
}

