jQuery.noConflict();  
jQuery(document).ready(function() {

// Layout options feature
jQuery('a#options').click(function (){
	if ((jQuery('.layout_options')).is(':hidden')) {
	jQuery('#wrapper').fadeTo('fast', 0.33);
	jQuery('.layout_options').fadeIn('normal');
	} else {
	jQuery('#wrapper').fadeTo('fast', 1.0);
	jQuery('.layout_options').fadeOut('normal');
	}
});

jQuery('.cancel a').click(function() {
	jQuery('#wrapper').fadeTo('fast', 1.0);
	jQuery('.layout_options').fadeOut('normal');
});

jQuery('a#reset').click(function() {
jQuery('.cat-widget').each( function() {jQuery.cookie(jQuery(this).attr('id'), null, { path: '/', expires: 100 }); jQuery(this).show()});
jQuery('.box_a').each( function() {jQuery.cookie(jQuery(this).attr('id'), null, { path: '/', expires: 100 }); jQuery(this).show()});
jQuery('.widgets li').each (function() {jQuery.cookie(jQuery(this).attr('id'), null, { path: '/', expires: 100 }); jQuery(this).show()});
jQuery('.layout_options').fadeOut('normal');
jQuery('#wrapper').fadeTo('fast', 1.0);
});
// done.

// Drop Down Menu (multi level)
jQuery("#menu ul li").hover(function(){
jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(300); 
},function(){
jQuery(this).find('ul:first').css({visibility: "hidden"});
});
// End of Menu

/* various widget actions */
jQuery('.minimize').click(function() {
	jQuery(this).parent('h3').next('.container').toggle();
});

jQuery('.Sminimize').click(function() {
	jQuery(this).parent('h2').next().toggle();
});

jQuery('.Wminimize').click(function() {
	jQuery(this).parent('h2').next().toggle();
});

jQuery('.close').click(function() {
	jQuery(this).parent('h3').parent('.cat-widget').fadeOut('slow');
	jQuery.cookie(jQuery(this).parent('h3').parent('.cat-widget').attr('id'), 'closed', { path: '/', expires: 100 });
	return false;
});

jQuery('.Sclose').click(function() {
	jQuery(this).parent('h2').parent().fadeOut('slow');
	jQuery.cookie(jQuery(this).parent('h2').parent('.box_a').attr('id'), 'closed', { path: '/', expires: 100 });
	return false;
});

jQuery('.Wclose').click(function() {
	jQuery(this).parent('h2').parent().fadeOut('slow');
	jQuery.cookie(jQuery(this).parent('h2').parent('li').attr('id'), 'closed', { path: '/', expires: 100 });
	return false;
});

jQuery('.cat-widget').each( function() {
	var cat_ID = jQuery(this).attr('id');
	if (jQuery.cookie(cat_ID) == 'closed') jQuery(this).hide();
});

jQuery('.box_a').each( function() {
	var box_ID = jQuery(this).attr('id');
	if (jQuery.cookie(box_ID) == 'closed') jQuery(this).hide();
});

jQuery('.widgets li').each (function() {
	var sidebar_ID = jQuery(this).attr('id');
	if (jQuery.cookie(sidebar_ID) == 'closed') jQuery(this).hide();
});

/* control visible stories */
jQuery('ul.more_stories').each(function(index) {
jQuery(this).children('li').slice(3).hide();
});

jQuery('.minus').click(function() {
jQuery(this).parent().next('ul').children('li:visible:last').hide();
});

jQuery('.plus').click(function() {
jQuery(this).parent().next('ul').children('li:hidden:first').show();
});

/* clear form */
clearInput('#feedemail');

jQuery('.videothumb').bind('mouseenter', function() {jQuery(this).children('.playit').children('a').show()});
jQuery('.videothumb').bind('mouseleave', function() {jQuery(this).children('.playit').children('a').hide()});

// do color animation
jQuery('.animate').mouseover(function() {
jQuery(this).css({'background-color' : '#297eb9', 'color' : '#ffffff'});
});

jQuery('.animate').mouseout(function() {
jQuery(this).css({'background-color' : '#ffffff', 'color' : '#297eb9'});
});

});
