$(document).ready(function() {
//	preLoadStart();
	
	QueryLoader.baseUrl = "";
	QueryLoader.selectorPreload = "body";
	QueryLoader.onComplete = preLoadComplete;
	QueryLoader.init();			
	
	
	var options = { 
		target:     '#result', 
		url:        'email.php', 
		beforeSubmit: function () {
			$('#result').html($('#loader').html());
			$('#formbox').hide();
			$('#result').show();
		},
		success:    function(code) { 
			$('#result').fadeOut(1700, function() {	
				$('#formbox').show();
			});
		} 
	}; 

	$('#idmail').ajaxForm(options);
	
	myaddthis();
	
	$.supersized({
    slide_interval:4000,
    transition:1,// 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
    transition_speed:1000,
    slide_links:'blank',

    slides:[
        {title:'', url:'', thumb:'', image:'content/bg1.jpg'},
        {title:'', url:'', thumb:'', image:'content/bg2.jpg'},
        {title:'', url:'', thumb:'', image:'content/bg3.jpg'},
        {title:'', url:'', thumb:'', image:'content/bg4.jpg'}
    ]
	});

});

function preLoadComplete() {
}


function myaddthis(){
	$('.custom_button, .hover_menu').mouseenter(function()
    {
        $('.hover_menu').fadeIn('fast');
        $('.custom_button').addClass('active');
        $(this).data('in', true);
        $('.hover_menu').data('hidden', false);
    }).mouseleave(function()
    {
        $(this).data('in', false);
        setTimeout(hideMenu, delay);
    });
}
var delay = 400;
function hideMenu()
{
    if (!$('.custom_button').data('in') && !$('.hover_menu').data('in') && !$('.hover_menu').data('hidden'))
    {
        $('.hover_menu').fadeOut('fast');
        $('.custom_button').removeClass('active');
        $('.hover_menu').data('hidden', true);
    }
}

// VERTICALLY ALIGN FUNCTION
(function ($) {
$.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $(this).height();
	var ph = $(this).parent().height();
	var mh = (ph - ah) / 2;
	$(this).css('padding-top', mh);
	});
};
})(jQuery);
