// JavaScript Document
var fancyOptions = {
'width' : '75%',
'height' : '75%',
'autoScale' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'hideOnContentClick': true,
'onClosed' : function(){$('#openDoc').remove()}
};

$(document).ready(function(){
	$('#testButton').click(function(){
		openDoc("junta2011.html");
	});
});
	
openDoc = function (docUrl){	
	if(docUrl!=undefined){
		if($('#openDoc').length>0){
			$('#openDoc').remove();
		}else{			
			newContents='<div id="openDoc"></div>';
		}
		$.fancybox.showActivity();
				
		$.ajax({
		  url:docUrl,
		  success: function(data) {
			//$.fancybox('<div id="openDoc">'+data+'</div>');
			$.fancybox('<div id="openDoc">'+data+'</div>');
		  },
		  error:function(responseText, textStatus, XMLHttpRequest){
			  alert("ERROR");
			var msg = "Disculpe, ha habido un error: ";
			$.fancybox('<div class="message error">'+msg + xhr.status + " " + xhr.statusText+'</div>');			
		  },
		  dataType:'html'
		  
		});		
		
	}
}	
