$(function() {
	$("#increase").click(function(){
		var currentFontSize = $('p').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 12);
		var newFontSize = currentFontSizeNum + 1;
		if (newFontSize < 21) {
			$('p').css('font-size', newFontSize);
		}
		return false;
	});
	
	$("#decrease").click(function(){
		var currentFontSize = $('p').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 12);
		var newFontSize = currentFontSizeNum - 1;
		if (newFontSize > 12) {
			$('p').css('font-size', newFontSize);
		}
		return false;
	});
	$("#increase2").click(function(){
		var currentFontSize = $('p').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 12);
		var newFontSize = currentFontSizeNum + 1;
		if (newFontSize < 18) {
			$('p').css('font-size', newFontSize);
		}
		return false;
	});
	
	$("#decrease2").click(function(){
		var currentFontSize = $('p').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 12);
		var newFontSize = currentFontSizeNum - 1;
		if (newFontSize > 8) {
			$('p').css('font-size', newFontSize);
		}
		return false;
	});

});

function inOpiCol(carousel) {
	$('#nopicol').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#popicol').bind('click', function() {
		carousel.prev();
		return false;
	});
};
function inOpiBlog(carousel) {
	$('#nopiblog').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#popiblog').bind('click', function() {
		carousel.prev();
		return false;
	});
};

function inNtCar(carousel) {
	$('#ncarnt').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#pcarnt').bind('click', function() {
		carousel.prev();
		return false;
	});
};

function inNtCarGallery(carousel) {
	$('#ncargallery').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#pcargallery').bind('click', function() {
		carousel.prev();
		return false;
	});
};

/* carrusel: yoreportero */
function inReport(carousel) {
    $('#prep').bind('click', function() {
        carousel.next();
        return false;
    });
    
	$('#nrep').bind('click', function() {
		carousel.prev();
		return false;
	});
};

/* carrusel: stage home */
function inStage(carousel) {
	$('#pact').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#nact').bind('click', function() {
		carousel.prev();
		return false;
	});
};

function inGal(carousel) {
	$('#ngalst').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#pgalst').bind('click', function() {
		carousel.prev();
		return false;
	});
};

function inCol(carousel) {
	$('#ncols').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#pcols').bind('click', function() {
		carousel.prev();
		return false;
	});
};

function Destacado(carousel) {
	$('#A1').bind('click', function() {
		carousel.next();
		return false;
	});

	$('#A2').bind('click', function() {
		carousel.prev();
		return false;
	});
};

Shadowbox.loadSkin('classic', '../js/src/skin');
Shadowbox.loadLanguage('es', '../js/src/lang');
Shadowbox.loadPlayer([], '../js/src/player');

