
/* the next line is an example of how you can override default options globally (currently commented out) ... */
 // $.fn.cluetip.defaults.tracking = true;

$(document).ready(function() {

	$('a.tooltip').each(function(){
		$(this).bt({
		  ajaxPath: ["$(this).attr('rel')"],
		    fill: '#F7F7F7', 
			  strokeStyle: '#B7B7B7', 
			  spikeLength: 10, 
			  spikeGirth: 10, 
			  padding: 8, 
			  cornerRadius: 0, 
			  cssStyles: {
				fontFamily: '"lucida grande",tahoma,verdana,arial,sans-serif', 
				fontSize: '13px'
			  }
		});
	 });
	
	
	//$('a.tooltip').cluetip({showTitle: false, cursor: 'pointer'});

 
//default theme
  //$('a.title').cluetip({splitTitle: '|'});
 // $('a.basic').cluetip();
 // $('a.custom-width').cluetip({width: '200px', showTitle: false});
 // $('#clickme').cluetip({activation: 'click', width: 650});

	
});
  
  
function logout(){
	
	FB.ensureInit(function() {
		FB.Connect.logout(reallyLogout());
	})
}

function reallyLogout(){
	//alert('calling logout callback?');
	//setTimeout(function () {window.location.href="/login.php?action=logout";}, 3000);	
	window.location.href="/login.php?action=logout";
}

function setPasswordValue(x){
	if(document.getElementById(x).value == "********"){
		document.getElementById(x).value = "";
	}
}

function widgetLogin(){
		
		var email = $('#login_email').val();
		var password = $('#login_password').val();

		
		$.ajax({
				type: "GET",
				url: "/login.php",
				data: "&email=" + email + "&password=" + password + "&action=login&mode=ajax",
				success: function(results) {
						//alert(results);
						if (results == "success"){
							//$('#login_widget').hide('slow');
							window.location.reload( false );
						}
						else {
							alert("Login information incorrect");	
						}
						//$("#preview_panel").html(results);
				}
		});
	
}

function jsConfirm(question,path){
	if (confirm(question)){
			window.location = path;
	}
}

function submitForm(id)
{
  $('#' + id).submit();
}

function updateLocationFields(){  //USED IN ANY FORMS WHERE WE ASK FOR A LOCATION
		var country = $("#country").val();
		
		$.ajax({
				type: "GET",
				url: "/includes/locations.php",
				data: "&country=" + country,
				success: function(results) {
						$("#location").html(results);
				}
		});	
}


function addFriend(username){
    $.get("/actions.php",
       { action: 'add_friend', f: username},
       function(data){
		   alert(data);
       }
     );
}



