var to = 0;
var registerloaded = false;
var Functions = {
	loadCSS:function(f){
		$("head").append("<link >");
			css = $("head").children(":last");
			css.attr({
				rel:  "stylesheet",
				type: "text/css",
				href: f+".css"
			});
	},
	register:function(){
		(registerloaded) ? setTimeout("Register.init();",to) : setTimeout("Functions.load('Register')",to);
	},
	load:function(a){
		to = 0;
		$.getScript(_base+'js/'+a.toLowerCase()+'.js',function(){eval(a).init();});
	},
	stripHTML:function(){
		var re= /<\S[^><]*>/g
		for (i=0; i<arguments.length; i++){
			arguments[i].value = arguments[i].value.replace(re, "");
		}
	},
	initScroll:function(div,size){
		$("div."+div).scrollable({
	        vertical:true,  
	        size: size 
	    }); 
	},
	loadTT:function(){
		$('span[rel]').each(function(){
			$(this).qtip({
				content: {
						url: $(this).attr('rel'),
					},
					position: {
						corner: {
							target: 'bottomMiddle',
							tooltip: 'topMiddle'
						},
						adjust: {
							screen: true
						}
					},
					show: { 
						when: 'click', 
						solo: true
					},
					hide: { 
						when: { 
							event: 'unfocus'
						}
					},
					style: {
						tip: true,
						border: {
							width: 0,
							radius: 4
						},
						name: 'light'
					}
				})
		});	
	}
}

$(document).ready(function(){
	$("#header").click(function(){
			window.location = 'http://www.vonfalconer.com/';
	});
	$("[placeholder]").focus(function() {
	  var input = $(this);
	  if (input.val() == input.attr("placeholder")) {
	    input.val("");
	    input.removeClass("placeholder");
	  }
	}).blur(function() {
	  var input = $(this);
	  if (input.val() == "" || input.val() == input.attr("placeholder")) {
	    input.addClass("placeholder");
	    input.val(input.attr("placeholder"));
	  }
	}).blur();
	
	$("[placeholder]").parents("form").submit(function() {
	  $(this).find("[placeholder]").each(function() {
	    var input = $(this);
	    if (input.val() == input.attr("placeholder")) {
	      input.val("");
	    }
	  })
	});
});
