// window.onload
$(function(){

    var elements = "input[@type=text], input[@type=password], textarea, select";
    $(elements).addClass("inputElement");
    
    /** this script adjusts parent frame if this app is in an iframe **/
    if (top.location != self.location) {
        var height = $("body").height();
        iframe = top.document.getElementById("ssRemoteWindow");
        $(iframe).height(height + 20);
        $(iframe).attr("scrolling", "no");
    }
    /** end iframe stuff **/
    
    if ($.browser.msie) {
        $(elements).focus(function(){
            $(this).addClass("inputElementFocus");
        });
        $(elements).blur(function(){
            $(this).removeClass("inputElementFocus");
        });
    }
    
    $('div.folded-fields').filter(function(){
            errors = $(this).find('.errors').size();
            if (errors) return false;
            return true;
        }).each(function() {
            var foldedFields = $(this).find(".fields");
            foldedFields.hide();
            var folderLink = $(this).find(".label a");
            folderLink.toggle(function(){
            foldedFields.slideDown();
        }, function() {
            foldedFields.slideUp();
        });
    });

});