// JavaScript Document
			$(function(){
				// Dialog			
				$('#track_dialog').dialog({
					autoOpen: false,
					modal: true,
					position: "top" ,
					buttons: {	"Cancel": function() { 
							$(this).dialog("close");
						}
					}
				});
				
				// Dialog Link
				$('#login').click(function(){
					$('#track_dialog').dialog('open');
					
					$.ajax({
					  url: "includes/setname.php",
					  cache: false,
					  success: function(html){
						$("#track_dialog").html(html);
					  }
					});

					return false;
				});

				//hover states on the static widgets
				$('#dialog_link, ul#icons li').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);
				
//-----------------------------RGISTRATION DIALOG---------------------------------------
								
		
		$("#register_dialog").dialog({
			bgiframe: true,
			autoOpen: false,
			height: 320,
			modal: true,
			buttons: {
				'Create an account': function() {
					name = $("#username");
					email = $("#email"),
					password = $("#password"),
					fullname = $("#fullname");
					
	
						var postdata = $("#registration").serialize();
						$("#register_dialog").html("<p>Please wait while we process your registration...</p><p>&nbsp;</p><img src=\"images/ajax-loader.gif\" />");
						 $.ajax({
  						 type: "POST",
						   url: "includes/register.php",
						   data: postdata,
						   success: function(msg){
							$("#register_dialog").html(msg); 
						   }
						 });

				},
				Retry: function() {
										$.ajax({
					  url: "includes/register.php",
					  cache: false,
					  success: function(html){
						$("#register_dialog").html(html);
					  }
											   });
				}
			},
			close: function() {
				allFields.val('').removeClass('ui-state-error');
			}
		});
				
					$('#register').click(function(){
					$.ajax({
					  url: "includes/register.php",
					  cache: false,
					  success: function(html){
						$("#register_dialog").html(html);
					  }
					});
					$('#register_dialog').dialog('open');
					return false;
				});
				
			});

