﻿/* ########################################################################### *
/* ***** DOCUMENT INFO  ****************************************************** *
/* ########################################################################### *
 * ##### NAME:  global.js
 * ##### VERSION: v1.0
 * ##### UPDATED: 2009 (Eclipse Group)
/* ########################################################################### *
/* ########################################################################### *
/* ***** INDEX *************************************************************** *
/* ########################################################################### *
/* ##### INITIALISATION
/* #####
/* ##### FUNCTIONALITY:
/* #####
/* ##### PRESENTATION
/* ########################################################################### */
/* ########################################################################### *
/* ##### INITIALISATION
/* ########################################################################### */
$(document).ready(ecl_init_globalFunctionality);
$(document).ready(ecl_init_globalPresentation);
function ecl_init_globalFunctionality()
{
    
    ecl_init_modal();
    //ecl_init_relLinks();
    init_gogreen();

    ecl_init_tabs();

    init_duplicate_stop();
}
function ecl_init_globalPresentation()
{    
    
    ecl_init_dropDownNav();
    //ecl_init_corners();
    //ecl_init_buttons();
    ecl_init_weather();
    ecl_init_billSample();
    show_hide_FAQ();
    ecl_init_progressBar();
    ecl_init_showHide_options();    
    ecl_init_conditional_fields();
    showHide_elements($("select#addressType").val());
    
    // Float feature tiles
    $("div.grid_twoColumn1 .contentPanel .featureTileHolderTwoCol .featureTile:odd").addClass("floatright");
    $("div.grid_twoColumn1 .contentPanel .featureTileHolderTwoCol .featureTile:even").addClass("floatleft");
    $("div.grid_twoColumn1 .contentPanel .featureTileHolderTwoCol .featureTile:odd").after('<div class="clear"></div>');
    $("div.grid_twoColumn2 .contentPanel .featureTileHolderTwoCol .featureTile:odd").addClass("floatright");
    $("div.grid_twoColumn2 .contentPanel .featureTileHolderTwoCol .featureTile:even").addClass("floatleft");
    $("div.grid_twoColumn2 .contentPanel .featureTileHolderTwoCol .featureTile:odd").after('<div class="clear"></div>');
    $(".contentPanel .dashboardTileHolderTwoCol .dashboardTile:odd").addClass("floatright");
    $(".contentPanel .dashboardTileHolderTwoCol .dashboardTile:even").addClass("floatleft");
    $(".contentPanel .dashboardTileHolderTwoCol .dashboardTile:odd").after('<div class="clear"></div>');
    $("div.grid_threeColumn .contentPanel .featureTileHolderTwoCol .featureTile").addClass("floatleft");
    
    $("select#addressType").change(function(){
        showHide_elements($(this).val());
    });
    
    if ($("#dobDatePick").attr("id"))
    {        
        dobDatePicker1();
    }
    
    if ($("#partnerDobDatePick").attr("id"))
    {        
        dobDatePicker2();
    }
    
    if ($("#completionDatePick").attr("id"))
    {
        selectDatePicker();
    }
    
    if ($("#fromDatePick").attr("id"))
    {
        rangeDatePicker1();    
    }
    
    if ($("#toDatePick").attr("id"))
    {
        rangeDatePicker2();
    }
    if ($("#fromDatePick2").attr("id"))
    {
        rangeDatePicker3();
    }
    if ($("#toDatePick2").attr("id"))
    {
        rangeDatePicker4();
    }
        
    if ($("input[name='customerType']:checked").val() != undefined)
    {
        get_categories($("input[name='customerType']:checked").val());
        if ($("#contactUsForm").attr("id") != undefined) {
            get_categories_contact($("input[name='contactCustomerType']:checked").val());
        }
    }
    
    //Get Categories
    $("form#faq input[name='customerType']").click(function(){
        get_categories($(this).val());
        
    });
    //Get Sub Categories
    $("select#faqCategory").change(function(){
        get_sub_categories($(this).val());
    });
    //Update Values based on Sub Categories
    $("select#faqSubCategory").change(function(){
        get_sub_category_values($(this).val());
    });
    //Setup categories if url params exist
    if($("select#faqCategory").length>0){
        if($(document).getUrlParam("catid")){
            setup_categories();
            if ($("#contactUsForm").attr("id") != undefined) {
                setup_contact_categories();
            }
        }
    }
    
    //Get Categories
    $("form#contactUsForm input[name='contactCustomerType']").click(function(){
        get_categories_contact($(this).val());
        
    });
    //Get Sub Categories
    $("select#contactCategory").change(function(){
        get_sub_categories_contact($(this).val());
    });
    //Update Values based on Sub Categories
    $("select#contactSubCategory").change(function(){
        get_sub_category_values_contact($(this).val());
    });
    
    // show the drop downs in the enquiry form
    // section
    $("div#contactCategoryDiv").removeClass("nodisplay");
    $("div#contactSubCategoryDiv").removeClass("nodisplay");
    
    // show the links in the manage my accounts section
    $("div#selectUnlinkAccountDiv").removeClass("nodisplay");
    $("div#unlinkotheraccounts").removeClass("nodisplay");
    $("div#cancelBillAverageDiv").removeClass("nodisplay");
    
    //Handle some emPower files
    empowerInteraction();
    
    // Handle My Details page
    mydetailsInteraction();
    
    // Registration page
    init_registration();
    
    // Concession cards
    if ($("form#addNewCard").length > 0)
    {
        init_concession();
    }

    if ($("#multiUnitConn").length > 0)
    {
        init_newBusinessConnection();
    }

    // Sets login background images
    $('.homeUsername').each(function(){
        if ($(this).val() == "")
        {
            $(this).css('background-image', "url('/css/images/bg_username.gif')");
        }
        $(this).focus(function(){
            $(this).css('background-image', "none");
        });
        $(this).blur(function(){
            if ($(this).val() == "")
            {
                $(this).css('background-image', "url('/css/images/bg_username.gif')");
            }
        });
        $(this).keyup(function(){
            $('.homePassword').each(function(){
                if ($(this).val() != "")
                {
                    $(this).css('background-image', "none");
                }
            });
        });
     });
    $('.homePassword').each(function(){
        if ($(this).val() == "")
        {
            $(this).css('background-image', "url('/css/images/bg_password.gif')");
        }
        $(this).focus(function(){
            $(this).css('background-image', "none");
        });
        $(this).blur(function(){
            if ($(this).val() == "")
            {
                $(this).css('background-image', "url('/css/images/bg_password.gif')");
            }
        });
     });

    if ($("form#csrSmartPowerForm").length > 0)
    {
        init_smartpower_calc();
    }

   
    $.ajaxSettings.cache = false;
    $(".keepAlive").each(function(){
        $(this).everyTime(300000, function(){
            $.get("/error/index.xhtml");
        });
    });
}

