
/*******************************************************************************

Theme for PHP-Fusion V7.01
Theme Name: 2Bright
Description: Bright theme, very minimal use of graphics.
    
Version: 1.0
Tags:  dark, two-columns, fixed-width.
Modification: instructions are inside of README file.
        
Author: SimpleVision
email: design@simplevision.dk
site: http://simplevision.dk    

Copyright (c) 2010 SimpleVision.dk
Licences: AGPLv3     
    
******************************************************************************/



$.fn.MakeFusion = function (options) {
    /*----------------------------------------------------------

    Default options 

    -----------------------------------------------------------*/

    var defaults = {
        advSearchLocale: 'Advanced Search',
        thumbsPerRow: 5
    };

    var options = $.extend(defaults, options);


    return this.each(function () {

        if (jQuery.browser.msie) {
            try {
                document.execCommand("BackgroundImageCache", false, true);
            } catch (err) { }
        }
        /*----------------------------------------------------------

        this modifies the look of the Photogallery -> album page 

        -----------------------------------------------------------*/
        var slidediv = "<div id='php' style='min-width:350px;min-width:350px;width:950px;margin:0 auto;padding:10px;padding-top:0'></div>";
        var photos = $(".photogallery_album_photo_link");
        var info = $(".photogallery.css420");
        var title = info.find("div.tbl2").first();
        var width = $("#main").width() - 2;
        var thumbSize = (width - 2 * options.thumbsPerRow) / options.thumbsPerRow;

        title.hide();
        $(".photogallery.css430").remove();
        info.find("td[valign*='bottom']").hide();
        info.find("table").width('100%');
        if (info.length > 0) { $("#bannerdump").append(slidediv).find("#php").html(info.find("table")); }

        photos.each(function () {
            var name = $(this).parent().find("strong");
            $(this).append('<b>' + name.text() + '</b>');
            name.hide();

            $(this).hover(function () {
                $(this).css("position", "relative");
                var img = $(this).find("img");
                var margin = img.height() - (thumbSize / 2);
                img.css("position", "absolute").fadeOut('fast');
            }
    , function () {
        $(this).find("img").fadeIn('fast');
    });
        });

        // reasize images
        photos.each(function () {
            var img = $(this).children("img").first();
            img.css("min-width", thumbSize).css("min-height", thumbSize);
            img.css("max-width", thumbSize * 1.5).css("max-height", thumbSize * 1.5);
        });

        info.after(photos.width(thumbSize).height(thumbSize));

        $(".photogallery_album_photo_link").wrapAll('<div>').parent().addClass("gallery");
        //  $(".panelbody.album_photos").first().css("background", "#fe0");
        $(".panelbody.album_photos:nth-child(3)").find("div:nth-child(2)").css("background", "#fe0");
        // information table
        $(".panelbody.album_photos").first().find("table").first().css("background", "#fff");
        $(".panelbody.album_photos:eq(1)").find("table:eq(1)").find("tr:gt(0)").hide().width("100%").css("background", "#f00");


        /*----------------------------------------------------------

        this modifies the look of the Photogallery -> album list 

        -----------------------------------------------------------*/

        var content = $(".panelbody.photos form[name='move_form'] td");
        //content.find("td").hide();
        content.each(function () {

        });
        $(".panelbody.photos form[name='move_form']").prepend(content);
        //$("#AllPhotosCurrentPhotos table").hide();
        /*----------------------------------------------------------

        SEARCH realted 

        -----------------------------------------------------------*/
        var search = $("#searchform");
        search.before("<a id='searchform_toggle'>" + options.advSearchLocale + "  &#x25BC;</a>");
        $("#searchform_toggle").css("cursor", "pointer").click(function () { search.slideToggle(); });

        /*----------------------------------------------------------

        Whole website layout related fixes

        -----------------------------------------------------------*/
        $("#side .cssglobal_100 div").css("text-align", "left");
        $(".photogallery.css420").hide();
        $(".photogallery.css450 h2").hide();
        $(".photogallery_album_photo_info").hide();
        $(".forum_thread_table .forum_thread_user_name").parent().css("border-top", "1px solid #ddd");

        var top_radius= "border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0";
        var all_radius = "-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;";

        $("#container .current span").attr("style", top_radius);
        $("#container .current span i").attr("style", top_radius);

        $("#container .current:hover span").attr("style", top_radius);

        $("#container .current:hover span i").attr("style", top_radius);
        $("#user-nav").attr("style", "border-radius:0 0 5px 5px ;-moz-border-radius:0 0 5px 5px ");
        $("#banner").attr("style", all_radius);
        $("input[type='button']").attr("style", all_radius);
        $("input[type='submit']").attr("style", all_radius);
    });
};
 
