// functions	

	function confirm_delete(dialog_id, link) {
		$("#"+dialog_id).dialog( 'option', 'buttons',{ "Delete": function() { window.location = link },Cancel: function() { $(this).dialog('close');} }).dialog('open');
	}
	
	
	function confirm_delete_page(link) {
		$("#delete_page").dialog( 'option', 'buttons',{ "Delete": function() { window.location = link },Cancel: function() { $(this).dialog('close');} }).dialog('open');
	}
	
	function expand_subpages(id)
	{	
		$('#'+id+'')[ $('#'+id+'').is(':visible') ? 'slideUp' : 'slideDown']('slow');
			return false;
	}

// modal confirm delete

$(function() {

		$(".delete_confirm").dialog({
			autoOpen: false,
			bgiframe: true,
			resizable: false,
			modal: true,
			overlay: {
				backgroundColor: '#000',
				opacity: 0.5
			}
		});
		$("#delete_page").dialog({
			autoOpen: false,
			bgiframe: true,
			resizable: false,
			modal: true,
			overlay: {
				backgroundColor: '#000',
				opacity: 0.5
			}
		});
		
		jQuery.validator.addMethod("login", function(value, element) { 
		var response = $.ajax({
			type: "POST",
			async: false,
			url: "login_exist",
			data: "login="+value,
			cache: false
		}).responseText;
		if(response == '1'){return false;}else{return true;}
		}, "This login is already used!");


		
		
		
	});

