function Site() {};
Site.prototype = {
	init: function() {
		// Title visuals
		$(".gd-brandmark").removeAttr("title");
		
		// Input Field Labels Inside
		
		// Setup dummy input text fields for password label
		var field = $("input[type='password'][placeholder]");
		field.each(function() {
			$(this).addClass("password");
			
			var ph = document.createElement("input");
			ph.setAttribute("type","text");
			ph.className = "label placeholder";
			var cl = $(ph);
			
			cl.val($(this).attr("placeholder"));
			cl.bind("focus", function(e) {
				$(this).hide();
				$(this).siblings(".password").show().focus();
			});			
			
			$(this).after(cl);
			$(this).hide();
		});
	
		// Setup all other fields 
		var field = $("input[type='text'][placeholder], input[type='password'][placeholder], textarea[placeholder]");
		field.each(function() {
			// initial state check
			if($(this).val().length < 1 || $(this).val() == $(this).attr("placeholder")) {
				if($(this).hasClass("password")) {
					$(this).hide();
					$(this).siblings(".placeholder").show();
				} else {
					$(this).addClass("label");
					$(this).val($(this).attr("placeholder"));
				}
			}
			
			$(this).bind("focus", function(e) {
				if($(this).hasClass("label")) {
					$(this).removeClass("label").val('');
				}
			});
			
			$(this).bind("blur", function(e) {
				if($(this).val().length < 1) {
					if($(this).hasClass("password")) {
						$(this).hide();
						$(this).siblings(".placeholder").show();
					} else {
						$(this).addClass("label");
						$(this).val($(this).attr("placeholder"));
					}
				}
			});
		});
		
		// Setup Overlay content
		$("#overlay-close").bind("click", function() {
			$("#overlay").fadeOut();
		});
		
		$(".overlay-link").bind("click", function() {
			var sib = $(this).parent().next(".overlay-data").html();	
			$("#overlay-content").empty();
			$("#overlay-content").html(sib);
			$("html, body").animate( { scrollTop: 0 }, function() {$("#overlay").fadeIn("slow");} );
		});
	}
};

var site;

$(document).ready(function() {
	site = new Site();
	site.init();
});

