$(document).ready(function() {
    $(function(){
    
    	// Run tooltip
		$('.tooltip').tipsy();
		
		// Images Preload
		$("#main").preloader({ imagedelay:500 });
		$("#content").preloader({ imagedelay:500 });
		$("#content-full").preloader({ imagedelay:500 });
		
		$(".box-element").preloader({ imagedelay:500 });
		
		$(window).load( function () { 
      	$("#loading").fadeOut(800); 
    	}) 
   		.end(); 
		
	});		
});

// Rounded Corners

DD_roundies.addRule('#navigation ul li a', '5px', true);
DD_roundies.addRule('.button', '5px', true);

// Clear Search Text

function clearText(theField)
		{
			if (theField.defaultValue == theField.value)
			theField.value = '';
		}

		function addText(theField)
		{
			if (theField.value == '')
			theField.value = theField .defaultValue;
};

$(function(){
		$('#text-resizer input').click(function(){
			var ourText = $('p');
			var currFontSize = ourText.css('fontSize');
			var finalNum = parseFloat(currFontSize, 10);
			var stringEnding = currFontSize.slice(-2);
			if(this.id == 'font-large') {
				finalNum *= 1.2;
			}
			else if (this.id == 'font-small'){
				finalNum /=1.2;
			}
			ourText.css('fontSize', finalNum + stringEnding);
		});
	});
