
$(document).ready(function() {

	// Photo Viewer
	$("a[rel^='lightbox']").fancybox(); 

	$(".bgc_homepage_content_column_content").slideDown("slow");
	
	
	$('li.headlink').hover(
		function() { $('ul', this).css('display', 'block'); },
		function() { $('ul', this).css('display', 'none'); }
	);
	
	// Tabs
	$("#tabs").tabs();

	
	// Datepicker
	$('.datepicker').datepicker({ altField: '#actualDate' });
	


    $(".filemanagerdialog").dialog({
		bgiframe: true, autoOpen: false, resizable: false, modal: false, width: 340, title: 'Pick A File / Upload A File'
    });


  $(".togglemce_html").click(function(){toggleMCE_html()});
  $(".togglemce_editor").click(function(){toggleMCE_editor()});
		
		
/*
		$('#save_thumb').click(function() {
			var x1 = $('#x1').val();
			var y1 = $('#y1').val();
			var x2 = $('#x2').val();
			var y2 = $('#y2').val();
			var w = $('#w').val();
			var h = $('#h').val();
			if(x1=="" || y1=="" || x2=="" || y2=="" || w=="" || h==""){
				alert("You must make a selection first");
				return false;
			}else{
				return true;
			}
		});
		
		$('#thumbnail').imgAreaSelect({ aspectRatio: '1:<?php echo $thumb_height/$thumb_width;?>', onSelectChange: preview }); 
*/

	
});		




function toggleMCE_html() {
  tinyMCE.execCommand('mceRemoveControl', false, 'tinymce_editor');
}

function toggleMCE_editor() {
  tinyMCE.execCommand('mceAddControl', false, 'tinymce_editor');
}




/*

function preview(img, selection) { 
	var scaleX = <?php echo $thumb_width;?> / selection.width; 
	var scaleY = <?php echo $thumb_height;?> / selection.height; 
	
	$('#thumbnail + div > img').css({ 
		width: Math.round(scaleX * <?php echo $current_large_image_width;?>) + 'px', 
		height: Math.round(scaleY * <?php echo $current_large_image_height;?>) + 'px',
		marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', 
		marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' 
	});
	$('#x1').val(selection.x1);
	$('#y1').val(selection.y1);
	$('#x2').val(selection.x2);
	$('#y2').val(selection.y2);
	$('#w').val(selection.width);
	$('#h').val(selection.height);
} 
*/


		
