Stories = {}
Stories.index = {}
Stories.view = {}

Stories.index.load = function () {

	swfobject.embedSWF('/swf/cuentos_index.swf', 'info', '832', '281', '9.0.0', false, flashvars, params, attributes);

}

Stories.view.load = function () {

	$('div.wrap.stories.view div.list a, div.wrap.stories.view h2 a').click(function () {
	
		var t = $(this);
		
		Site.nav.go(t.attr('href'));
	
		return false;
	
	});

}

$(document).ready(function () {

	if (typeof $('div.stories.index')[0] != 'undefined') Stories.index.load();
	if (typeof $('div.stories.view')[0] != 'undefined') Stories.view.load();
	
	
	var q_prefilled = $('div.stories input').val();
	$('div.stories input').focus(function () {
	
		var t = $(this);
		if (t.val() == q_prefilled) t.val('')
	
	});
	$('div.stories input').blur(function () {

		var t = $(this);
		if (t.val() == '') t.val(q_prefilled)

	});
	
	$('div.stories form').submit(function () {
	
		Site.nav.go('/cuentos/search?q=' + $('input[name=q]').val());

		return false;
	
	});

});
