/**
 * Init script
 * for Essere insieme
 * (c) by Michal Luberda
 */
 
$ (document).ready (function () {
    // init flash
    var flashvars  = {};
    var params     = {};
    var attributes = {};
    
    swfobject.embedSWF (
        "header.swf",
        "span_subheader",
        "750",
        "175",
        "9.0.0",
        "expressInstall.swf",
        flashvars,
        params,
        attributes
    );
    
    interval = window.setInterval (function () {
        ob.set_height ();
    }, 100);
    window.onresize = ob.set_height ();
    
    // set news as hidden id
    if ($ ("#inputh_news").length) {
        st = location.href.substring (location.href.indexOf ("news=") + 5);
        $ ("#inputh_news").val (st.substring (0, st.indexOf ("&")));
    }
    if ($ (".div_id").length) {
        $ ("#inputh_news").val ($ (".div_id").text ());
    }
});

ob = {
    set_height: function () {
        // set height
        in_height_left   = $ ("#div_content_left").height ();
        in_height_center = $ ("#div_content_center").height ();
        in_height_right  = $ ("#div_content_right").height ();
        
        if (in_height_left > in_height_center && in_height_left > in_height_right) {
            // left
            $ ("#div_content_center").height (in_height_left);
            $ ("#div_content_right").height (in_height_left);
        }
        else if (in_height_center > in_height_left && in_height_center > in_height_right) {
            // center
            $ ("#div_content_left").height (in_height_center);
            $ ("#div_content_right").height (in_height_center);
        }
        else {
            // right
            $ ("#div_content_left").height (in_height_right);
            $ ("#div_content_center").height (in_height_right);
        }
        
        $ ("#div_footer").height (65);
        $ ("#div_footer").height (
            $ (document).height () - $ ("#div_footer").offset ().top - 15
        );
    }
};