$(document).ready(function() {					   
	$("#toGo").click(function(){
		$("#toGoContent").toggle("fast");
		return false; 
	});
	
	/*shadowbox*/
	Shadowbox.init();
	
	$(function () {
		var lis = $('#galstage li').size();
		if(lis < 2){
			$('div.stage2 div.navcar').hide();
		}
	});
	/*	
	$(function () {
		var as = $('div.photos a').size();
		if(as < 2){
			$('div.galleryst').hide();
			$('div.gallerynt').hide();
			$('div.galleryntf').hide();
		}
	});
	*/
	
	$(function () {
		var clasificados = $('div.classifieds > div');
		
		$('div.classifieds ul.tab-menu a').click(function () {
		clasificados.hide().filter(this.hash).show();
		
		$('div.classifieds ul.tab-menu a').removeClass('active');
		$(this).addClass('active');
		
		return false;
		}).filter(':first').click();
	});
	
	$(function () {
		var tiempolibre = $('div.ocio > div');
		
		$('div.ocio ul.tab-menu a').click(function () {
		tiempolibre.hide().filter(this.hash).show();
		
		$('div.ocio ul.tab-menu a').removeClass('active');
		$(this).addClass('active');
		
		return false;
		}).filter(':first').click();
	});
	
	$(function () {
		var topnews = $('div.lo-mas-tabs > div');
		
		$('div.lo-mas-tabs ul.tab-menu a').click(function () {
		topnews.hide().filter(this.hash).show();
		
		$('div.lo-mas-tabs ul.tab-menu a').removeClass('active');
		$(this).addClass('active');
		
		return false;
		}).filter(':first').click();
	});
	
	$(function () {
		var featyr = $('div.feat-tabs > div');
		
		$('div.feat-tabs ul.tab-menu a').click(function () {
		featyr.hide().filter(this.hash).show();
		
		$('div.feat-tabs ul.tab-menu a').removeClass('active');
		$(this).addClass('active');
		
		return false;
		}).filter(':first').click();
	});
	
	$(function() {
		var ffeatcat = $('#tabs-yrfotos div.fright > div');
		
		$('ul.pictcategory-tabs li.catsb a').click(function () {
		ffeatcat.hide().filter(this.hash).show();
		
		$('ul.pictfilters-tabs li.filters a').removeClass('active');
		$('ul.pictcategory-tabs li.catsb a').removeClass('active');
		$(this).addClass('active');
		
		return false;
		}).filter(':first').click();
		
		var ffeat = $('#tabs-yrfotos div.fright > div');
		
		$('ul.pictfilters-tabs li.filters a').click(function () {
		ffeat.hide().filter(this.hash).show();
		
		$('ul.pictcategory-tabs li.catsb a').removeClass('active');
		$('ul.pictfilters-tabs li.filters a').removeClass('active');
		$(this).addClass('active');
		
		return false;
		}).filter(':first').click();
	});
	
	$(function() {
		var ffeatcat2 = $('#tabs-yrvideos div.fright > div');
		
		$('ul.vidcategory-tabs li.catsb a').click(function () {
		ffeatcat2.hide().filter(this.hash).show();
		
		$('ul.vidfilters-tabs li.filters a').removeClass('active');
		$('ul.vidcategory-tabs li.catsb a').removeClass('active');
		$(this).addClass('active');
		
		return false;
		}).filter(':first').click();
		
		var ffeat2 = $('#tabs-yrvideos div.fright > div');
		
		$('ul.vidfilters-tabs li.filters a').click(function () {
		ffeat2.hide().filter(this.hash).show();
		
		$('ul.vidcategory-tabs li.catsb a').removeClass('active');
		$('ul.vidfilters-tabs li.filters a').removeClass('active');
		$(this).addClass('active');
		
		return false;
		}).filter(':first').click();
	});

	$("#reportero").jcarousel({
		auto: 0,
		initCallback: inReport,
		wrap: 'both',
		visible: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
	
	$("#newstories").jcarousel({
		auto: 3,
		animation:"slow",
		initCallback: inStage,
		wrap: 'both',
		visible: 2,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
			
	$("#galstage").jcarousel({
		auto: 0,
		initCallback: inGal,
		wrap: 'both',
		visible: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
	
	$("#scolstories").jcarousel({
		auto: 0,
		initCallback: inCol,
		wrap: 'both',
		visible: 3,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
	
	$("#car-nt").jcarousel({
		auto: 0,
		initCallback: inNtCar,
		wrap: 'both',
		visible: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
	$("#ntgal").jcarousel({
		auto: 0,
		initCallback: inNtCarGallery,
		wrap: 'both',
		visible: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
	$("#opinion-col").jcarousel({
		auto: 0,
		initCallback: inOpiCol,
		wrap: 'both',
		visible: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
	$("#opinion-blog").jcarousel({
		auto: 0,
		initCallback: inOpiBlog,
		wrap: 'both',
		visible: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
	$("#jDestacado").jcarousel({
		auto: 0,
		initCallback: Destacado,
		wrap: 'both',
		visible: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null
    });
	
	$('#ctbn').click ( function() {
		$("#vg-ticker").slideUp();
		return false;
	});
	
	$('.close-comm').click ( function() {
		$curr = $(this).parent();
		$curr.siblings().toggle("fast");
		return false; 
	});
	
	$('#selectFile').change ( function() {
		var indx = $("#selectFile").find('option').filter(':selected').text();
		if (indx.indexOf("FOTO") > 1){
			$("#optyrf").show();
			$("#optyrv").hide();
		} else if (indx.indexOf("VIDEO") > 1){
			$("#optyrf").hide();
			$("#optyrv").show();
		} else {
			$("#optyrf").hide();
			$("#optyrv").hide();
		}
	});
	
	
});