/**
 * Master Javascript
 *
 * @copyright   2010 SimonRichards
 * @category    Laminex CMS
 * @package     The Laminex Group
 * @version     $Id$
 */

// Cufon
Cufon.replace("h1, .title h2, .title h3, .title h4");
Cufon.replace("#header .menu a", {
    hover: true
});
Cufon.now();
if ($("html").hasClass("ie7")) {
    $("h1, .title h2, .title h3, .title h4, #header .menu a").css({visibility: "visible"});
}

// Sub menu animation plugin
$.menuSwitch();

// Preload images
$.preload("/ui/arrow-grey-transparent.png");

// Customize HTML Select style
$("#page-contact-us select").customSelect();
$("#page-contact-us input[type=checkbox]").customButton();
$("#page-locator select").customSelect({
    width           : "296",
    height          : "28",
    innerBackground : "ui/arrow-select-large.gif"
});

if ($("#page-our-brands, #page-our-products").length > 0) {
    var height = $(".block-content").height();
    $(".block-content")
    .css({opacity: 0, height: "1"})
    .animate({
        height: 1
    })
    .animate({
        opacity: 1,
        height: height
    }, 1000);
}

// Locator
if (typeof(storeId) === 'undefined') {
    var storeId = 0;
}

if ($("#page-locator").length > 0) {
    $.locator({
        brandId  : '4',
        storeId  : storeId,
        postcode : postcode,
        typeId   : typeId
    });
}

// Price Adjust Form
/*
if ($("#page-trade").length !== 0) {
    $("a[href=#price-adjustment-form]").click(function() {
        $("#content h1").html("Price Adjustment Request Form");
        Cufon.replace("h1");
        Cufon.now();
    });

    $(".menu a:not(a[href=#price-adjustment-form])").click(function() {
        if ($("#content h1").html() === "Trade") {
            return false;
        }

        $("#content h1").html("Trade");
        Cufon.replace("h1");
        Cufon.now();
    });
}
*/

// Insert homepage flash
if ($("#page-home").length > 0) {
    // Simple homepage slideshow
    $.slideshow({main: "#page-home .hero", rotateSpeed : 5000});

    swfobject.embedSWF('/uploads/home/' + homeFlash, 'hero-flash', '960', '330', '9.0.0', '/ui/express-install.swf', null, {wmode: 'transparent'});
}

// credit
function credit()
{
    alert("For Teresa Truda\n\nThank you for all those most trying moments.");
}


