$(document).ready(function(){

	//opacity hover effect *******
	$(".opacity").hover(
		function () {
			$(this).css({'opacity':'0.9'});
		}, 
		function () {
			$(this).css({'opacity':'1'});
		}
	);

	//email nospam *******
	$('a.email').nospam({replaceText: true, filterLevel: 'low'});

	//external links *******
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});

	//external target on forms *******
	$('form._blank').submit(function() {
		this.target = '_blank';
	});


	//popup-box dialogs *******
	$('a[rel|=popup-box]').each(function() {

		var target = $(this).attr('href');

		$(target).dialog({
			modal: true,
			autoOpen: false,
			height: 400,
			width: 600,
			buttons: {
				Close: function() {
					$(this).dialog('close');
				}
			}
		});
	
		$(this).click(function() {
			$(target).dialog('open');
			return false;
		});
	
	});

}); //doc ready


//defaultValue for inputs ************************
(function($){
	$.fn.clearDefault = function(){
		return this.each(function(){
			var default_value = $(this).val();
			$(this).focusin(function(){
				if ($(this).val() == default_value) { $(this).val(""); }
			}).focusout(function(){
				if ($.trim($(this).val()) == "") { $(this).val(default_value); }
			});
		});
	};
})(jQuery);


/* Plugins
-------------------------------------------------------------- */
// http://www.leftrightdesigns.com/library/jquery/nospam/
jQuery.fn.nospam=function(settings){settings=jQuery.extend({replaceText:false,filterLevel:'normal'},settings);return this.each(function(){e=null;if(settings.filterLevel=='low'){if($(this).is('a[rel]')){e=$(this).attr('rel').replace('//','@').replace(/\//g,'.');}else{e=$(this).text().replace('//','@').replace(/\//g,'.');}}else{if($(this).is('a[rel]')){e=$(this).attr('rel').split('').reverse().join('').replace('//','@').replace(/\//g,'.');}else{e=$(this).text().split('').reverse().join('').replace('//','@').replace(/\//g,'.');}} if(e){if($(this).is('a[rel]')){$(this).attr('href','mailto:'+e);if(settings.replaceText){$(this).text(e);}}else{$(this).text(e);}}});};

