$(document).bind("contextmenu",function(e){
		alert("Right-mouse click has been disabled.");
	return false;
});


// Function to Clear intial value in a form field
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}


$(document).ready(function() {
  function filterPath(string) {
  return string
	.replace(/^\//,'')
	.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
	.replace(/\/$/,'');
  }
  var locationPath = filterPath(location.pathname);
  $('a[href*=#]').each(function() {
	var thisPath = filterPath(this.pathname) || locationPath;
	if (  locationPath == thisPath
	&& (location.hostname == this.hostname || !this.hostname)
	&& this.hash.replace(/#/,'') ) {
	  var $target = $(this.hash), target = this.hash;
	  if (target) {
		var targetOffset = $target.offset().top;
		$(this).click(function(event) {
		  event.preventDefault();
		  $('html, body').animate({scrollTop: targetOffset}, 400, function() {
			location.hash = target;
		  });
		});
	  }
	}
  });
});

// Function fade thumbnails on hover
$(function() {
$('.portfolio li a')
		.mouseover(function(){
			$(this).parent().siblings().stop().fadeTo(600,.35);
		})
		.mouseout(function() {
			$(this).parent().siblings().stop().fadeTo(600,1);
		})
$('.portfolio-rental li a')
		.mouseover(function(){
			$(this).parent().siblings().stop().fadeTo(600,.35);
		})
		.mouseout(function() {
			$(this).parent().siblings().stop().fadeTo(600,1);
		})
		
});


jQuery.fn.defuscate = function( settings ) {
    settings = jQuery.extend({
        link: true,
        find: /\b([A-Z0-9._%-]+)\([^)]+\)((?:[A-Z0-9-]+\.)+[A-Z]{2,6})\b/gi,
        replace: '$1@$2'
    }, settings);
    return this.each(function() {
        if ( $(this).is('a[@href]') ) {
            $(this).attr('href', $(this).attr('href').replace(settings.find, settings.replace));
            var is_link = true;
        }
        $(this).html($(this).html().replace(settings.find, (settings.link && !is_link ? '<a href="mailto:' + settings.replace + '">' + settings.replace + '</a>' : settings.replace)));
    });
};


