﻿/// <reference path="/asssets/scripts/jscript/jquery-mini-vsdoc.js" />
$(document).ready(function () {
    Shadowbox.init();
    $("#viewLarge").css("visibility", "visible");
    $(".pPlus").click(function (event) {
        var item = parseInt($(this).prev("input[type=text]").val());
        if (item < 99) {
            $(this).prev("input[type=text]").val(item + 1);
        }
    });
    $(".pMin").click(function (event) {
        var item = parseInt($(this).next("input[type=text]").val());
        if (item != 0) {
            $(this).next("input[type=text]").val(item - 1);
        }
    });
    $('#ExtendedText').hide();
    $('a#readmmore-toggle').click(function () {
        $('#ExtendedText').toggle(400);
        return false;
    });
    $('h1').click(function () {
        window.location.href = '/';
    });
    $('#logolink').click(function () {
        window.location.href = '/';
    });
    $('#brightoncalendar').click(function () {
        window.location.href = 'brighton-and-hove-2012-calendar.htm';
    });
    $('#brightonbook').click(function () {
        window.location.href = 'the-brighton-book.htm';
    });
    $('#coda-slider-1').codaSlider({
        dynamicTabs: false
    });
    $(".coda-slider-wrapper a").click(function () {
        var UrlCount = window.location.href.split("#");
        var url = $(this).attr("href");
        if (UrlCount.length > 1) {
            url = $(this).attr("href") + "#" + UrlCount[1];
        }
        $(this).attr("href", url);
    });
    $('#_lb_checkout').click(function () {
        $("#checkoutPage").css('display', 'none');
        $("#processingOrder").css('display', 'block');
    });
    _returnTotalItemsInShoppingCart();
    function _returnTotalItemsInShoppingCart() {
        $.ajax({
            cache: true,
            type: "POST",
            url: "/assets/webservices/data_provider_service.asmx/_returnTotalItemsInShoppingCart",
            data: {},
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                $("#_lb_sc_ammount").html(response.d);
            },
            error: function () {
            }
        });
    }
    $("#BuyMe").click(function () {
        var OptionCatID = $("#_hf_currentID").val();
        var checkedRadioButtons = $('#form1 #RadioButtonList1 input:checked').val();
        var OptionUnits = 1;
        $.ajax({
            type: "POST",
            url: "/assets/webservices/data_provider_service.asmx/_addItemToShoppingCart",
            data: "{catid: '" + OptionCatID + "', selid: '" + checkedRadioButtons + "', unid: '" + OptionUnits + "' }",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                if (response.d == true) {
                    _returnTotalItemsInShoppingCart();
                    $("#_lb_sc_ammount").css("color", "Red");
                }
                else {
                    alert("There has been a error, please try again.");
                }
            },
            error: function () {
            }
        });
    });
    window.onload = function () {
        document.body.onselectstart = function () {
            return false;
        }
        document.body.ondragstart = function () {
            return false;
        }
    };
    $("div.zitem").hover(function () {
        $(this).css({ 'z-index': '10' });
        $(this).css({ 'position': 'absolute' });
        $(this).find('img').addClass("imageHover").stop()
		.animate({
		    marginTop: '-110px',
		    marginLeft: '-110px',
		    top: '50%',
		    left: '50%',
		    width: '400px',
		    height: '294px'
		}, 200);
    }, function () {
        $(this).css({ 'z-index': '0' });
        $(this).find('img').removeClass("imageHover").stop()
		.animate({
		    marginTop: '0',
		    marginLeft: '0',
		    top: '0',
		    left: '0',
		    width: '240px',
		    height: '177px'
		}, 400);
    });
});

