
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=$.extend({},options);options.expires=-1}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires='; expires='+date.toUTCString()}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('')}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};

//////////////////////////////////////////////////

function left_sub_menu_show(id)
{
    var el = $('#left_sub_menu_' + id);
    //$('.id_left_sub').hide('normal');
    el.show('normal');
}

function left_sub_menu_hide(id)
{
    var el = $('#left_sub_menu_' + id);
    el.hide('normal');
}

function initialize()
{

/*
    $('.submenu a').hover(function()}{
        left_sub_menu(id);
    }, function(){
        left_sub_menu(id);
    });
*/

    var h1 = $('.menu-bg').height();
    var h2 = $('.latest-news').height();
    var h3 = $('.part3').height();
    var h4 = $('.markets-bg').height();

/*
    if (h2 < h3) {
        $('.latest-news-center').height(h3);
    }

    if (h1 < h2) {
        $('.latest-news-center').height(h1);
    }

    if (h3 > h4) {
        $('.markets-center').height(h3);
    }
*/

    $('div.latest-news-description-block:first').show();
    $('div.latest-news-list-date-title a, div.latest-news-arrow img').click(function(){
        $('div.latest-news-description-block').hide();
        $(this).parent().parent().next().toggle();
    });

    $('div.content2-news-list-desc:first').show();
    $('div.content2-news-list a, div.content2-news-arrow img').click(function(){
        $('div.content2-news-list-desc').hide();
        $(this).parent().parent().next().toggle();
    });

    if ($.cookie('caucasus_capital_home_tabs') == 'world') {
        market_world();
    } else {
        market_geo();
    }
    $('#georgian-market').click(market_geo);
    $('#world-markets').click(market_world);

}

function market_geo()
{
    $.cookie('caucasus_capital_home_tabs', 'geo', { path: '/', expires: 90 });
    $('#georgian-market').css('backgroundImage', 'url(img/georgian-market-dark.png)');
    $('#world-markets').css('backgroundImage', 'url(img/world-markets-light.png)');
    $('#market-world').hide();
    $('#market-geo').show();
}

function market_world()
{
    $.cookie('caucasus_capital_home_tabs', 'world', { path: '/', expires: 90 });
    $('#world-markets').css('backgroundImage', 'url(img/world-markets-dark.png)');
    $('#georgian-market').css('backgroundImage', 'url(img/georgian-market-light.png)');
    $('#market-geo').hide();
    $('#market-world').show();
}

$(initialize);

