// GENERAL
// -----------------------------------------------

function openExternalUrl(a)
{
	alert(a.attributes["title"].value);
	window.open(a.attributes["href"].value, "_blank");
	return false;
}

function pageLoaded()
{
	var path = window.location.pathname;
	var currentPage = path.replace(/^.*\/(\w{2})\.html$/i, "$1").replace("/", "");

	currentPage = currentPage.substring(0, currentPage.indexOf(".")).toString();

	if (currentPage != undefined)
	{
		var f = $("#Footer" + currentPage);

		if (f.length)
		{
			f.addClass("Active");
		}
	}
}

// -----------------------------------------------
// BUY PAGE
// -----------------------------------------------

function BuyPageClass()
{
	this.selectedPayment = false;
}

BuyPageClass.prototype.PaymentSelection = function(img)
{
	var title = $(img).attr("title");
	this.selectedPayment = title.toString().replace(" ", "");

	$("#HidPaymentType").attr("value", this.selectedPayment);
	$(".PaymentImage").removeClass("Selected");
	$(img).addClass("Selected");

	$("#ButProceed").addClass("ButtonOk");
	$("#ButProceed").attr("value", "Proceed to " + title);
}

BuyPageClass.prototype.ProceedToPayment = function (but)
{
	if (this.selectedPayment == false)
	{
		alert("Please select PayPal or Google Checkout!");
		event.preventDefault();
		return false;
	}
	else if (!Page_IsValid)
	{
		alert("Please enter a valid email address!");
		event.preventDefault();
		return false;
	}

	$(but).attr("value", "Redirecting...");
	$(but).unbind("click");
}

BuyPage = new BuyPageClass();
