/*
File Name: functions.js
Author: Stayko Dimitrov
Version: 1.0
*/

function init_page() {
	$("#menu a").removeAttr("title");
	$("#submenu a").removeAttr("title");
	$("#image_container").scrollable({easing: 'easeInOutQuad', speed: 600, circular: true}).navigator().autoscroll({interval: 5000});
	$("#contacts").fancybox({'modal' : true, 'scrolling': 'no', 'titleShow' : false, 'overlayColor' : '#000000', 'opacity' : '0.3', 'transitionIn' : 'fade', 'transitionOut' : 'fade', 'speedIn' : 200, 'speedOut' : 200, 'centerOnScroll': true});
	$("#contacts_li").click(function() {
		$('#menu > li').each(function() {
			$(this).removeClass('current_page_item')
		});
		$(this).addClass('current_page_item');
	});
}

function collapse_header(url) {
	$.post(''+ url + '/ajax/session_expanded.php', {'state': 'false'});
	$('#collapse').remove();
	$('#header').animate({
		height: [100, 'swing']
	}, 1500, 'linear', function() {
		$('#image_container').hide(); $('#navi_container').hide(); $('#container_inner').prepend('<div id="expand"><a href="javascript:void(0)" onclick="expand_header(\''+ url +'\');" title="">&nbsp;</a></div>');
	});
}

function expand_header(url) {
	$.post(url + '/ajax/session_expanded.php', {'state': 'true'});
	$('#image_container').show(); 
	$('#navi_container').show(); 
	$('#expand').remove();
	$('#header').animate({
		height: [607, 'swing']
	}, 1500, 'linear', function() {
		$('#header_inner').append('<div id="collapse"><a href="javascript:void(0)" onclick="collapse_header(\''+ url +'\');" title="">&nbsp;</a></div>');
	});
}
