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();
	});
};
var m = (function() {
	return { 
		primary: {
			navOpen: function() {
				$(this).addClass('over');
				if(m.vars.ddmenuitem!=0) {
					m.primary.navCanceltimer(m.vars.ddmenuitem);
					m.primary.navClose(m.vars.ddmenuitem);
				}
				m.vars.ddmenuitem = "sub"+$(this).attr('id');
				$("#"+m.vars.ddmenuitem).css('visibility', 'visible');
			},
			navClose: function() {
				$("#"+m.vars.ddmenuitem).css('visibility', 'hidden');
			},
			navTimer: function() {
				$(this).removeClass('over');
				m.vars.closetimer = window.setTimeout(m.primary.navClose, m.vars.timeout);
			},
			navCanceltimer: function() {	
				if(m.vars.closetimer) {	
					window.clearTimeout(m.vars.closetimer);
					m.vars.closetimer = null;
				}
			}
		},
		strlen: function( string ) {
			return ("" + string).length;
		},
		validateEmail: function(email) {
			var emailTest = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			if(email=='') {
				return false;
			} else if(!emailTest.test(email)) {
				return false;
			} else {
				return true;
			}
		},
		vars: function() {},
		init: function() {
			$(document).ready(function() {
				m.vars.timeout = 500;
				m.vars.closetimer = 0;
				m.vars.ddmenuitem = 0;
				$("#primaryNav > li.primary").bind('mouseover', m.primary.navOpen);
				$("#primaryNav > li.primary").bind('mouseout', m.primary.navTimer);
				if(location.pathname==='/download_client' || location.pathname==='/download_instructions' || location.pathname==='/download_instructions_mac') {
					$('.roundNW').corners('7px transparent top-left');
					$('.roundNE').corners('7px transparent top-right');
					$('.roundSWSE').corners('7px transparent bottom');
				}
			});
		}
	}
})();
m.init();

m.share = (function() {
	return {
	}
})();