var homepage;
var my_height;
var speed = 10;
var move_to = 0;
var intro_height = 85;
var height_to = intro_height;
$(window).load(function(){ 
	$('#loading').hide();
	homepage = $('.home-intro').attr('id');
	if (homepage == 'have') {
		var timeout = setTimeout(function() {
			$('.content-main-body .home-intro').fadeOut(1000);
			var timeout = setTimeout(function() {
				do_all();
			}, 1200);
		}, 5000);
	}
	else {
		do_all();
	}
		/*$('#scroll_down').click(function() {
			move_to += speed;
			height_to += speed;
			$('.content-main-body .text .intro').animate({
				marginTop: "-"+move_to+"px",
				height: height_to+"px"
			}, 1);
		});
		$('#scroll_up').click(function() {
			move_to -= speed;
			height_to -= speed;
			$('.content-main-body .text .intro').animate({
				marginTop: move_to+"px",
				height: height_to+"px"
			}, 1);
		});
		alert(my_height);*/

	$('#box-bottom a#collapse').mouseover(function() {
		$(this).fadeTo(300, 1);
	});
	$('#box-bottom a#collapse').mouseout(function() {
		$(this).fadeTo(300, 0.75);
	});
	$('#box-bottom a#collapse.').click(function() {
		if ($(this).attr('class') == 'collapse_hide') {
			$(this).addClass('collapse_show');
			$(this).removeClass('collapse_hide');
			$('.content-main-body .text').animate({
				marginBottom: "0px",
				height: "0px"
			}, 400);
			var timeout = setTimeout(function() {
				$('.content-main-body .text div').hide();
				$('.content-main-body .text').css('padding-top','0px');
				$('.content-main-body .text').css('padding-bottom','0px');
			}, 400);
		}
		else if ($(this).attr('class') == 'collapse_show') {
			$(this).addClass('collapse_hide');
			$(this).removeClass('collapse_show');
			$('.content-main-body .text').css('padding-top','10px');
			$('.content-main-body .text').css('padding-bottom','10px');
			$('.content-main-body .text').animate({
				opacity: 0.75,
				marginBottom: "0px",
				height: (my_height-5)+"px"
				//height: intro_height+"px"
			}, 400);
			var timeout = setTimeout(function() {
				$('.content-main-body .text div').fadeIn('slow');
			}, 400);
		}

	});
});

$(function() {
	$('.content-main-body .text').hide();
	$('.content-main-body img').hide();
	$('.content-main-menu ul li ul li').fadeTo(1, 0.75);
});

function do_all() {
	$('.content-main-body .home-intro').hide();
	$('.content-main-body img').fadeIn('slow');
	$('.content-main-body .text div').fadeIn('slow');
	my_height = $('.text').height()-10;
	
	$('#box-bottom').height('0px');
	var timeout = setTimeout(function() {
		$('.content-main-body .text#box-bottom').animate({
			opacity: 0.75,
			marginBottom: "0px",
			height: (my_height)+"px"
			//height: intro_height+"px"
		}, 700);
	}, 500);

	var timeout = setTimeout(function() {
		$('.content-main-body .text#box-left').animate({
			marginLeft: "15px",
			width: '250px'
		}, 1200);
	}, 500);
	var timeout = setTimeout(function() {
		$('.content-main-body .text#box-left-banquet').animate({
			marginLeft: "15px",
			width: '320px'
		}, 1200);
	}, 500);
}
