
var Local = {

    onCommentReply: function(id) {
		Comments.openReply(id);
	},

    onCancelReply: function(id) {
		Comments.closeReply();
	}

};



if(typeof sIFR == "function"){

	sIFR.replaceElement(named({sSelector:"#flip_chart h3.script", sFlashSrc:"/flash/murbia.swf", sColor:"#9E1B32", sLinkColor:"#9E1B32", sHoverColor:"#4A0814", sWmode:"transparent", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left"}));

};


(function() {

var $ = jQuery


$(document).ready(
	function() {
		heroes(true)
		$('.comment-form .input_name input').example('Name');
		$('.comment-form .input_email input').example('Email');
		$('.comment-form .input_comment textarea').example('Comment');
		comments()
	}
)



function heroes(overlay) {
	if(overlay == undefined) {
		var overlay = false
	}
	if($('#imageFadeContainer').size() <= 0) {
		return
	}
	var container = $('#imageFadeContainer')
	var fade = container.find('input[name=fadevalue]').val() * 1000
	var show = container.find('input[name=showvalue]').val() * 1000
	container.children('input').remove()
	var images = container.children()
	if(overlay) {
		container.prepend(
			$(jQuery('<div />'))
				.attr({id: 'hero-fg'})
		)
	}
	images.hide()
	$(images[0]).show().addClass('current')
	if($(images[0]).attr('href') != undefined && overlay) {
		container.find('#hero-fg').bind('click', function(){ window.location = $(images[0]).attr('href') }).css({cursor: 'pointer'})
	}
	setInterval(
		function() {
			if(overlay) {
				container.find('#hero-fg').bind('click', function(){}).css({cursor: 'default'})
			}
			var from = container.find('.current')
			from.removeClass('current')
			var to = (from.next().size() > 0 ? from.next() : $(images[0]))
			to.addClass('current')
			from.fadeOut(fade)
			to.fadeIn(fade)
			if(to.attr('href') != undefined && overlay) {
				container.find('#hero-fg').bind('click', function(){ window.location = to.attr('href') }).css({cursor: 'pointer'})
			}
		},
		fade + show
	)
}

function comments() {
	if(window.location.hash != '#comments') {
		$('#comments').hide()
		if(jQuery.browser.safari) {
			$('#comments').css({display: 'none'})
		}
	}
	
	$('.flip-chart .article div.meta_data a[href=#], .flip-chart #comments a.close').click(function(c) { c.preventDefault(); if(jQuery.browser.msie) { $('#comments').toggle('normal') } else { $('#comments').slideToggle('normal') } })
}

})();

