/**
* Fullscreenr - lightweight full screen background jquery plugin

**/
(function($){	
	$.fn.fullscreenr = function(options) {
		if(options.height === undefined) alert('Please supply the background image height, default values will now be used. These may be very inaccurate.');
		if(options.width === undefined) alert('Please supply the background image width, default values will now be used. These may be very inaccurate.');
		if(options.bgID === undefined) alert('Please supply the background image ID, default #bgimg will now be used.');
		var defaults = { width: 1280,  height: 1024, bgID: 'bgimg' };
		var options = $.extend({}, defaults, options); 
		$(document).ready(function() { $(options.bgID).fullscreenrResizer(options);	});
		$(window).bind("resize", function() { $(options.bgID).fullscreenrResizer(options); });		
		return this; 		
	};	
	$.fn.fullscreenrResizer = function(options) {
		// Set bg size
		var ratio = options.height / options.width;	
		// Get browser window size
		var browserwidth = $(window).width();
		var browserheight = $(window).height();
		// Scale the image
		if ((browserheight/browserwidth) > ratio){
		    $(this).height(browserheight);
		    $(this).width(browserheight / ratio);
		} else {
		    $(this).width(browserwidth);
		    $(this).height(browserwidth * ratio);
		}
		// Center the image
		$(this).css('left', (browserwidth - $(this).width())/2);
		$(this).css('top', (browserheight - $(this).height())/2);
		return this; 		
	};
})(jQuery);


var FullscreenrOptions = {  width: 1600, height: 1066, bgID: '#bgimg' };
			jQuery.fn.fullscreenr(FullscreenrOptions);




//** HIDE DIV


      $(document).ready(function() {
 
        $('#h5_fold').hide();
 
      });


			
//** FADE IMG			
			
$(document).ready(function()
{
var i = 0;
$('#gf img').clone()
$('#gf img').each(function()
{
var me = this;
$(this).hide()
var j = i;
setTimeout(function()
{
$(me).fadeIn(1000);
}, i)
i += 100
});
});
			
$(document).ready(function() {
    $("h4").click(function () {
							$('#h4_fold').hide();
							$('#h5_fold').show();
      $('#fold div').toggle("fold", {}, 1000);
	 
											
	  
	  
    });
  });			
			
			
			$(document).ready(function() {
    $("h5").click(function () {
							  $('#h5_fold').hide();
							  $('#h4_fold').show();
							  
      $('#fold div').toggle("fold", {}, 1000);
	 
											
	  
	  
    });
  });			
			
			
			
			
	//** FORM FIELDS		
			
			
			function click_clear(id, text)
{
	if (document.getElementById(id).value == text)
		document.getElementById(id).value = "";
}

function prefill(id, text)
{
	if (document.getElementById(id).value == "")
		document.getElementById(id).value = text;
}




//** EMAIL ANTISPAM 1

function emailantispam(email1, email2, email3, email4){
   emailE = email1 + email2 + '@' + email3 + email4;
   document.write('<a href="mailto:' + emailE + '">' + emailE + '</a>')
};



//** CLEAR FIELDS ON FOCUS

    function prefillClear(field) {
      if (field.defaultValue==field.value) {field.value = '';}
      else if (field.value == '') {field.value = field.defaultValue;}
      }
	  
	  
	  
	//**  EMAIL ANTISPAM 2 CLASS= *email* on link
	  	  $(document).ready(function() {
    $('a.email').each(function(i) {
        var text = $(this).text();
        var address = text.replace(" at ", "@");
        $(this).attr('href', 'mailto:' + address);
            $(this).text(address);
        });
    });
		  
  
		  
		  
		  
		  
		//**  EMAIL ANTISPAM 3  
		  
		  
		  $(function(){
var spt = $('span.mailme');
var at = / at /;
var dot = / dot /g;
var addr = $(spt).text().replace(at,"@").replace(dot,".");
$(spt).after('<a href="mailto:'+addr+'" title="Send an email">'+ addr +'</a>')
.hover(function(){window.status="Send a letter!";}, function(){window.status="";});
$(spt).remove();
});
		  
		  
		  
		  


		  
		  

