$(function() {
	$('#no_javascript_alert').hide();
		$( ".btn_add" ).button({
            icons: {
                primary: "ui-icon-plusthick"
            }
        });
		$('.section_menu h1').click(function() {
			$(this).parent().children('ul').toggle('fast');
		});
		
		$('.form_unique input').click(function() {
			//alert($(this).attr('checked'));
			//alert($(this).parent().parent().children('.form_unique_child').html());
			childdiv=$(this).closest('.form_unique').parent().next('div').children('.form_unique_child');
			if($(this).attr('checked'))
				childdiv.hide();
			else
				childdiv.show();
		});	
	
});


function closeParentDialog(dialog)
	{
	window.parent.$('#'+dialog).dialog('close');
	window.parent.$('#'+dialog).remove();
	return false;	
	}

function openDoalog(link,update_section,heading)
	{
	var horizontalPadding = 15;
	var verticalPadding = 30;
    $('<iframe id="iframe_dialog" frameborder="0" src="' + link + '" />').dialog({
        title: heading,
        autoOpen: true,
        width: 730,
        height: 450,
        modal: true,
        position:'top',
        /*buttons: {
			"Action Complete? Click here to CLOSE": function() {
				$( this ).dialog('close');
				$( this ).remove();						
			}
		},*/	            
        overlay: {
            opacity: 0.5,
            background: "black"
        },/*
        open: function(event, ui) {
        	  $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close').hide();
        	},*/
        close: function(event, ui) {
        		$( this ).remove();	
        		$('#'+update_section).children('#form_section_content').load(link+'&action=view');
            }	            	
    }).width(730 - horizontalPadding).height(450 - verticalPadding);	
	}
