$(document).ready(function() {
	$('#tabmtlrd > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
	$('#featuredvid >  ul').tabs();
	
});


$(function() {

	$("div.panel_button").click(function(){

		$("div#panel").animate({

			height: "520px"

		})

		.animate({

			height: "500px"

		}, "slow");

		$("div.panel_button").toggle();

	

	});	

	

   $("div#hide_button").click(function(){

		$("div#panel").animate({

			height: "0px"

		}, "slow");

		

	

   });	

	

});


$(function(){

	$("#myController").jFlow({
		slides: "#mySlides",
		controller: ".jFlowControl", // must be class, use . sign
		slideWrapper : "#jFlowSlide", // must be id, use # sign
		selectedWrapper: "jFlowSelected",  // just pure text, no sign
		width: "1000px",
		height: "260px",
		duration: 1800,
		prev: ".jFlowPrev", // must be class, use . sign
		next: ".jFlowNext" // must be class, use . sign
	});
});

//lightbox

$(function() {
	$('#gallery a').lightBox({fixedNavigation:true});
});

//back to top

$(function() {
	$('.backtotop').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
	});
});

//styleswitch

$(function() {
   $('.styleswitch').click(function()
   {
      switchStylestyle(this.getAttribute("rel"));
      return false;
   });
   var c = readCookie('style');
   if (c) switchStylestyle(c);
});

function switchStylestyle(styleName)
{
   $('link[@rel*=style][@title]').each(function(i)
   {
      this.disabled = true;
      if (this.getAttribute('title') == styleName) this.disabled = false;
   });
   createCookie('style', styleName, 365);
}


jQuery(' legend').each(function(i){
  jQuery(this).replaceWith("<h2>" + jQuery(this).html() + "<\/h2>");
});

//cufon text replacement for mtlrd heading

Cufon.replace('h3', {textShadow: '#151515 -1px -1px, #000 -1px -2px'});
Cufon.replace('h2', {textShadow: '#151515 -1px -1px, #000 -1px -2px'});
Cufon.replace('h1')('h2')('h3')('h4')('h5')('legend')('label')('em#extra_info_name')('a.sidebar_media_link');
Cufon.replace('h3', {
	color: '-linear-gradient(#222, 0.2=#333, 0.8=#444, rgb(0, 0, 0))'
});
Cufon.replace('.post h2', {
	color: '-linear-gradient(#a52e63, 0.2=#8e3957, 0.9=#a52e63, rgb(0, 0, 0))'
});

Cufon.replace('.post_round h2', {
	color: '-linear-gradient(#a52e63, 0.2=#8e3957, 0.9=#a52e63, rgb(0, 0, 0))'
});

/*
Cufon.replace('.post_round h2 span', {
	color: '-linear-gradient(#fbfbfb, 0.2=#fff, 0.8=#333, rgb(0, 0, 0))'
});
*/


Cufon.replace('em#extra_info_name', {
	color: '-linear-gradient(#222, 0.2=#333, 0.8=#444, rgb(0, 0, 0))'
});

