$(document).ready(function(){
	$('.popup-link').click(function(event){
		event.preventDefault();
		window.open($(this).attr('href'), 'explaindialog' + new Date().getTime(), 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,height=290,width=400,scrollbars=1');
	});
	
	$('.popup-link-large').click(function(event){
		event.preventDefault();
		window.open($(this).attr('href'), 'explaindialog' + new Date().getTime(), 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,height=590,width=700,scrollbars=1');
	});
	
	$('input.hint').ezpz_hint();
	
    $(function() {
        $('textarea.editable-procedure-field').tinymce({
                // Location of TinyMCE script
                script_url : '/assets/js/tinymce/jscripts/tiny_mce/tiny_mce.js',

                // General options
                theme : "advanced",
                plugins : "",

                // Theme options
                theme_advanced_buttons1 : "",
                theme_advanced_buttons2 : "",
                theme_advanced_buttons3 : "",
                theme_advanced_buttons4 : "",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_statusbar_location : "bottom",
                theme_advanced_resizing : true,
				theme_advanced_statusbar_location: "none",
				width: 500,

                // Example content CSS (should be your site CSS)
                content_css : "/assets/stylesheets/tinymce.css"
        });
    });
    
    $('#local-information-view-form #type').change(function(){
    	if($(this).val() == 'Standard Documents')
    	{
    		$('#subcategory').parent().slideDown('slow');
    	}
    	else
    	{
    		$('#subcategory').parent().slideUp('slow');
    	}
    });
    
    $('#local-information-view-form #category').change(function(){
    	$.post('/category/get_subcategory_options/', {category: $(this).val()}, function(data){
    		$('#subcategory').html(data);
    		$("#subcategory option:first").attr('selected','selected');
    	});
    });
});

