$(function() {
    var b = navigator.userAgent.toLowerCase();
    jQuery.browser = {
        safari: /webkit/.test(b),
        opera: /opera/.test(b),
        msie: /msie/.test(b) && !/opera/.test(b),
        msie6: /msie 6.0/.test(b) && !/opera/.test(b),
        mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b)
    };

    /**
    * Fixes png transparency issues with image height and width
    */
    if ($.browser.msie6) {
        $('[src$=.png]').ifixpng().each(function() {
            $(this).css("padding-bottom", parseInt($(this).css("padding-bottom").replace(/[^!0-9]/g, '')) + 4 + "px");
            $(this).css("padding-right", parseInt($(this).css("padding-right").replace(/[^!0-9]/g, '')) + 4 + "px");
        });
    }

    /**
    * Hides empty span tags in forms, because IE renders them and the layout explodes
    */
    if ($.browser.msie) {
        $(".customFormView .field span").each(function(i) {
            if ($(this).text().length == 0) {
                $(this).addClass("noShow");
            } else {
                $(this).addClass("show");
            }
        });
    }

    /**
    * Removes empty label table cell and widens field cell
    */
    $(".customFormView .lbl").each(function(i) {
        if ($(this).text().length == 0) {
            $(this).next().attr("colspan", "3");
            $(this).remove();
        }
    });

    /**
    * Sub navigation settingse 
    */
    $("ul.sf-menu").supersubs({
        minWidth: 10,   // minimum width of sub-menus in em units 
        maxWidth: 27,   // maximum width of sub-menus in em units 
        extraWidth: 1     // extra width can ensure lines don't sometimes turn over 
        // due to slight rounding differences and font-family 
    }).superfish().find('ul').bgIframe({ opacity: false });

});

/**
* Fancybox
*/
$(document).ready(function() {
    $(".zoom a").fancybox({
        'hideOnContentClick': true,
        'overlayOpacity': 0.7,
        'overlayColor': '#000',
        'zoomSpeedIn': 500,
        'zoomSpeedOut': 500,
        'frameWidth': 750,
        'frameHeight': 450
    });
});



/*
Changing Form Input Styles on Focus with jQuery
jqueryform1.php
By Sam Dunn
2009 Build Internet! www.buildinternet.com

http://buildinternet.com/2009/01/changing-form-input-styles-on-focus-with-jquery/ */

$(document).ready(function() {
    $(':text:not([class*=noinputstyle])').addClass("idleField");
    $(':text:not([class*=noinputstyle])').focus(function() {   
        $(this).removeClass("idleField").addClass("focusField");   
        if (this.value == this.defaultValue){   
            this.value = '';   
        }    
        if(this.value != this.defaultValue){   
            this.select();   
        }   
    });
    $(':text:not([class*=noinputstyle])').blur(function() {   
        $(this).removeClass("focusField").addClass("idleField");   
        if ($.trim(this.value) == ''){   
            this.value = (this.defaultValue ? this.defaultValue : '');   
        }   
    });
});


