$(document).ready(function(){		//post hover	$('.post_inner, .bigger_post_inner').mouseenter(function(){		$(this).find('.read_more_btn').show();	}).mouseleave(function(){		$(this).find('.read_more_btn').hide();	});	    // twitter_status    $('.twitter_widget').each(function(){        var me = $(this);        var link = me.find('.twitter_link');        var api_url = link.attr('rel');        var status = me.find('.twitter_status');        $.ajax({            url: api_url,            type: "POST",            dataType: "json",            success: function(data){                if(data) {                    link.attr('href', 'http://twitter.com/'+data.user);                    status.text(data.status);                }            }        });    });    // comment    $('.submit_comment').each(function(){        var me = $(this);        var form = me.parents('form');        var feedback = form.find('.feedback');        var loader = form.find('.loader');        var author = form.find('input[name="author"]');        var message = form.find('textarea[name="message"]');        var article_id = form.find('input[name="article_id"]');        me.click(function(){            loader.css('display', 'inline');            me.hide();            feedback.text('');            $.ajax({                url: form.attr('action'),                type: "POST",                data: ({                    'article_id' : article_id.val(),                    'author' : author.val(),                    'message' : message.val()                }),                dataType: "json",                success: function(data){                    loader.css('display', 'none');                    feedback.html(data.feedback);                    if((data.code) && (data.code == 'OK')) message.val('');                    me.show();                }            });            return false;        });    });    // send to friend    $('.friend_link').click(function(){        var w = $(window).width();        var h = $(window).height();        var dialog = $('#send_to_friend').clone().appendTo('body');        var dimming = $('.dimming').css({'height':h+'px', 'width':w+'px'});        var close = dialog.find('.close');        var submit = dialog.find('.submit');        var form = dialog.find('form');        var loader = dialog.find('.loader');        var feedback = dialog.find('.feedback');        dialog.css({'left':((w-dialog.outerWidth())/2)+'px', 'top':((h-dialog.outerHeight())/2)+'px'});        submit.click(function(){            loader.css('display', 'inline');            submit.hide();            feedback.text('');            $.ajax({                url: form.attr('action'),                type: "POST",                data: ({                    'from_name' : dialog.find('input[name="from_name"]').val(),                    'from_email' : dialog.find('input[name="from_email"]').val(),                    'to_name' : dialog.find('input[name="to_name"').val(),                    'to_email' : dialog.find('input[name="to_email"]').val(),                    'message' : dialog.find('textarea[name="message"]').val(),                    'url' : dialog.find('input[name="url"]').val()                }),                dataType: "json",                success: function(data){                    loader.css('display', 'none');                    if((data.code) && (data.code == 'OK')) {                        submit.remove();                        feedback.text(data.feedback);                        var s = 5;                        var countdown = setInterval(function(){                            if(s==1) {                                dialog.remove();                                dimming.hide();                            } else {                                s--;                                feedback.text(feedback.text().replace(s+1, s));                            }                        }, 1000);                    } else {                        feedback.text(data.feedback);                        submit.show();                    }                }            });            return false;        });        close.click(function(){            dialog.remove();            dimming.hide();            return false;        });        dimming.show();        dialog.show();        return false;    });    // thumbs    /*    $('.lightbox').lightBox({        imageLoading: ASSETS_URL + 'global/graphics/lightbox/lightbox-ico-loading.gif',        imageBtnClose : ASSETS_URL + 'global/graphics/lightbox/lightbox-btn-close.gif',        imageBtnNext : ASSETS_URL + 'global/graphics/lightbox/lightbox-btn-next.gif',        imageBtnPrev  : ASSETS_URL + 'global/graphics/lightbox/lightbox-btn-prev.gif',        imageBlank : ASSETS_URL + 'global/graphics/lightbox/lightbox-blank.gif'    });*/    // print link    $('.print_link').click(function(){        window.print();        return false;    });    // slideshow    $('.slideshow').each(function(){        var me = $(this);        var items = me.find('.item');        var i=0;        $(items.get(i)).fadeIn(1000);        var timer = setInterval(function(){            $(items.get(i)).fadeOut(1000, function(){                if(i<(items.length-1)) i++;                else i=0;                $(items.get(i)).fadeIn(1000);            });        }, 6000);    });    // side_bar    setTimeout(function(){        $("#side_bar").each(function(){            var me = $(this);            var wh = $(window).height();            var bh = $('body').outerHeight();            var sh = me.outerHeight();            if(sh<wh) {                if(bh<wh) me.height(wh);                else me.height(bh);            } else if(sh<bh) {                me.height(bh);            }        });    }, 500);        // font btn    $('#font_btn').each(function(){        var step = 0;        var max = 2;        $(this).click(function(){            step++;            if(step > max) {                 $('body').animate({'font-size':'1em'});                step = 0;            } else {                $('body').animate({'font-size':'1.'+step+'em'});            }            return false;        });    });    // submit_link    $('.submit_link').click(function() {        $(this).parents('form').submit();        return false;    });    // labeled_input    $('.labeled_input').each(function(){        var me = $(this);        me.data('caption', me.attr('value'));        me.focus(function(){            if($(this).attr('value')==me.data('caption')) $(this).attr('value', '');        });        me.blur(function(){            if(!$(this).attr('value')) $(this).attr('value',me.data('caption'));        });    });    // post hover    $('a.segment').each(function(){        $(this).mouseenter(function(){            $(this).parent().find('.plus_btn').show();        }).parent().mouseleave(function(){            $(this).find('.plus_btn').hide();        });    });    /*$(window).wresize(function(){        var vw = $(window).width();        if(vw < 1000) {            $('#content').css('width', '1000px');        } else if($('#content').width()<vw) {            $('#content').css('width', 'auto');        }    });*/    // top_menu    $('#header').each(function(){        var me = $(this);        var subs = me.find('.menu_sub');        var cats = me.find('.menu_cat');        var animation;        var stopAnim;        cats.mouseenter(function(){            clearTimeout(stopAnim);            animation = setTimeout(function(){                me.stop().animate({height:me.find('table').outerHeight()+'px'});            }, 200);        }).mouseleave(function(){            clearTimeout(animation);            stopAnim = setTimeout(function(){                me.stop().animate({height:'66px'});            }, 200);        });        subs.mouseenter(function(){            clearTimeout(stopAnim);        }).mouseleave(function(){            clearTimeout(animation);            stopAnim = setTimeout(function(){                me.stop().animate({height:'66px'});            }, 200);        });    });        $('.year_title').click(function(){    	$(this).next().slideToggle();    	return false;    });});
