
$(document).ready(function() 
{

$("#tipstoggle").click(
	function() {
		tipsoff();
	
	}
);	

   $.fn.qtip.styles.trtipsright = { // Last part is the name of the style
 
   "font-size" : $('#ct-pagebody').css('font-size'),
   color:  $('.ui-state-default').css('color'),
   background: $('.ui-state-disabled').css('background-color'),
   textAlign: 'center',
   border: {
      width: $('.ui-widget-content').css('border-left-width'),
      radius:1,
      color: $('.ui-widget-header').css('border-top-color')
   },
   padding: "2px",
   tip: 'bottomLeft'
   }

 $.fn.qtip.styles.headerbuttontip = { // Last part is the name of the style
   "font-size" : $('#ct-pagebody').css('font-size'),
   color:  $('.ui-state-default').css('color'),
   background: $('.ui-state-disabled').css('background-color'),
   textAlign: 'center',
   border: {
      width: $('.ui-widget-content').css('border-left-width'),
      radius:1,
      color: $('.ui-widget-header').css('border-top-color')
   },
   padding: "2px",
   tip: 'leftMiddle'
 
 }



  $.fn.qtip.styles.trtipsleft = { // Last part is the name of the style
   "font-size" : $('#ct-pagebody').css('font-size'),
   color:  $('.ui-state-default').css('color'),
   background: $('.ui-state-disabled').css('background-color'),
   textAlign: 'center',
   border: {
      width: $('.ui-widget-content').css('border-left-width'),
      radius:1,
      color: $('.ui-widget-header').css('border-top-color')
   },
   padding: "2px",
   tip: 'bottomRight'
}


      // By suppling no content attribute, the library uses each elements title attribute by default
  
   createTips();
});

function createTips() {
<!--	$("#tipstoggle").html("Turn off Tips"); -->
	$("#tipstoggle").qtip({
		content: {
			title: $(this).attr('title')
		},
		style: {
			"font-size" : $('#ct-pagebody').css('font-size'),
			color:  $('.ui-state-default').css('color'),
			background: $('.ui-state-disabled').css('background-color'),
			textAlign: 'center',
			border: {
				width: 1,
				radius:3,
				color: $('.ui-widget-header').css('border-left-color')
			},
			padding: "3px",
			tip: "bottomRight"
		},

		position: { 
			corner: {
				target: 'topMiddle',
				tooltip: 'rightBottom'
			}
		},
		show: { 
		  	effect: {
				delay: 250,
				type: 'fade'
			}
		}
	});   
	
	   $('#ct-pagebody button[title]').qtip({
      content: {
            title: $(this).attr('title')
      },
      position: { 
	  	corner: {
			target: 'rightMiddle',
			tooltip: 'leftMiddle'
   		}
	  },
		show: { 
		  	effect: {
				delay: 250,
				type: 'fade'
			}
		},
      style: 'headerbuttontip' // Give it some style
   });
	   
	 $('.tour_action_column a[title]').qtip({
      content: {
        title: $(this).attr('title')
      },
      style: 'trtipsright', // Give it some style
	  position: { 
   		corner: {
			target: 'topMiddle',
			tooltip: 'leftBottom'
   		}
	  },
	  		show: { 
		  	effect: {
				delay: 250,
				type: 'fade'
			}
		}

   });

	 $('.tour_view_column a[title]').qtip({
      content: {
        title: $(this).attr('title')
      },
      style: 'trtipsright', // Give it some style
	  position: { 
   		corner: {
			target: 'topMiddle',
			tooltip: 'leftBottom'
   		}
	  },
	  		show: { 
		  	effect: {
				delay: 250,
				type: 'fade'
			}
		}

   });
	 
 	 $('.tips button[title]').qtip({
      content: {
        title: $(this).attr('title')
      },
      style: 'trtipsright', // Give it some style
	  position: { 
   		corner: {
			target: 'topMiddle',
			tooltip: 'leftBottom'
   		}
	  },
	  		show: { 
		  	effect: {
				delay: 250,
				type: 'fade'
			}
		}

   });
   

}

function tipsoff() {
	outer=0;
	$("#tipstoggle").qtip("hide");
	$("#tipstoggle").html("");
	$("#tipstoggle").qtip("destroy");
    $(".tour_action_column a[title]").qtip("destroy");    
	$(".tour_view_column a[title]").qtip("destroy");
    $("#ct-pagebody button[title]").qtip("destroy");



	$.ajax({
		type: "POST",
		url: "./",
		data: "ajax=jspref&pref=tipsoff",
		success: function(html){

			   },
		error: 		function(html){

		}

			   

	});
}

function tipson() {
<!-- $("#tipstoggle").html("Tips: On"); -->
	createTips();
		$("#tipstoggle").qtip("enable");	
		$("#tipstoggle").qtip("show");
		$.ajax({
			type: "POST",
			url: "./",
			data: "ajax=jspref&pref=tipson",
			success: function(html){

				   },
			error: 		function(html){

			}

				   

	   	});
}