//-------------------------------------------------------------------------------
// functions
//-------------------------------------------------------------------------------
	function preloadImages(imgs){
		var picArr = [];
		for (i = 0; i<imgs.length; i++){
			picArr[i]= new Image(100,100); 
			picArr[i].src=imgs[i]; 
		}
	}
//-------------------------------------------------------------------------------
// exec
//-------------------------------------------------------------------------------
	preloadImages([
		'/images/loading.gif',
		'/images/mainmenu/index-hover.jpg',
		'/images/mainmenu/ittasvezetes-hover.jpg',
		'/images/mainmenu/adatlap-hover.jpg',
		'/images/mainmenu/forum-hover.jpg',
		'/images/mainmenu/kapcsolat-hover.jpg'
	]);
	$.ajaxSetup({timeout: 10000});
	$(document).ready(function(){
	//loader
		$('body').prepend("<div id='layer-loading' style='display:none;width:100%;height:100%;z-index:9999;position:fixed;background-color:#000;opacity:0.3;filter:alpha(opacity=30);'><div style='width:100%;height:100%;background:url(/images/loading.gif) center center no-repeat;cursor:wait;'><img src='/images/spacer.gif' width='100%' height='100%' style='float:left;border:0 none;' /></div></div>");
	//callback
		$('a', '#callback').click(function(event){
			event.preventDefault();
			$.post('http://' + location.host + '/include/callback.communication.php', {
				name: 	$('input[name=name]', '#callback').click().val(),
				phone: 	$('input[name=phone]', '#callback').click().val(),
				time: 	$('input[name=time]:checked', '#callback').val()
			}, function(response){
				alert(response || 'Köszönjük!');
			});
			$('input', '#callback').focusout();
		});
		$('div.close', '#callback').click(function(){
			$('#callback').fadeOut('slow');
		});
		$('input[name=name]', '#callback').focusout(function(event){
			if($(this).val() == '')
				$(this).val('Név').one('click', function(){$(this).val('');});
		}).trigger('focusout');
		$('input[name=phone]', '#callback').focusout(function(event){
			if($(this).val() == '')
				$(this).val('Telefonszám').one('click', function(){$(this).val('');});
		}).trigger('focusout');
	}).ajaxStart(function(){
		$('#layer-loading').css('display', 'block');
	}).ajaxComplete(function(){
		$('#layer-loading').css('display', 'none');
	}).ajaxError(function(event, xhr){
		alert('A műveletet nem sikerült végrehajtani…\nPróbálja meg mégyegyszer!');
	});

