$(document).ready(function(){
	/* read more*/
	$(".view2").click(function() {
		var x = '&#0171; read less';
		$(this).prev('.grin').each(function() {
			var o = { height: this.scrollHeight };
			if (this._opened) { x='read more &#0187;'; o.height = '300px'; }
			this._opened = !this._opened;
			$(this).animate(o, 1000, 'easeOutExpo');
		});
		$(this).html(x);
	});
	$(".view").click(function() {
		var x = '&#0171; read less';
		$(this).prev('.rin').each(function() {
			var o = { height: this.scrollHeight };
			if (this._opened) { x='read more &#0187;'; o.height = '80px'; }
			this._opened = !this._opened;
			$(this).animate(o, 1000, 'easeOutExpo');
		});
		$(this).html(x);
	});
    
    	/* nav slider */
	$("#collapse a.sl").click(function() {
		if($(this).next('div').css('display') == 'none') {
			$(this).siblings('div:visible').each(function() {
				$(this).slideUp('medium');					
			});
			$(this).next('div').slideDown('medium');
		} else {
			$(this).next('div').slideUp('medium');
		}
	});
	$('#content a').each(function() {
		this.onclick=function() { this.blur(); };
	});
	
	/* NET Menu */
	var menu_vis=0;
	var menu_is=false;
	function update_menu() {
		if (menu_vis <= 0 && menu_is) {
			menu_is=false;
			$('#netones').slideUp('fast');
		} else if (menu_vis > 0 && !menu_is) {
			menu_is=true;
			$('#netones').slideDown('fast');
		}
	}
	$('.selector,#netones').hover(function() {
		menu_vis++;setTimeout(update_menu,10);
	},function(){
		menu_vis--;setTimeout(update_menu,100);
	});
	
	
	/* nav active state */
	$('#colcan a').each(function() { if (this.href==location.href) { $(this).addClass('act'); } });

/* marquees */
$('#news marquee, #scrollcan marquee').marquee('pointer').mouseover(function () {
            $(this).trigger('stop');
        }).mouseout(function () {
            $(this).trigger('start');
        }).mousemove(function (event) {
            if ($(this).data('drag') == true) {
                this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
            }
        }).mousedown(function (event) {
            event.preventDefault();
            event.stopPropagation();
            $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
        }).mouseup(function () {
            $(this).data('drag', false);
        });
        
        $("a#mlist").fancybox({
		'hideOnContentClick': false
	});

});

