/**
 * @author user
 */

	$(document).ready(function(){

		$('#formlogin').find('input.textbox').each(function(x, elem){
			$(elem).val( $(elem).attr('prevalue') );
		});
		
		$('input.textbox', $('#formlogin')).focus(function(){		
			if ($(this).val() == $(this).attr('prevalue')) {
	  		$(this).val('');
	  	}
		}).blur(function(){
			if ($(this).val() == ''){
		  	$(this).val($(this).attr('prevalue'));
	  	}
		})	

		/* social network png */
		var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);
		
		if (jQuery.browser.msie && ie6)
		{
			$('#master').find('img.socialbutton').each(function(x, elem){
				var newhtml = '<span title="' + $(elem).attr('alt') + '" alt="' + $(elem).attr('alt') + '" style="width:' + $(elem).width() + 'px; height:' + $(elem).height() + 'px; ';
				newhtml += 'cursor:pointer; background:transparent; position:relative;white-space:pre-line;display:inline-block; ';
				newhtml += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + $(elem).attr('src') + '\', sizingMethod=\'resize\');';
				newhtml += '"></span>';

				$(elem).hide();
				$(elem).after(newhtml);
			});
		}
		
		$('#searchform').bind('submit', function(){
			var searchtext = $('#searchtext').val();
			
			if (searchtext == '') {
	  		alert('Debe ingresar algún texto para la búsqueda');
				$('#searchtext').focus();
	  	}
	  	else {
	  		redirect($(this).attr('action') + '?s=' + searchtext);
	  	}

			return false;
		})
		
		
		$('#' + THIS_YEAR ,$('#blogarchive')).css('display', '');
		$('#' + THIS_YEAR ,$('#blogarchive')).parent().addClass('elemhover');
		
		$('#' + THIS_YEAR + THIS_MONTH ,$('#blogarchive')).css('display', '');
		$('#' + THIS_YEAR + THIS_MONTH ,$('#blogarchive')).parent().addClass('elemhover');
		
		$('.year', $('#blogarchive')).click(function(){
			var yeardiv = $(this).attr('href');
			//$('.yeardiv', $('#blogarchive')).css('display', 'none');
			
			$('#' + yeardiv, $('#blogarchive')).css('display', '');
			$(this).parent().addClass('elemhover');
			
			return false;
		});
		
		$('.month', $('#blogarchive')).click(function(){
			var monthdiv = $(this).attr('href');
			//$('.monthdiv', $('#blogarchive')).css('display', 'none');
			$('#' + monthdiv, $('#blogarchive')).css('display', '');
			$(this).parent().addClass('elemhover');
			
			return false;
		});

	});

