// Capture XY mouse coordinates with jQuery
var mouseX;
var mouseY;

$(function(){
	$().mousemove(function(e){
		mouseX = e.pageX;
		mouseY = e.pageY;     	  
	}); 
})


$(document).ready(function(){

	// Back-To-Top
	$(window).scroll(function () {
		
		if ($(this).scrollTop() > 400) 
		{
			$('#toTop').fadeIn();
		} 
		else 
		{
			$('#toTop').fadeOut();
		}
	});
	
	$('#toTop').click(function () {
		$('body,html').animate({
			scrollTop: 0
		},
		0);
	});
	// End Back-To-Top
	
	
	// Tool Tips
	$('.tip[title]').qtip({
				
		position: {
			my: 'center left',
			at: 'right center',
			adjust: {
				x: 8,
				y: -2
			}
		},
		style: { 
			classes: 'ui-tooltip-yellow'
		}
	});	
	
	$('.tipE[title]').qtip({
				
		position: {
			my: 'center left',
			at: 'right center',
			adjust: {
				x: 8,
				y: -2
			}
			
		},
		style: { 
			classes: 'ui-tooltip-red'
		}
	});	
	// End Tool Tips



	// qTip tool tips for directory headings
	$('.emhTip[title]').qtip({
				
		position: {
			my: 'center left',
			at: 'right center',
			adjust: {
				x: 8
			}
		},
		
		style: { 
			classes: 'ui-emh ui-tooltip-rounded ui-tooltip-shadow'
		},
		
		show: {
      		solo: true,
			effect: false
   		},
		
		hide: {
			effect: false
		}
	});	
});


function ShowTip(name)
{
	$("#error_"+name).qtip('hide');
	$("#error_"+name).hide(0);
	
	$("#tip_"+name).show(0);
	$("#tip_"+name).qtip('show');
}


function ShowError(name)
{
	$("#tip_"+name).qtip('hide');
	$("#tip_"+name).hide(0);
	
	$("#error_"+name).show(0);
	$("#error_"+name).qtip('show');
}


function Validate(name,check,obj)
{
	if(check == "notEmpty")
	{
		if($.trim(obj.value).length == 0)
		{
			ShowError(name)
		}	
	}
	
	if(check == "notZero")
	{
		if(obj.value == 0)
		{
			ShowError(name)
		}	
	}
}





function WebLink(url)
{
	if(url.length == 0) return "";
	
	url = $.trim(url.toLowerCase());
	
	if(url == "")
	{
		
	}
	else if(url.indexOf("https://") == 0)
	{
		
	}
	else if(url.indexOf("http://") == 0)
	{
		
	}
	else
	{
		url = "http://" + url;
	}
	
	return url;	
	
}

//é
