// <![CDATA[
$(function() {
	// Slider
	$('#coin-slider').coinslider({width:960,height:268,opacity:0.85});
	// radius Box
	
	if (!($.browser.msie && $.browser.version==7)) {
		$('.menusm .top_level, .menusm .top_level, .topnav li a, #nav1 li a').css({"border-radius":"15px", "-moz-border-radius":"15px", "-webkit-border-radius":"15px"});
	}
	
	$('.topnav ul, #nav1 ul').css({"border-radius":"19px", "-moz-border-radius":"19px", "-webkit-border-radius":"19px"});
	$('.topnav ul li ul li ul, #nav1 ul li ul li ul').css({"border-top-left-radius":"19px", "border-top-right-radius":"19px", "-moz-border-radius-topleft":"19px", "-moz-border-radius-topright":"19px", "-webkit-border-top-left-radius":"19px", "-webkit-border-top-right-radius":"19px"});
	$('.post-date, .post-leav a, #rightcol, .wp-pagenavi a, .wp-pagenavi .current, .index-cols .underh2, .index_rm').css({"border-radius":"6px", "-moz-border-radius":"6px", "-webkit-border-radius":"6px"});
});

// Cufon
Cufon.replace('h1, h2, h3', { hover: true });

// ]]>



jQuery(function($) { 
	$('.index-col:last').addClass('last');
	
	$('.menusm > li > ul').each(function() {
		if ($(this).parent().width() > $(this).width()) {
			$(this).css('width', '100%');
		}
	});

	$('#popup_sidebar .widget .wtitle h2 a').click(function() {
		$(this).parents(':eq(2)').find('.content').slideToggle();
		return false;
	});

	$('#popup_sidebar .widget').each(function() {
		if ( $(this).find('#gforms_confirmation_message').length || $(this).find('.validation_message').length ) { 
			 $(this).find('.content').show();
		}
	});

	function position_the_widgets() {

		var widgetWidth=217;
		var spaceWidth=30;

		if ( (widgetWidth*4+spaceWidth*5) >= $(window).width()) {
			var offset = spaceWidth*2;
		} else {
			var offset=($('body').width()-4*widgetWidth)/2;	
		}
		
		var counter=1;
		$('#popup_sidebar .widget').each(function () {
			$(this).css('left', (counter-1)*widgetWidth+offset-55 + (counter-1)*spaceWidth + 'px');
			counter++;
		});
		
		$('#popup_sidebar').css('left', ($('body').width()-$('#popup_sidebar').width())/2);
		
	}

	position_the_widgets();

	$(window).resize(function() {
		position_the_widgets();
	});

});
