/* global.js */

$(document).ready(function(){

	/* ---- is JavaScript enabled? ---- */
	$('body').addClass('hasJS');

	/* ---- fix IE ClearType issues ---- */ 
	jQuery.fn.fadeIn = function(speed, callback) {
		return this.animate({opacity: 'show'}, speed, function() {
			if (jQuery.browser.msie) {
				this.style.removeAttribute('filter');
			}
			if (jQuery.isFunction(callback)) {
				callback();
			}
		});
	};

	jQuery.fn.fadeOut = function(speed, callback) {
		return this.animate({opacity: 'hide'}, speed, function() {
			if (jQuery.browser.msie) {
				this.style.removeAttribute('filter');
			}
			if (jQuery.isFunction(callback)) {
				callback();
			}
		});
	};

	jQuery.fn.fadeTo = function(speed,to,callback) {
		return this.animate({opacity: to}, speed, function() {
			if (to === 1 && jQuery.browser.msie) {
				this.style.removeAttribute('filter');
			}
			if (jQuery.isFunction(callback)) {
				callback();
			}
		});
	};

	/* ---- input hint ---- */
	$('input[title!=""]').hint();

	/* ---- for International Links ---- */
	var international = $('#international');
	
	var internationalLink = $('li#international_toggler a');
	
	function internationalIn() {
		internationalLink.addClass('selected');
		international.fadeIn();
	}
	function internationalOut() {
		internationalLink.removeClass('selected');
		international.fadeOut();
	}
	function toggleInternational() {
		if ( internationalLink.hasClass('selected') === true ) {
			internationalOut();
		} else {
			internationalIn();
		}
		return false;
	}
		
	internationalLink.click( toggleInternational ).blur(function() {
		internationalLink.removeClass('selected');
		international.fadeOut();
	});

});