
// general font replacement styles
Cufon.replace('h1, h2, h3, h4, h5, h6, .fancy_title div');
Cufon.replace('.headline', {textShadow: '1px 1px rgba(255, 255, 255, 1)'})('.ribbon span', {hover: true, textShadow: '-1px -1px rgba(0, 0, 0, 0.4)'});

jQuery(document).ready(function() {
	// image hover effects	
	// -------------------------------------------------------------------
	$j("a.img").hover( function () {
		if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) <= 8)	$j(this).stop(false, true).toggleClass('imgHover')
		else									$j(this).stop(false, true).toggleClass('imgHover', 200)
	});

	// Text and password input styling
	// -------------------------------------------------------------------
	$j("input[type='text']:not(.noStyle), input[type='password']:not(.noStyle)").each(function(){
		$j(this).addClass('textInput');
	});

	// apply custom button styles
	// -------------------------------------------------------------------
	buttonStyles();

	// CSS Rounded Corners (not for IE)
	// -------------------------------------------------------------------
	if (!jQuery.browser.msie) {
		$j("a.img, div.img, .pagination a, .textInput, input[type='text'], input[type='password'], textarea").addClass('rounded');	// items to add rounded class
		roundCorners(); // execute it!
	}
});

function buttonStyles() {
	// This will style buttons to match the theme. If you don't want a button
	// styled, give it the class "noStyle" and it will be skipped.
	$j("button:not(:has(span),.noStyle), input[type='submit']:not(.noStyle), input[type='button']:not(.noStyle)").each(function(){
		var	b = $j(this),
			tt = b.html() || b.val();
		
		// convert submit inputs into buttons
		if (!b.html()) {
			b = ($j(this).attr('type') == 'submit') ? $j('<button type="submit">') : $j('<button>');
			b.insertAfter(this).addClass(this.className).attr('id',this.id);
			$j(this).remove();	// remove input
		}
		b.text('').addClass('btn').append($j('<span>').html(tt));	// rebuilds the button
	});
	
	// Get all styled buttons
	var styledButtons = $j('.btn');
	
	// Fix minor problem with Mozilla and WebKit rendering (can also be done adding this to CSS, 
	// button::-moz-focus-inner {border: none;}
	// @media screen and (-webkit-min-device-pixel-ratio:0) { button span {margin-top: -1px;} }
	if (jQuery.browser.mozilla || jQuery.browser.webkit) {
		styledButtons.children("span").css("margin-top", "-1px");
	}
	
	// Button hover class (IE 6 needs this)
	styledButtons.hover(
		function(){ $j(this).addClass('submitBtnHover'); },	// mouseover
		function(){ $j(this).removeClass('submitBtnHover'); }	// mouseout
	);
}

function roundCorners() {
	jQuery('.rounded, .ui-corner-all').css({
		'-moz-border-radius': '4px',
		'-webkit-border-radius': '4px',
		'border-radius': '4px'
	});
}