/* ########################################################################### *
/* ##### FUNCTIONALITY
/* ########################################################################### */
function ecl_init_modal() {
    $("a[rel='modal']").each(function(){
        var modalDiv = $(this).attr("id");
        $(this).click(function (e) {
            e.preventDefault();
            $(modalDiv).modal({
                close: true,
                closeHTML: "<a href='#' class='modalCloseImg' title='Close'>close</a>",
                opacity: 40,
                containerCss: {
                    height: 365,
                    overflow: 'auto'
                },
                onOpen: function (dialog) {
                  dialog.overlay.fadeIn('slow', function () {
                    dialog.container.slideDown('slow', function () {
                      dialog.data.fadeIn('slow');
                        ecl_tableAltRows();    
                        ecl_ieTweaks();
                        ecl_forms_buttons();
                    });
                  });
                },
                onClose: function (dialog) {
                  dialog.data.fadeOut('slow', function () {
                    dialog.container.slideUp('slow', function () {
                      dialog.overlay.fadeOut('slow', function () {
                        $.modal.close(); // must call this!
                      });
                    });
                  });
                }
            });
        });                              
    });
    
    $(".forgottenDetails").click(function (e) {
        e.preventDefault();
        // load the content using ajax
        $.get("wf_1.8.2_login_select_account.html", function(data){
            // create a modal dialog with the data
            $(data).modal({
                close: true,
                closeHTML: "<a href='#' class='modalCloseImg' title='Close'>close</a>",
                opacity: 40,
                containerCss: {
                    height: 300
                },
                onOpen: function (dialog) {
                  dialog.overlay.fadeIn('slow', function () {
                    dialog.container.slideDown('slow', function () {
                      dialog.data.fadeIn('slow');
                        ecl_tableAltRows();    
                        ecl_ieTweaks();
                        ecl_forms_buttons();
                    });
                  });
                },
                onClose: function (dialog) {
                  dialog.data.fadeOut('slow', function () {
                    dialog.container.slideUp('slow', function () {
                      dialog.overlay.fadeOut('slow', function () {
                        $.modal.close(); // must call this!
                      });
                    });
                  });
                }
            });
        });
    });
    
    $("#greenCancel").click(function (e) {
        e.preventDefault();
        // load the content using ajax
        $.get("wf_1.7.17_green_energy_cancel.html", function(data){
            // create a modal dialog with the data
            $(data).modal({
                close: true,
                closeHTML: "<a href='#' class='modalCloseImg' title='Close'>close</a>",
                opacity: 40,
                containerCss: {
                    height: 340
                },
                onOpen: function (dialog) {
                  dialog.overlay.fadeIn('slow', function () {
                    dialog.container.slideDown('slow', function () {
                      dialog.data.fadeIn('slow');
                        ecl_tableAltRows();    
                        ecl_ieTweaks();
                        ecl_forms_buttons();
                    });
                  });
                },
                onClose: function (dialog) {
                  dialog.data.fadeOut('slow', function () {
                    dialog.container.slideUp('slow', function () {
                      dialog.overlay.fadeOut('slow', function () {
                        $.modal.close(); // must call this!
                      });
                    });
                  });
                }
            });
        });
    });
}
function ecl_init_tabs(){
    $(".tabsContainer > ul").each(function(){
        $(this).tabs();                                       
    });
}
function ecl_init_relLinks(){
    $("a[rel='inlineForm']").each(function(){
        $(this).click(function(){
            var href = $(this).attr("href");
            // load content into a div on the page
            $("#inlineForm").load(href+" #inlineForm",null,function(){
                $("#inlineForm").show();
                // Re-instate presentation functions
                ecl_forms_buttons();
            });
            return false;
        });
    });
}
$(document).ready(function(){
    if ($("#modalDiv").attr("id") != undefined)
    {
        var modalDiv = "#modalDiv"
        $(modalDiv).modal({
            close: true,
            closeHTML: "<a href='#' class='modalCloseImg' title='Close'></a>",
            opacity: 40,
            onOpen: function (dialog) {
              dialog.overlay.fadeIn('slow', function () {
                dialog.container.slideDown('slow', function () {
                  dialog.data.fadeIn('slow');
                    ecl_tableAltRows();    
                    ecl_ieTweaks();
                    ecl_forms_buttons();
                });
              });
            },
            onClose: function (dialog) {
              dialog.data.fadeOut('slow', function () {
                dialog.container.slideUp('slow', function () {
                  dialog.overlay.fadeOut('slow', function () {
                    $.modal.close(); // must call this!
                  });
                });
              });
            }
        });
    }
});
function dobDatePicker1()
{
    $('#dobDatePick')
        .datePicker(
            {
                createButton:false,
                startDate:'01/01/1889',
                endDate:'31/12/2009'
            }
        ).bind(
            "click",
            function()
            {
                updateSelects($(this).dpGetSelected()[0]);
                $(this).dpDisplay();
                return false;
            }
        ).bind(
            "dateSelected",
            function(e, selectedDate, $td, state)
            {
                updateSelects(selectedDate);
            }
        ).bind(
            "dpClosed",
            function(e, selected)
            {
                updateSelects(selected[0]);
            }
        );
        
    // set the start and end dates based on the values in the dropdowns
    var firstYear = $("#dobDatePick").prev("select").children("option:first").attr("value");
    var lastYear = $("#dobDatePick").prev("select").children("option:last").attr("value");
    if (firstYear > lastYear)
    {
        var temp = firstYear;
        firstYear = lastYear;
        lastYear = temp;
    }
    $("#dobDatePick").dpSetStartDate("01/01/" + firstYear).dpSetEndDate("31/12/" + lastYear);
    
    var updateSelects = function (selectedDate)
    {
        selectedDate = new Date(selectedDate);
        $('#dobD option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
        $('#dobM option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
        $('#dobY option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
    }
    // listen for when the selects are changed and update the picker
    $('#dobD,#dobM,#dobY')
    .bind(
        "change",
        function()
        {
            var d = new Date(
                $('#dobY').val(),
                $('#dobM').val()-1,
                $('#dobD').val()
            );
            $('#dobDatePick').dpSetSelected(d.asString());
        }
    );
    
    //var today = new Date();
    //updateSelects(today.getTime());
    // and update the datePicker to reflect it...
    $('#dobD').trigger("change");    
}
function dobDatePicker2()
{
    $('#partnerDobDatePick')
        .datePicker(
            {
                createButton:false,
                startDate:'01/01/1889',
                endDate:'31/12/2009'
            }
        ).bind(
            "click",
            function()
            {
                updateSelects($(this).dpGetSelected()[0]);
                $(this).dpDisplay();
                return false;
            }
        ).bind(
            "dateSelected",
            function(e, selectedDate, $td, state)
            {
                updateSelects(selectedDate);
            }
        ).bind(
            "dpClosed",
            function(e, selected)
            {
                updateSelects(selected[0]);
            }
        );
    
    // set the start and end dates based on the values in the dropdowns
    var firstYear = $("#partnerDobDatePick").prev("select").children("option:first").attr("value");
    var lastYear = $("#partnerDobDatePick").prev("select").children("option:last").attr("value");
    $("#partnerDobDatePick").dpSetStartDate("01/01/" + firstYear).dpSetEndDate("31/12/" + lastYear);
        
    var updateSelects = function (selectedDate)
    {
        selectedDate = new Date(selectedDate);
        $('#partnerDobD option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
        $('#partnerDobM option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
        $('#partnerDobY option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
    }
    // listen for when the selects are changed and update the picker
    $('#partnerDobD,#partnerDobM,#partnerDobY')
    .bind(
        "change",
        function()
        {
            var d = new Date(
                $('#partnerDobY').val(),
                $('#partnerDobM').val()-1,
                $('#partnerDobD').val()
            );
            $('#partnerDobDatePick').dpSetSelected(d.asString());
        }
    );
    
    //var today = new Date();
    //updateSelects(today.getTime());
    // and update the datePicker to reflect it...
    $('#partnerDobD').trigger("change");    
}
function selectDatePicker()
{    
    $('#completionDatePick')
        .datePicker(
            {
                createButton:false,
                startDate:'01/01/2009',
                endDate:'31/12/2015'
            }
        ).bind(
            "click",
            function()
            {
                updateSelects($(this).dpGetSelected()[0]);
                $(this).dpDisplay();
                return false;
            }
        ).bind(
            "dateSelected",
            function(e, selectedDate, $td, state)
            {
                updateSelects(selectedDate);
            }
        ).bind(
            "dpClosed",
            function(e, selected)
            {
                updateSelects(selected[0]);
            }
        );
        
    // set the start and end dates based on the values in the dropdowns
    var firstYear = $("#completionDatePick").prev("select").children("option:first").attr("value");
    var lastYear = $("#completionDatePick").prev("select").children("option:last").attr("value");
    $("#completionDatePick").dpSetStartDate("01/01/" + firstYear).dpSetEndDate("31/12/" + lastYear);
    
    var updateSelects = function (selectedDate)
    {
        selectedDate = new Date(selectedDate);
        $('#completionDateD option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
        $('#completionDateM option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
        $('#completionDateY option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
    }
    // listen for when the selects are changed and update the picker
    $('#completionDateD,#completionDateM,#completionDateY')
    .bind(
        "change",
        function()
        {
            var d = new Date(
                $('#completionDateY').val(),
                $('#completionDateM').val()-1,
                $('#completionDateD').val()
            );
            $('#completionDatePick').dpSetSelected(d.asString());
        }
    );
    
    //var today = new Date();
    //updateSelects(today.getTime());
    // and update the datePicker to reflect it...
    $('#completionDateD').trigger("change");    
}
function rangeDatePicker1()
{    
    $('#fromDatePick')
        .datePicker(
            {
                createButton:false,
                startDate:'01/01/2008',
                endDate:'31/12/2020'
            }
        ).bind(
            "click",
            function()
            {
                updateSelects($(this).dpGetSelected()[0]);
                $(this).dpDisplay();
                return false;
            }
        ).bind(
            "dateSelected",
            function(e, selectedDate, $td, state)
            {
                updateSelects(selectedDate);
            }
        ).bind(
            "dpClosed",
            function(e, selected)
            {
                updateSelects(selected[0]);
            }
        );
        
    // set the start and end dates based on the values in the dropdowns
    var firstYear = $("#fromDatePick").prev("select").children("option:first").attr("value");
    var lastYear = $("#fromDatePick").prev("select").children("option:last").attr("value");
    $("#fromDatePick").dpSetStartDate("01/01/" + firstYear).dpSetEndDate("31/12/" + lastYear);
    
    var updateSelects = function (selectedDate)
    {
        selectedDate = new Date(selectedDate);
        $('#fromDay option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
        $('#fromMonth option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
        $('#fromYear option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
    }
    // listen for when the selects are changed and update the picker
    $('#fromDay,#fromMonth,#fromYear')
    .bind(
        "change",
        function()
        {
            var d = new Date(
                $('#fromYear').val(),
                $('#fromMonth').val()-1,
                $('#fromDay').val()
            );
            $('#fromDatePick').dpSetSelected(d.asString());
        }
    );
    
    //var today = new Date();
    //updateSelects(today.getTime());
    // and update the datePicker to reflect it...
    $('#fromDatePick').trigger("change");    
}
function rangeDatePicker2()
{    
    $('#toDatePick')
        .datePicker(
            {
                createButton:false,
                startDate:'01/01/2009',
                endDate:'31/12/2020'
            }
        ).bind(
            "click",
            function()
            {
                updateSelects($(this).dpGetSelected()[0]);
                $(this).dpDisplay();
                return false;
            }
        ).bind(
            "dateSelected",
            function(e, selectedDate, $td, state)
            {
                updateSelects(selectedDate);
            }
        ).bind(
            "dpClosed",
            function(e, selected)
            {
                updateSelects(selected[0]);
            }
        );
        
    // set the start and end dates based on the values in the dropdowns
    var firstYear = $("#toDatePick").prev("select").children("option:first").attr("value");
    var lastYear = $("#toDatePick").prev("select").children("option:last").attr("value");
    $("#toDatePick").dpSetStartDate("01/01/" + firstYear).dpSetEndDate("31/12/" + lastYear);
    
    var updateSelects = function (selectedDate)
    {
        selectedDate = new Date(selectedDate);
        $('#toDay option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
        $('#toMonth option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
        $('#toYear option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
    }
    // listen for when the selects are changed and update the picker
    $('#toDay,#toMonth,#toYear')
    .bind(
        "change",
        function()
        {
            var d = new Date(
                $('#toYear').val(),
                $('#toMonth').val()-1,
                $('#toDay').val()
            );
            $('#toDatePick').dpSetSelected(d.asString());
        }
    );
    
    //var today = new Date();
    //updateSelects(today.getTime());
    // and update the datePicker to reflect it...
    $('#toDatePick').trigger("change");    
}
function rangeDatePicker3()
{    
    $('#fromDatePick2')
        .datePicker(
            {
                createButton:false,
                startDate:'01/01/2008',
                endDate:'31/12/2020'
            }
        ).bind(
            "click",
            function()
            {
                updateSelects($(this).dpGetSelected()[0]);
                $(this).dpDisplay();
                return false;
            }
        ).bind(
            "dateSelected",
            function(e, selectedDate, $td, state)
            {
                updateSelects(selectedDate);
            }
        ).bind(
            "dpClosed",
            function(e, selected)
            {
                updateSelects(selected[0]);
            }
        );
        
    // set the start and end dates based on the values in the dropdowns
    var firstYear = $("#fromDatePick2").prev("select").children("option:first").attr("value");
    var lastYear = $("#fromDatePick2").prev("select").children("option:last").attr("value");
    $("#fromDatePick2").dpSetStartDate("01/01/" + firstYear).dpSetEndDate("31/12/" + lastYear);
    
    var updateSelects = function (selectedDate)
    {
        selectedDate = new Date(selectedDate);
        $('#fromDay2 option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
        $('#fromMonth2 option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
        $('#fromYear2 option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
    }
    // listen for when the selects are changed and update the picker
    $('#fromDay2,#fromMonth2,#fromYear2')
    .bind(
        "change",
        function()
        {
            var d = new Date(
                $('#fromYear2').val(),
                $('#fromMonth2').val()-1,
                $('#fromDay2').val()
            );
            $('#fromDatePick2').dpSetSelected(d.asString());
        }
    );
    
    //var today = new Date();
    //updateSelects(today.getTime());
    // and update the datePicker to reflect it...
    $('#fromDatePick2').trigger("change");    
}
function rangeDatePicker4()
{    
    $('#toDatePick2')
        .datePicker(
            {
                createButton:false,
                startDate:'01/01/2009',
                endDate:'31/12/2020'
            }
        ).bind(
            "click",
            function()
            {
                updateSelects($(this).dpGetSelected()[0]);
                $(this).dpDisplay();
                return false;
            }
        ).bind(
            "dateSelected",
            function(e, selectedDate, $td, state)
            {
                updateSelects(selectedDate);
            }
        ).bind(
            "dpClosed",
            function(e, selected)
            {
                updateSelects(selected[0]);
            }
        );
        
    // set the start and end dates based on the values in the dropdowns
    var firstYear = $("#toDatePick2").prev("select").children("option:first").attr("value");
    var lastYear = $("#toDatePick2").prev("select").children("option:last").attr("value");
    $("#toDatePick2").dpSetStartDate("01/01/" + firstYear).dpSetEndDate("31/12/" + lastYear);
    
    var updateSelects = function (selectedDate)
    {
        selectedDate = new Date(selectedDate);
        $('#toDay2 option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
        $('#toMonth2 option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
        $('#toYear2 option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
    }
    // listen for when the selects are changed and update the picker
    $('#toDay2,#toMonth2,#toYear2')
    .bind(
        "change",
        function()
        {
            var d = new Date(
                $('#toYear2').val(),
                $('#toMonth2').val()-1,
                $('#toDay2').val()
            );
            $('#toDatePick2').dpSetSelected(d.asString());
        }
    );
    
    //var today = new Date();
    //updateSelects(today.getTime());
    // and update the datePicker to reflect it...
    $('#toDatePick2').trigger("change");    
}
/* ########################################################################### *
/* ##### PRESENTATION
/* ########################################################################### */
function showHide_elements(v)
{
    if (v == "Street Address")
    {
        $(".po").each(function()
        {
            if (!$(this).hasClass("sa"))
            {
                $(this).hide();
            }
        });
        
        $(".int").each(function()
        {
            if (!$(this).hasClass("sa"))
            {
                $(this).hide();
            }
        });
        
        $(".sa").show();
    }
    else if (v == "PO Box")
    {
        $(".sa").each(function()
        {
            if (!$(this).hasClass("po"))
            {
                $(this).hide();
            }
        });
        
        $(".int").each(function()
        {
            if (!$(this).hasClass("po"))
            {
                $(this).hide();
            }
        });
        
        $(".po").show();
    }
    else if (v == "International address")
    {
        $(".sa").each(function()
        {
            if (!$(this).hasClass("int"))
            {
                $(this).hide();
            }
        });
        
        $(".po").each(function()
        {
            if (!$(this).hasClass("int"))
            {
                $(this).hide();
            }
        });
        
        $(".int").show();
    }
}

function ecl_init_conditional_fields(){
    // Toggle methods used by radio buttons
    $("fieldset[class='toggle']").each(function(){
        // Hide text which is not needed when JavaScript is on
        $(this).find(".noJavaScript").hide();
        // Hide conditional fields
        $(this).find("div[class^='toggle']").hide();
        // Show conditional fields of radio buttons that are checked
        $(this).find("input[type='radio'][id^='toggle']:checked").each(function(){
            var checkedRadio = $(this).attr("id");
            $(this).parents("fieldset:first").find("div[class^='toggle']").each(function(){
                var currentDiv = $(this).attr("class");
                if (currentDiv.indexOf(checkedRadio)!= -1){
                    $(this).show();
                }
                else {
                    $(this).hide();
                }
            });
        });
        // Check when an input with ID starting with 'toggle' is clicked
        $(this).find("input[type='radio'][id^='toggle']").click(function(){
            var showDiv = $(this).attr("id");
            $(this).parents("fieldset:first").find("div[class^='toggle']").each(function(){
                var currentDiv = $(this).attr("class");
                if (currentDiv.indexOf(showDiv)!= -1){
                    $(this).show();
                }
                else {
                    $(this).hide();
                }
            });
        });
    });    
    
    // Toggle methods used by select inputs
    $("fieldset[class='selectToggle']").each(function(){
        // Hide text which is not needed when JavaScript is on
        $(this).find(".noJavaScript").hide();
        // Hide conditional fields
        $(this).find("div[class^='selectToggle']").hide();
        // Show conditional fields of select values that are selected
        $(this).find("select[id^='selectToggle']").each(function(){
            var selectedValue = $(this).val();
            $(this).parents("fieldset:first").find("div[class^='selectToggle']").each(function(){
                var currentDiv = $(this).attr("class");
                if (selectedValue != "" && currentDiv.indexOf(selectedValue)!= -1){
                    $(this).show();
                }
                else {
                    $(this).hide();
                }
            });
        });
        // Check when a select with ID starting with 'toggle' is changed
        $(this).find("select[id^='selectToggle']").change(function(){
            var showDiv = $(this).val();
            $(this).parents("fieldset:first").find("div[class^='selectToggle']").each(function(){
                var currentDiv = $(this).attr("class");
                if (showDiv != "" && currentDiv.indexOf(showDiv)!= -1){
                    $(this).show();
                }
                else {
                    $(this).hide();
                }
            });
        });
    });    
}
function ecl_init_showHide_options()
{
    $(".optional").hide();
    
    $(".toggleOptions").find("input").each(function()
    {
        var slidingDiv = $(this).attr("name")+"Options";
        
        if (this.checked && ($(this).val().toLowerCase() == "yes" || $(this).val().toLowerCase() == "true"))
        {
            $("#"+slidingDiv).slideDown();
        }
        else if (this.checked && ($(this).val().toLowerCase() == "no" || $(this).val().toLowerCase() == "false"))
        {
            $("#"+slidingDiv).slideUp();
        }
        else if(!this.checked)
        {
            $("#"+$(this).attr("name")+"Options").slideUp();
        }
    });
    
    $(".toggleOptions").find("input").bind("click", function()
    {
            
        if(this.checked && ($(this).val().toLowerCase() == "yes" || $(this).val().toLowerCase() == "true"))
        {
            $("#"+$(this).attr("name")+"Options").slideDown();
        }
        else if ($(this).val().toLowerCase() == "no" || $(this).val().toLowerCase() == "false")
        {
            $("#"+$(this).attr("name")+"Options").slideUp();
        }
        else if(!this.checked)
        {
            $("#"+$(this).attr("name")+"Options").slideUp();
        }
    });    
}

/* ##### Primary Navigation (Superfish) */
function ecl_init_dropDownNav()
{    
    $("ul.nav_primary")
    .superfish({speed: 1})
    .find(">li:has(ul)")
        .mouseover(function(){
            $("ul", this).bgIframe({opacity:false});
        })
        .find("a")
            .focus(function(){
                $("ul", $("ul.nav_primary>li:has(ul)")).bgIframe({opacity:false});
            });
    
    //Preload background images for navigation
}
function ecl_init_buttons()
{
    var html = '<span class="btnRightBg"></span>';
    $("a.btn").each(function(){
        $(this).append(html);
    });
}
function ecl_init_weather() {
    $(".perthWeather").each(function(){
        var weatherDescrip = "Unknown";
        if (typeof(perthsprite)!='undefined') {
            if (perthsprite == "sun_sprite.gif"){
                weatherDescrip = "Sunny";
            }
            else if (perthsprite == "lightning_sprite.gif"){
                weatherDescrip = "Lightning";
            }
            else if (perthsprite == "rain_sprite.gif"){
                weatherDescrip = "Rain";
            }
            else if (perthsprite == "clearing_sprite.gif"){
                weatherDescrip = "Cloud clearing";
            }
            else if (perthsprite == "cloud_sprite.gif"){
                weatherDescrip = "Cloudy";
            }
            try {    
                $(this).html("Perth weather &#160;&#160;<img id='weather_icon' alt='Weather Icon' title='" + weatherDescrip + "' src='/css/images/" + perthsprite + "' height='15' width='25' align='absmiddle' /> " + weatherDescrip + "&#160;&#160;  Temp: " + perth[3] + "&#176;C");
            } catch (err) {
                
            }
        }
    });
}
function ecl_init_billSample() {
    $(".hintHolder .billSample").hide();
    $(".hintHolder span").hover(
        function(){
            $(this).next().show();
        },
        function(){
            $(this).next().hide();
        }
    );
}
// Submit FAQ form
function submitFaqForm() {
    if ($("#faqCategory").val() == "" || $("#faqSubCategory").val() == "" ) {
        alert("Please select a Category and a Sub Category");
        return false;
    } else {
        $("#faq").submit();
    }
}

function show_hide_FAQ()
{
    $("table.faqResults tr td ul li.question").click(function(){
        /*removing and adding classes to appropriate*/
        $("table.faqResults tr td.active").removeClass("active");
        $(this).parent("ul").parent("td").addClass("active");
    });
}
var sCategoryType = "";
function get_categories(d)
{
    var categories = eval('('+$("input#hCategories").val()+')');
    
    switch(d)
    {
    case "res": 
        sCategoryType = "Residential";
        break;
    case "bus": 
        sCategoryType = "Business";
        break;
    }
    var optionsHTML = "<option value=\"\">--Select--</option>";
    var subOptionsHTML = "<option value=\"\">--Select--</option><option value=\"\">Choose a "+sCategoryType.toLowerCase()+" category first</option>"
    for (var i=0;i<categories.length;i++)
    {
        if (d.toLowerCase() == categories[i].type.toLowerCase())
        {
            optionsHTML += "<option value=\""+categories[i].value+"\">"+categories[i].label+"</option>"
        }
    }
    $("select#faqCategory").html(optionsHTML);
    $("select#faqSubCategory").html(subOptionsHTML);
}
function get_sub_categories(c)
{
    reset_sub_categories();
    var subCats = eval('('+$("input#hSubCats").val()+')');
    var optionsHTML = "<option value=\"\">--"+sCategoryType+" Sub Categories--</option>";
    for (var i=0;i<subCats.length;i++)
    {
        if (c.toLowerCase() == subCats[i].category.toLowerCase())
        {
            optionsHTML += "<option id=\""+subCats[i].id+"\" value=\""+subCats[i].value+"\">"+subCats[i].label+"</option>"
        }
    }
    $("select#faqSubCategory").html(optionsHTML);
}
function get_sub_category_values(c)
{    
    reset_sub_categories();
    
    var subCats = eval('('+$("input#hSubCats").val()+')');
    
    for (var i=0;i<subCats.length;i++)
    {
        if (c.toLowerCase() == subCats[i].value.toLowerCase())
        {
            $("#hSubCatName").val(subCats[i].label);
            $("#hSubCatEmail").val(subCats[i].email);
            action = subCats[i].value;
            action = action.replace('%26','&');
            $("#faq").attr("action",action);
        }
    }
    
}
function reset_sub_categories(){
    $("#hSubCatName").val("");
    $("#hSubCatEmail").val("");
    $("#faq").attr("action","#");    
}
//Setup the FAQ form if url paramaters are passed.
//params: catid, subcatid
function setup_categories(){
    reset_sub_categories();
    
    var catid = $(document).getUrlParam("catid")
    var subcatid = $(document).getUrlParam("subcatid");
    var catType = "";
    
    var categories = eval('('+$("input#hCategories").val()+')');
    
    for (var i=0;i<categories.length;i++)
    {
        if (categories[i].value.toLowerCase()==catid.toLowerCase())
        {
            catType = categories[i].type;
        }
    }
    
    switch(catType){
        case "res":
            $("input[name='customerType'][value='res']").each(function(){
                this.checked = true;
            });
            break;
        case "bus": 
            $("input[name='customerType'][value='bus']").each(function(){
                this.checked = true;
            });
            break;
    }
    
    //Setup categories
    get_categories(catType);
    
    //Get the sub categories
    get_sub_categories(catid);
    $("select#faqCategory option[value='"+catid+"']").each(function(){this.setAttribute('selected',true);});
    
    //Setup values for form submit.
    if(subcatid){
        get_sub_category_values($("select#faqSubCategory option[id='"+subcatid+"']").val());
        $("select#faqSubCategory option[id='"+subcatid+"']").each(function(){this.setAttribute('selected',true);});
    }
    
}
//Get Sub Categories
$("select#faqCategory").change(function(){
    get_sub_categories($(this).val());
})

//////////////////////////////////////////////////
var sCategoryType = "";
function get_categories_contact(d)
{
    var categories = eval('('+$("input#contacthCategories").val()+')');
        
    switch(d)
    {
    case "res": 
        sCategoryType = "Residential";
        break;
    case "bus": 
        sCategoryType = "Business";
        break;
    }
    var optionsHTML = "<option value=\"\">--"+sCategoryType+" Categories--</option>";
    var subOptionsHTML = "<option value=\"\">--"+sCategoryType+" Sub Categories--</option><option value=\"\">Choose a "+sCategoryType.toLowerCase()+" category first</option>"
    var selected = false;
    for (var i=0;i<categories.length;i++)
    {
        if (d.toLowerCase() == categories[i].type.toLowerCase())
        {
            optionsHTML += "<option value=\""+categories[i].value+"\"";
            
            // Set the value of the drop down if present in
            // the hidden field
            if ($("#contacthCategoriesStore").val() != undefined)
            {                
                if ($("#contacthCategoriesStore").val().toLowerCase() == categories[i].value.toLowerCase())
                {
                    selected = true;
                    optionsHTML += " selected=\"selected\"";
                }
            }
            optionsHTML += ">"+categories[i].label+"</option>";
        }
    }
    $("select#contactCategory").html(optionsHTML);
    if (selected)
    {
        get_sub_categories_contact($("#contacthCategoriesStore").val());
    }
    else
    {
        $("select#contactSubCategory").html(subOptionsHTML);
    }
}
function get_sub_categories_contact(c)
{
    reset_sub_categories_contact();
    var subCats = eval('('+$("input#contacthSubCats").val()+')');
    var optionsHTML = "<option value=\"\">--"+sCategoryType+" Sub Categories--</option>";
    for (var i=0;i<subCats.length;i++)
    {
        if (c.toLowerCase() == subCats[i].category.toLowerCase())
        {
            
            optionsHTML += "<option id=\""+subCats[i].id+"\" value=\""+subCats[i].value.replace("&","&amp;")+"\"";
            
            // Set the value of the drop down if present in
            // the hidden field
            if ($("#contacthSubCatsStore").val() != undefined)
            {                
                if ($("#contacthSubCatsStore").val().toLowerCase() == subCats[i].id.toLowerCase())
                {
                    optionsHTML += " selected=\"selected\"";
                }
            }
            
            optionsHTML += ">"+subCats[i].label+"</option>";
        }
    }
    $("select#contactSubCategory").html(optionsHTML);
    $("#contacthCategoriesStore").val(c);

    // Set category name
    var categories = eval('('+$("input#contacthCategories").val()+')');
    for (var i=0;i<categories.length;i++)
    {
        if (c.toLowerCase() == categories[i].value.toLowerCase())
        {
            $("#contacthCategoryName").val(categories[i].label);
        }
    }
}
function get_sub_category_values_contact(c)
{    
    //console.log(c);
    reset_sub_categories_contact();
    
    var subCats = eval('('+$("input#contacthSubCats").val()+')');
    
    for (var i=0;i<subCats.length;i++)
    {
        if (c.toLowerCase() == subCats[i].value.toLowerCase())
        {
            $("#contacthSubCatName").val(subCats[i].label);
            $("#contacthSubCatEmail").val(subCats[i].email);
            $("#contacthSubCatsStore").val(subCats[i].id);
        }
    }
}
function reset_sub_categories_contact(){
    //$("#contacthSubCatName").val("");
    //$("#contacthSubCatEmail").val("");
}
//Setup the FAQ form if hidden form input fields exist.
//fields: contacthCategoriesStore, contacthSubCatsStore
function setup_contact_categories(){
    
    var catid = $("#contacthCategoriesStore").val();
    var subcatid = $("#contacthSubCatsStore").val();
    var catType = "";
    
    if (catid == "" && subcatid == "") {
        var catid = $(document).getUrlParam("catid")
        var subcatid = $(document).getUrlParam("subcatid");
    }
    
    var categories = eval('('+$("input#contacthCategories").val()+')');
    
    for (var i=0;i<categories.length;i++)
    {
        if (categories[i].value.toLowerCase()==catid.toLowerCase())
        {
            catType = categories[i].type;
        }
    }
    
    //Setup categories
    get_categories_contact(catType);
    
    //Get the sub categories
    get_sub_categories_contact(catid);
    //Setup values for form submit.
    if(subcatid){
        get_sub_category_values_contact($("select#contactSubCategory option[id='"+subcatid+"']").val());
    }
    
}

//////////////////////////////////////////////////

function ecl_init_progressBar(){
    $(".progressBar .active").each(function(){
        $(this).prev().addClass("beforeActive");                                
    });
}
function radioButton(radio) 
{
    var id = radio.name.substring(radio.name.lastIndexOf(':'));
    var el = radio.form.elements;
    for (var i = 0; i < el.length; i++) 
    {
        if (el[i].name.substring(el[i].name.lastIndexOf(':')) == id) 
        {
            el[i].checked = false;
        }
    }
    radio.checked = true;
}
function empowerInteraction (){
    // Make table rows clickable
    $("#emPowerTabularTable .more").hide();
    $("#emPowerTabularTable td").click(function(){
        window.location.href = $(this).parent().find("td.more a").attr("href");
    });
    
    // Enable print button
    $(".empowerTools .button.print").show().click(function(){
        window.print();
    });
    
    // Add alert to download button
    $(".empowerDownload").click(function(){
        alert("Note: for a large date range it will take a while for the file download process to start.");
    });
}
function mydetailsInteraction (){
    // Add cancel button
    $("#editMailingAddress .buttons").prepend("<a href='#' class='button style2 cancelButton'>Cancel</a>");
    ecl_forms_buttons();
    
    // Hide form if no address has been selected
    if ($("#selectToggleAddressType").val() == "") {
        $("#editMailingAddress").hide();
    }
    
    // Setup show and hide actions
    $(".editMailingAddress").click(function(){
        $("#editMailingAddress").show();
        return false;
    });
    $(".cancelButton").click(function(){
        $("#editMailingAddress").hide();
        return false;
    });
}
function init_registration (){
    $("#sameAsCompanyName").click(function(){
        if ($(this).attr("checked"))
        {
            $("#customerName").attr("value", $("#companyName").attr("value")).attr("disabled", true);
        }
        else
        {
            $("#customerName").removeAttr("disabled");
        }
    })
}
function init_gogreen (){
    var selectors = new Array('#slider1 #selContribution1','#slider2 #selContribution2','#slider3 #selContribution3');
    var x;
    
    //Add non-conflicting slider
    for(x in selectors){
        if($(selectors[x]).length > 0){
            $(selectors[x]).accessibleUISlider({width: 305});    
            $(selectors[x]).change();
        }
    }
    
    // Add onchange calls
    $("#eglastConsumption").change(function(){updateFromText($(this), $("#selContribution1"), $("#nplastConsumption").val())});
    $("#egavgBillDays").change(function(){updateFromText($(this), $("#selContribution1"), $("#npavgBillDays").val())});
    $("#nplastConsumption").change(function(){updateFromText($(this), $("#selContribution2"), $("#eglastConsumption").val())});
    $("#npavgBillDays").change(function(){updateFromText($(this), $("#selContribution2"), $("#egavgBillDays").val())});
    $("#eflastConsumption").change(function(){updateFromText($(this), $("#selContribution3"), $("#nplastConsumption").val())});
    $("#efavgBillDays").change(function(){updateFromText($(this), $("#selContribution3"), $("#npavgBillDays").val())});
}
var namesCount = new Array(0,0,0);
 
//Function called when slider has been updated.
function updateStuff(selectedItem){    
    if($(selectedItem).attr("id") == "selContribution1"){
        if(namesCount[0]>0){
            $("#selContribution11").val($("#selContribution1").val());
            $.getJSON("/unauth/gogreen_ajax.xhtml",{'selectedSlider': 'EG', 'newSliderValue' : $("#selContribution1").val(), 'avgConsumption' : $("#eglastConsumption").val(), 'noOfDays' : $("#egavgBillDays").val()}, function(ret) {updateValuesFromAjax(ret);});
        }
        namesCount[0]++;
    }
    if($(selectedItem).attr("id") == "selContribution2"){
        if(namesCount[1]>0){
            $("#selContribution22").val($("#selContribution2").val());
            $.getJSON("/unauth/gogreen_ajax.xhtml",{'selectedSlider': 'NP', 'newSliderValue' : $("#selContribution2").val(), 'avgConsumption' : $("#nplastConsumption").val(), 'noOfDays' : $("#npavgBillDays").val()}, function(ret) { updateValuesFromAjax(ret);});
        }
        namesCount[1]++;
    }
    
    if($(selectedItem).attr("id") == "selContribution3"){
        if(namesCount[2]>0){
            $("#selContribution33").val($("#selContribution3").val());
            $.getJSON("/unauth/gogreen_ajax.xhtml",{'selectedSlider': 'EF', 'newSliderValue' : $("#selContribution3").val(), 'avgConsumption' : $("#eflastConsumption").val(), 'noOfDays' : $("#efavgBillDays").val()}, function(ret) { updateValuesFromAjax(ret);});
        }
        namesCount[2]++;
    }
}
//Find spans with id's which match returned JSON array key values and update.
function updateValuesFromAjax(ret){
    for (key in ret){
        $("span#"+key).html(ret[key]);
    }
}
// Function called when a text value is updated
function updateFromText(textElement, selectedItem, previousValue) {
    if (!isNumeric(textElement.val()) || textElement.val() == 0) {
        alert('Please enter a positive value');
        // Set back previous value
        textElement.val(previousValue);
    } else {
        updateStuff(selectedItem);
    }
}
function isNumeric(value) 
{ 
    if (value.match(/^[\d.]+$/) == null) 
        return false; 
    else 
        return true; 
}

function init_concession () {
    if ($("div.alertbox.error").length > 0) {
        $("#concessionsList").hide();
        $("#addNewCard").show();
    }
    else {
        $("#addNewCard").hide();    
    }
    
    $("#addNewCard .buttons").prepend("<a href='#' class='button style2 cancelButton'>Cancel</a>");
    //ecl_forms_buttons();
    
    $(".addNewCard").click(function(){
        $("#concessionsList").hide();
        $("#addNewCard").show();
        return false;
    });
    
    $(".cancelButton").click(function(){
        $("#addNewCard").hide();
        $("#concessionsList").show();
        return false;
    });
}

function init_newBusinessConnection () {
    $('#multiUnitConn').after("<input type='submit' class='button style1' id='buttAdd5More' value='Add 5 more rows' />");
    $('#buttAdd5More').click(function(){
        var rowNo = $(this).parents('fieldset').find("table tbody tr:last-child td:first-child").html();
        var buildTypes = $(this).parents('fieldset').find("table tbody tr:last-child td:nth-child(2) select").html();
        var siteTypes = $(this).parents('fieldset').find("table tbody tr:last-child td:nth-child(4) select").html();
        var rowNoStart = parseInt(rowNo)+1;
        var rowNoEnd = parseInt(rowNo)+5;
        for(rowNoStart;rowNoStart<=rowNoEnd;rowNoStart++){
            $(this).parents('fieldset').find("table tbody").append("<tr><td>"+rowNoStart+"</td><td><select class='blueInput' name='newResConnectionDetails:buildingType"+(rowNoStart-1)+"'>"+buildTypes+"</select></td><td><input class='blueInput med' type='text' name='newResConnectionDetails:level"+(rowNoStart-1)+"' /></td><td><select class='blueInput' name='newResConnectionDetails:siteType"+(rowNoStart-1)+"'>"+siteTypes+"</select></td><td><input class='blueInput med' type='text' name='newResConnectionDetails:meter"+(rowNoStart-1)+"' /></td></tr>");    
        }
        ecl_tableAltRows();
        return false;
    });
}

function init_duplicate_stop() {
    $('input:submit:not(.allowDupe)').click(function(){
        if ($(this).val() == 'Submitted') {
            return false;
        }
        $(this).val('Submitted');
        return true;
    });
}

function init_smartpower_calc() {
    $('#smartpowerCheaper').hide();
    $('#smartpowerExpensive').hide();
    $('#calculate').click(function calculateBenefits()
       {
               var highShoulder = $('#highShoulder').val();
               var lowShoulder = $('#lowShoulder').val();
               var offPeak = $('#offPeak').val();
               var onPeak = $('#onPeak').val();
            // New Pricing
            var newPricing_highShoulder = $('#highShoulderRate').val() / 100;//"0.1542";         
            var newPricing_lowShoulder = $('#lowShoulderRate').val() / 100;//"0.1132";     
            var newPricing_offPeak = $('#offPeakRate').val() / 100;//"0.0722";     
            var newPricing_onPeak = $('#peakRate').val() / 100;//"0.2528"; 
            
            var newTotal_highShoulder = Math.round(highShoulder * newPricing_highShoulder * 100)/100;
            
            var newTotal_lowShoulder = Math.round(lowShoulder * newPricing_lowShoulder * 100)/100;     
            var newTotal_offPeak = Math.round(offPeak * newPricing_offPeak * 100)/100;     
            var newTotal_onPeak = Math.round(onPeak * newPricing_onPeak * 100)/100; 
            // A1 Pricing
            var a1Pricing_highShoulder = $('#a1Rate').val() / 100;//"0.1394";         
            var a1Pricing_lowShoulder = $('#a1Rate').val() / 100;//"0.1394";     
            var a1Pricing_offPeak = $('#a1Rate').val() / 100;//"0.1394";     
            var a1Pricing_onPeak = $('#a1Rate').val() / 100;//"0.1394"; 
            
            var a1Total_highShoulder = Math.round(highShoulder * a1Pricing_highShoulder * 100)/100;
            var a1Total_lowShoulder = Math.round(lowShoulder * a1Pricing_lowShoulder * 100)/100;     
            var a1Total_offPeak = Math.round(offPeak * a1Pricing_offPeak * 100)/100;     
            var a1Total_onPeak = Math.round(onPeak * a1Pricing_onPeak * 100)/100; 
            
            var a1difference_highShoulder    = newTotal_highShoulder - a1Total_highShoulder;
            var a1difference_lowShoulder = newTotal_lowShoulder - a1Total_lowShoulder;
            var a1difference_offPeak = newTotal_offPeak - a1Total_offPeak;
            var a1difference_onPeak = newTotal_onPeak - a1Total_onPeak;
            
            var subtotal = Math.round((a1difference_highShoulder + a1difference_lowShoulder + a1difference_offPeak + a1difference_onPeak) * 100)/100;
            
            function formatAsMoney(mnt) {
                 mnt -= 0;
                    mnt = (Math.round(mnt*100))/100;
                return (mnt == Math.floor(mnt)) ? mnt + '.00' 
                      : ( (mnt*10 == Math.floor(mnt*10)) ? 
                               mnt + '0' : mnt);
            }
            
            if(subtotal > 0)
            {
                $('#smartpowerCheaper').hide();
                $('#expensiveValue').html(subtotal);
                $('#smartpowerExpensive').show();
            } else {
                subtotal = -subtotal;
                $('#smartpowerExpensive').hide();
                $('#cheaperValue').html(subtotal);
                $('#smartpowerCheaper').show();
            }
            
            return false;
       });
}

/////////////////////
// ROUNDED CORNERS //
/////////////////////
/*function ecl_init_corners()
{
    // Rounded corners with jQuery corner plugin version 1.92
    $('.pagination').corner("");
}*/

/* FIN */