$(document).ready(function() {

	// *** --- This is for the front page form clear --- ***
	   clearField("form.wpcf7-form");


  // *** --- fancybox for portfolio pages --- ***
	/* This is basic - uses default settings */

	$("a#single_image").fancybox();

	$("a.grouped_elements").fancybox();

	/* Using custom settings */

	$("a#inline").fancybox({
		'hideOnContentClick': true
	});

	/* Apply fancybox to multiple items */

	$("a.group").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600,
		'speedOut'		:	200,
		'overlayShow'	:	true,
		 'overlayOpacity': 0.8
	});
// *** --- end fancybox for portfolio pages --- ***

});


// This function clears the form input/textarea field values onClick for the front page form, this can be modded to include all forms but the text iputs...
// ...need to have a class of "homeformtexts"
function clearField(form) {
        jQuery(form).find("input.homeformtexts, textarea").each(function(){
            this.defaultValue = this.value;
            jQuery(this).click(function(){
                if(this.value == this.defaultValue){
                    jQuery(this).val("");
                }
                return false;
            });
            jQuery(this).blur(function(){
                if(this.value == ""){
                    jQuery(this).val(this.defaultValue);
                }
            });
        });
}
// *** --- end front page form clear --- ***

// *** --- Open external links using rel="external" as oppossed to target="_blank" --- ***
	function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank"; } } window.onload = externalLinks;
