var Actibva_Controller_actualidad =
    {
        initActualidadTabs: function()
        {
		    $("#commento").click(function(){
		        $("#tab1").removeClass('current');
		        $("#tab2").addClass('current');
		        $("#altimapreadposts").hide();
		        $("#altimaposts").hide();
		        $("#commentopreadposts").show();
		        $("#commentoposts").show();
		        
		        return false;
		    });
		    $("#ultima").click(function(){
		        $("#tab2").removeClass();
		        $("#tab1").addClass('current');
		        $("#commentopreadposts").hide();
		        $("#commentoposts").hide();
		        $("#altimapreadposts").show();
		        $("#altimaposts").show();
		        return false;
		        
		    });
       },
       
       initViewMoreUltimaPosts: function()
       {
    	   $("#viewmore").click(function(){
    	        var ctype = $('#act').val();
    	        var offset = $('#aoff').val();
    	        offset = parseInt(offset);
    	        $('#n' + offset).remove();
    	        offset = offset + 25;
    	        preDiv = offset-25;
    	        $('<div id=altima'+ offset +'></div>').insertAfter('#altima' + preDiv);
    	        url  = '/ultimactualidad/record/'+offset;
    	            $.post(url, {},
    	        function (data){
    	            $('#altima' + offset).html(data);
    	      	    $('#altima'+ offset).fadeIn('slow').slideDown('slow');
    	        });
    	        return false;
    	    });
       },
       initViewMoreCommentPosts:function()
       {
    	   $("#previewmore").click(function(){
   	        var ctype = $('#cct').val();
   	        var offset = $('#coff').val();
   	        offset = parseInt(offset);
   	        $('#c' + offset).remove();
   	        offset = offset + 25;
   	        preDiv = offset-25;
   	        $('<div id=commento'+ offset +'></div>').insertAfter('#commento' + preDiv);
   	        url  = '/commentactualidad/record/'+offset;
   	            $.post(url, {},
   	        function (data){
       	            $('#commento' + offset).html(data);
           	        $('#commento'+ offset).fadeIn('slow').slideDown('slow');
   	        });
   	        return false;
   	    });
       },
       
      initActualidadPosts: function()
    	   {
    	   $("#commentoviewmore").click(function(){
   	        var ctype = $('#orderby').val();
   	        var offset = $('#cmoff').val();
   	        offset = parseInt(offset);
   	        $('#c' + offset).remove();
   	        offset = offset + 25;
   	        $('<div id=commento'+ offset +'></div>').insertAfter("#commentopostad");
   	        url  = '/commentactualidad/record/'+offset;
   	            $.post(url, {},
   	        function (data){
   	             $('#commento' + offset).html(data);
   	             $('#commento'+ offset).fadeIn('slow').slideDown('slow');
   	        });
   	        return false;
   	    });
    	   
    	   $("#ultimaviewmore").click(function(){
      	        var ctype = $('#ct').val();
      	        var offset = $('#off').val();
      	        offset = parseInt(offset);
      	        $('#n' + offset).remove();
      	        offset = offset + 25;
      	        $('<div id=altima'+ offset +'></div>').insertAfter("#ultimapostad");
      	        url  = '/ultimactualidad/record/'+offset;
      	            $.post(url, {},
      	        function (data){
      	             $('#altima' + offset).html(data);
      	             $('#altima'+ offset).fadeIn('slow').slideDown('slow');
      	        });
      	        return false;
      	    });
    	   
    	        },
	        initViewMoreMercadosPosts:function()
	        {
	     	   $("#analisis-bolsa .nav a").click(function(){
	     		   	id = $('.analisis-list-item:last').attr('id');
	     		    offset_limit_pcount = id.split('_');
	    	        var offset = offset_limit_pcount[0];
	    	        offset = parseInt(offset);
	    	        url  = '/mercados/'+offset;
	    	        $.post(url, {},
	    	        function (data){	    	        		
	    	            	$('.listado').append(data);
	    	            	id = $('.analisis-list-item:last').attr('id');
	    	            	offset_limit_pcount = id.split('_');
	    	            	if(offset_limit_pcount[1] == offset_limit_pcount[2]) {
	    	            		$('.nav').hide();
	    	            	}
    	            		$('#mercadosoffset').val(offset_limit_pcount[0]);
	    	            	$('.listado').fadeIn('slow').slideDown('slow');
	    	        });
	    	        return false;
	    	    });
	        },
	        
	        
	        
	        initStock:function(value)
	        {
	        	$("#stockgo").click(function(){
	        		stockValue = $("#stockchange").val(); 
	        		url  = '/mercados/'+stockValue;
	        		window.location = url;
	    	        return false;
	        	});
	        	$("#stockchange").val(value);
	        },
	        initSiguenosNewsLetter:function()
	        {
	        	var val = $('#news-mail').val();
	        	$('#news-mail').focus(function() {
		        		if( $('#news-mail').val() == val){
		        			$('#news-mail').val('');
		        		}
	        	});
	        	$('#news-mail').blur(function() {
	        		if($('#news-mail').val() == ''){
	        			$('#news-mail').val(val);
	        		}
	        	});
	        	$('#feedburnerform').submit(function(){
	        		if($('#news-mail').val() == val){
	        			return false;
	        		}
	        	});
	        	
	        },
	        
	        initSiguenosConditionAgree:function()
	        {
		        $('#buttonid').attr('disabled','disabled');
	        	$('#condition_agree').click(function(){
        		if($('#condition_agree').attr('checked') == true)
        		{
        			$('#buttonid').removeAttr('disabled');
        		}else{
        			$('#buttonid').attr('disabled','disabled');
        		}	        	
        		});
	        	
	        }
    }
