// stu7-functions.js | requires jquery.js 1.6.2+ | made by Mindfly Web Studio (http://mindfly.com/)
// Created July 26, 2011 | Last Modified August 22, 2011
var stu7 = {};
stu7.func = {
	init: function() {
		$(document).ready(function(){
			stu7.func.input_defaults();
			stu7.func.hash_scroll();
			stu7.func.galleries();
			stu7.func.contact_thanks();
		});
	},
	input_defaults: function() {
		$('#contact input[type="text"], #contact textarea').live('focus', function() {
			var clearThis = false;
			if ($(this).hasClass("name") && $(this).attr('value') == "Name") clearThis = true;
			if ($(this).hasClass("email") && $(this).attr('value') == "Email") clearThis = true;
			if ($(this).hasClass("message") && $(this).attr('value') == "Message") clearThis = true;
			if (clearThis) $(this).attr('value', '');
		});
		$('#contact input[type="text"], #contact textarea').live('blur', function() {
			var insertValue = "";
			if ($(this).attr('value') == '') {
				if ($(this).hasClass("name")) insertValue="Name";
				if ($(this).hasClass("email")) insertValue="Email";
				if ($(this).hasClass("message")) insertValue="Message";
				$(this).attr('value', insertValue);
			}
		});	
	},
	hash_scroll: function() {
		$('a').live('click', function() {
			var href = $(this).attr('href');
			if (href) {
				if (href.substr(0, 1) == "#") {
					var y = $(href).offset().top;
					$('body, html').animate({scrollTop: y +'px'}, 1500);
					return false;
				}
			}
		});
	},
	galleries: function() {
		$('a[rel="flyeye"]').live('click', function() {
			flyeye.load('/directoryimages.php?dir=/wp-content/gallery/' + $(this).attr('href').split("/")[2] + '/');
			return false;
		});
	},
	contact_thanks: function() {
		$('.wpcf7-response-output .close').live('click', function() {
			$('.wpcf7-response-output').animate({opacity:0}, 1000);			
		});
		$('.wpcf7-submit').live('click', function() {
			var s = setTimeout( function(){$('.wpcf7-response-output').append('<button class="close" type="button">X</button>');}, 500);
			var t = setTimeout( function(){$('.wpcf7-response-output').animate({opacity:0}, 1000);},7000);
		});
	}
};
stu7.func.init();

