﻿$(document).ready(function() {

    $('#cycleWrapper').append("<div id='homeMain2' style='height:380px;'>" + $('#homeMain').html() + "</div>");
    $('#cycleWrapper').append("<div id='homeMain3' style='height:380px;'>" + $('#homeMain').html() + "</div>");
    $('#cycleWrapper').append("<div id='homeMain4' style='height:380px;'>" + $('#homeMain').html() + "</div>");
    $('#cycleWrapper').append("<div id='homeMain5' style='height:380px;'>" + $('#homeMain').html() + "</div>");
    $('#cycleWrapper').append("<div id='homeMain6' style='height:380px;'>" + $('#homeMain').html() + "</div>");
    $('#cycleWrapper').append("<div id='homeMain7' style='height:380px;'>" + $('#homeMain').html() + "</div>");
    $('#cycleWrapper').append("<div id='homeMain8' style='height:380px;'>" + $('#homeMain').html() + "</div>");

    $('#cycleWrapper').cycle({
        fx: 'fade',
        timeout: 6000,
        speed: 2000,
        speedIn:500
    });


    $(".buttonTag").hover(function() {

        //alert("test");
        if ($(".subNav").is(':visible')) {

            $(".subNav").mouseleave(function() {
                if ($.browser.msie) {
                    $(".subNav").hide();
                }
                else {
                    $(".subNav").fadeOut();
                }

            });

        }
        else {

            $(".buttonHome").removeClass("buttonHomeSelected");
            if ($.browser.msie) {
                $(".subNav").show();
            }
            else {
                $(".subNav").fadeIn();
            }

        }


        return false;

    });


    $(".linkPopup").colorbox({ iframe: true, innerWidth: 750, innerHeight: 450, scrolling: true });

    $(".linkPopupSmall").colorbox({ iframe: true, innerWidth: 240, innerHeight: 200, scrolling: true });

    $(".linkPopupTagVB").colorbox({ iframe: true, innerWidth: 280, innerHeight: 180, scrolling: false });


    $("input[type='text'], select, textarea").focus(function() {
        $(this).addClass("focusInput");
    }).blur(function() {
        $(this).removeClass("focusInput").addClass("blurInput");
    });


    $('.toUpper').keyup(function() {       
        this.value = this.value.toUpperCase();       
    });

});


function SetUniqueRadioButton(nameregex, current) {
    re = new RegExp(nameregex);
    for (i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i]
        if (elm.type == 'radio') {
            if (re.test(elm.name)) {
                elm.checked = false;
            }
        }
    }
    current.checked = true;
}
