// JavaScript Document
	//function ajax_message_update(){
		//$("#ajax_message_updater").load(BASE_URL+'member/messages/view_messages_ajax')};
		
// Functon to Show out Busy Div
	function showBusy(){
		$('#ajax_content').prepend('<img id="spinner" src="'+BASE_URL+'/assets/images/public/ajax-loader.gif" />');
	}

	function updatePage(html){
		$('#ajax_content').html(html);
	 }

// Public Functions
$(document).ready(function(){		
		//setInterval(ajax_message_update, 5000);
		
	
	// Load dialog on click
		
		
		// Flash Data Modal 
		$( "#flashdata" ).dialog({
			autoOpen: true
		});
		
		// Tabs for Resume View
		$("#tabs").tabs();
				
		// Accordion
		$(".accordion").accordion({
			collapsible: true,
            autoHeight: false
				
		});
		
		    // Add VideoJS to all video tags on the page when the DOM is ready
    //VideoJS.setupAllWhenReady();
		
		// Sidemenu Accordion
		$("#sidemenu").accordion({
			collapsible: true,
                        autoHeight: false
		});

		
		// Sets Table row zebra look
		$(".mytable tr:even").addClass("alt-row");
		
	
		
		$(".delete").dialog();
		
	
		
			// Overlay
		$("#img_form").dialog({
			autoOpen: false,
			show: "blind",
			width: 450
		});
		
		$("#opener").click(function(){
			$("#img_form").dialog("open");
			return false;
		});
		
		// Datepicker
		$(".datepicker").datepicker({
			changeMonth: true,
			changeYear: true	
		});
		
		// Phone Mask
	   	$(".phone").mask("(999) 999-9999");
		$(".datepicker").mask("99/99/9999");
		$(".date").mask("99/99/9999");
		$(".zip_code").mask("99999");
		
		// Edit me
		$('.member_info input[type=text]').editme();
		
		// $.AJAX Example Request
		$('.ajax_pag > li a').live('click', function(eve){
		eve.preventDefault();
		
		var link = $(this).attr('href');
		
		$.ajax({
			url: link,
			type: "GET",
			dataType: "html",
			beforeSend: function(){
				showBusy();
			},	
		  	success: function(html) {
		    	updatePage(html);
		 	}
		});
		

	  });	
	  
	  
     // Form Submit
	 
	 $('#ajax_submit').click(function(e){
            e.preventDefault();
            $.post(
                $(this).closest('form').attr('action'),
                $(this).closest('form').serialize(),
                function(data){
                    $('#result').html(data),
					$('#ajax_form').hide(),
					$('#success').html('Email was sent')
                },
                'html'
            );
        });
	
	
	 // Editor for Job Posting
	 $(".txtDefaultHtmlArea").htmlarea({
		 	toolbar: ["bold", "italic", "underline", "|","p","justifyleft","justifycenter","justifyright","indent","outdent","|", "h1", "h2", "h3", "h4", "h5","increasefontsize","decreasefontsize","|","link","unlink","|","image","|","orderedlist","unorderedlist","|","cut","copy","paste","|","html"]
		 }); // Initialize jHtmlArea's with all default values
	
	// Adds a glow to the forms
	$('.uniForm').uniform();
	
	// Tiger Stripe Table Rows
	$('.stripMe tr:even').addClass('alt');
	
	// Password Changer
	$('#submit-form').click(function(){
		var password = $('#password').val(); 
		var c_password = $('#confpassword').val();
		
		if(password == "") {
			$('#success').html('<h4>Please input a password</h4>');	
		}
		
		if(password == c_password) {
			
			$.post('member/password');
				
			
		} else {
			$('#success').html('Passwords do Not Match');
		}
		
		return false;
	});
	
	// OSX Drop Down Overlay
	var OSX = {
		container: null,
		init: function () {
			$("input.osx, a.osx").click(function (e) {
				e.preventDefault();	

				$("#osx-modal-content").modal({
					overlayId: 'osx-overlay',
					containerId: 'osx-container',
					closeHTML: null,
					minHeight: 180,
					opacity: 65, 
					position: ['0',],
					overlayClose: true,
					onOpen: OSX.open,
					onClose: OSX.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx-modal-content", self.container).show();
				var title = $("#osx-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h}, 
							400,
							function () {
								$("div.close", self.container).show();
								$("#osx-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};

	OSX.init();
	
	
	 
});
