Cufon.replace(".spotlight h2");
Cufon.replace(".portalBanner .title");
Cufon.replace(".item .title h2");
Cufon.replace(".intro .title h1");
Cufon.replace("a.btnBreedOffer");
Cufon.replace("a.btnBreedOrder");
Cufon.replace("a.breedBanner .content .title");
//=================================================================================================
function frmLoginChangeAction2()
{
	var 
		frmLogin = document.getElementsByName("frmLogin")[0],
		edtUsername = frmLogin.elements["edtUsername"],
		action = "login.aspx?action=3";

	if (edtUsername.type != "hidden" && (!edtUsername.value || edtUsername.value == edtUsername.defaultValue))
	{
		alert(noUsername[Languages.current]);

		edtUsername.focus();

		if (typeof (event) != "undefined" && event != null)
			event.returnValue = false;

		return false;
	}

	if (confirm(newPassword[Languages.current]))
	{
		//action.value = 3;

		frmLogin.action = action;

		frmLogin.submit();
	}
}
//=================================================================================================
function Shop_OrderLines_QuantityChange(sender, event)
{
	if (sender.value() < 1)
	{
		Webshop.removeProduct(sender.row);
	}
}
//=================================================================================================
var Specific = {};
//=================================================================================================
Specific.Order = function (pID)
{
	this.disabled = "disabled";
	Webshop.addProduct(pID, 1);
}
//=================================================================================================
Specific.Remove = function (pID)
{
	Webshop.removeProduct(pID);
}
//=================================================================================================
Specific.Register = function ()
{
	if (Webshop.checkBasket(null))
	{
		var count = 0;
		var rows = Shop.tables["OrderLines"].rows;
		for (var i = 0; i < rows.length; i++)
		{
			count += rows[i].Quantity.value();
		}
		if (count > 4)
		{
			JQ.query("div.largeOrder").toggle();
			return false;
		}
		return true;
	}
	else
	{
		return false;
	}
}
//=================================================================================================
Specific.ToggleAddress = function ()
{
	Shop.Addresses.Rows(1).fields["Country"].value(Shop.Addresses.Rows(0).fields["Country"].value());
	JQ.query("#invoice").toggle();
}
//=================================================================================================
Specific.CheckZipCode = function (pValue)
{
	if (pValue !== null && Shop.Addresses.Rows(0).fields["Country"].value() == 1)
	{
		return new RegExp("^[0-9]{4}[a-z|A-Z]{2}$").test(pValue);
	}
	return true;
}
//=================================================================================================
Specific.CheckBankAccountNo = function (pValue) {
    if (pValue !== null && pValue.length === 9) {
        var total = 0;
        for (i = 0; i < 9; i++) {
            total += pValue.charAt(i) * (10 - (i + 1));
        }
        return (total % 11 == 0);
    }

    if (pValue !== null) {
        return new RegExp("^[0-9]+$").test(pValue);
    }

    return true;
}
//=================================================================================================
Specific.Pay = function (pSender, event) {
    if (Webshop.customers.rows.length > 0 && Webshop.addresses.rows.length > 0) {
        if (!JQ.query("#invoice").is(':visible')) {
            if (Webshop.addresses.rows.length == 2) {
                Webshop.customers.InvoiceAdrID.value(null);
                Webshop.addresses.removeRowAt(1);
            }
        }
    }

    var $bankAccountNo = JQ.query("#edtShop_Customers_BankAccountNo_0");
    var $bank = JQ.query("#edtShop_Customers_Bankname_0");

    if ($bankAccountNo.length > 0 && $bankAccountNo.val() === "") {
        var message = getMessage("Webshop.BankAccountNoEmpty");
        Webshop.customer.BankAccountNo.showError(message.text);
        $bankAccountNo.focus();
    }
    else if ($bank.length > 0 && $bank.val() === "") {
        var message = getMessage("Webshop.BanknameEmpty");
        Webshop.customer.Bankname.showError(message.text);
        $bank.focus();
    }
    else {
        Webshop.checkRegister(pSender, event);
    }
}
//=================================================================================================
function onAfter()
{
	var id = this.id.replace("header_", "");
	
	JQ.query("*[id^='bullet_']").removeClass("current");
	JQ.query("#bullet_" + id).addClass("current");
}
//=================================================================================================
function gotoSlide(position)
{
	if (slider)
		slider.cycle(position);

	JQ.query("*[id^='bullet_']").removeClass("current");
	JQ.query("#bullet_" + position + 1).addClass("current");
}
//=================================================================================================
var videoLightbox;
var video;
//=================================================================================================
function showVideo(src)
{
	videoLightbox = new TLightBox("videolightbox");


	var 
		flash = new FlashObject("img/default/flvplayer.swf", "flash", 768, 432, "8.0.22", "#FFFFFF", true);

	flash.addParam("bufferlength", 3);
	flash.addParam("allowfullscreen", false);
	flash.addParam("wmode", "transparent");
	flash.addParam("movie", "img/default/flvplayer.swf");
	flash.addVariable("type", "flv");
	flash.addVariable("displaywidth", 768);
	flash.addVariable("displayheight", 432);
	flash.addVariable("usefullscreen", false);
	flash.addVariable("autostart", true);

	flash.addVariable("usefullscreen", false);
	flash.addVariable("file", "/" + src);

	flash.write("video");

	videoLightbox.show();

	JQ.query('#imgBack').click(function ()
	{
		hideVideo();
	});
}
//=================================================================================================
function hideVideo()
{
	JQ.query('#imgBack').unbind("click");

	JQ.query("*[id ^= 'video_']").empty();

	videoLightbox.hide();
}
//=================================================================================================
