// JavaScript Document

var execAfterLoading = new Array;

var getDate = function () {
	var meses = new Array('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
	var dias = new Array('Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sábado');
	var fecha = new Date();
	var showDay = dias[fecha.getDay()];
	var showDayNumber = fecha.getDate();
	var showMonth = meses[fecha.getMonth()];
	var showYear = fecha.getFullYear();
	showHours = fecha.getHours() < 10 ? '0' + fecha.getHours().toString() : fecha.getHours();
	showMinutes = fecha.getMinutes() < 10 ? '0' + fecha.getMinutes().toString() : fecha.getMinutes();
	showSeconds = fecha.getSeconds() < 10 ? '0' + fecha.getSeconds().toString() : fecha.getSeconds();
	$('#fecha').html(showDay + ' ' + showDayNumber + ' de ' + showMonth + ' de ' + showYear + ' | ' + showHours + ':' + showMinutes + ':' + showSeconds);
	setTimeout(function(){ getDate() }, 1000);
}

var fixTheIEShit = function () {
//	if ( $.browser.msie ) {
		
		var max = 0;
		
		var col1 = $(".spc_menu_left");
		var col2 = $(".spc_main_right");
		var col3 = $(".spc_ads_right");
		
		var col1h = $(col1).height();
		var col2h = $(col2).height();
		var col3h = $(col3).height();
		
		if ( col1h > max ) { max = col1h; }
		if ( col2h > max ) { max = col2h; }
		if ( col3h > max ) { max = col3h; }
		
		col1.css("height",max);
		col3.css("height",max);
		col2.css("height",max);
		
		//alert(col1_height + "\n" + col2_height + "\n" + col3_height);
		
//	}
}



execAfterLoading.push( getDate );
execAfterLoading.push( fixTheIEShit );

function placeVoteSPC(pub) {
	$.ajax({
	   type: "GET",
	   url: "/lamanodedios/content/vote_escort.php",
	   data:'id='+pub,
	   success: function(respuesta) {
	   	if(respuesta != 0) {
	   		document.getElementById('vote_btn').src = 'http://www.gemidos24.com.ar/lamanodedios/templates/Gemidos_Especial_La_Mano_De_Dios/images/es/btn_gracias.gif';
	   		if(respuesta == '1') {
	   			var votes = parseInt(document.getElementById('voteDisplay').innerHTML, 10) + 1;
				document.getElementById('voteDisplay').innerHTML = votes;
			}
		}
		}
	});
}

function swapGemidosGroup(o,action){
	
	var image = o.src.split("/");
	var img_name = image[(image.length - 1)];
	
	var url = "";
	for (var c = 0; c < (image.length - 1); c++){
		url += image[c] + "/";
	}
	
	var img_partes = img_name.split(".");
	
	if (action == 'ovr'){
		var new_img = img_partes[0].substr(0, (img_partes[0].length - 3)) + "." + img_partes[1];	
	} else {
		var new_img = img_partes[0] + "_ds" + "." + img_partes[1];
	}
	
	var new_url = url + new_img;
	o.src = new_url;
}