left_cal = screen.width/2-350;
top_cal = screen.height/2-300;


$(document).ready(function(){
$(".rollover").hover(
 function() {
  curr = $(this).find("img").attr("src");
  overlen = curr.length;
  over = curr.substr(0, overlen-4);
  over = over+'-h.jpg';
  $(this).find("img").attr({ src: over});
 },
 function() {
  $(this).find("img").attr({ src: curr});
 }
)

$(".rollover").find("img").each(function(i) {
  temp = this.src;
  prelen = temp.length;
  pre = temp.substr(0, prelen-4);
  pre = pre+'-h.jpg';
  preload_image_object = new Image();
  preload_image_object.src = pre;
});


$("#PubVac").validate();





});




function limitChars(textid, limit, infodiv)
{
	var text = $('#'+textid).val();	
	var textlength = text.length;
	if(textlength > limit)
	{
		$('#' + infodiv).html('You cannot write more then '+limit+' characters!');
		$('#'+textid).val(text.substr(0,limit));
		return false;
	}
	else
	{
		$('#' + infodiv).html('Te quedan '+ (limit - textlength) +' caracteres..');
		return true;
	}
}


$(function(){
 	$('#comentarios').keyup(function(){
 		limitChars('comentarios', 150, 'charlimitinfo');
 	})
});





function info(load,al){
	ancho = screen.width/2-320;
	alto = screen.height/2-220;

	if(al){
	window.open(load,'pop','left='+ancho+',top='+alto+',width=650px,height='+al+'px');	
	}else{
	window.open(load,'pop','left='+ancho+',top='+alto+',width=650px,height=450px');	
	}
}


function play(load){
	ancho = screen.width/2-320;
	alto = screen.height/2-220;

	window.open(load,'pop','left='+ancho+',top='+alto+',width=500px,height=350px,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0');	

}
