$(document).ready(function(){
	var _width = window.screen.width;

	try{
		switch (_width)
		{
			case 1024:
			$(".home_text").attr("src","images/home_text_1024.png");
			$(".mainpop-background").css("background-image","url(images/bg/bg1_1024.jpg)");
			$(".mainpop-text").css({"width":"300px","right":"100px","top":"200px"});
			break;

			case 1152:
			$(".home_text").attr("src","images/home_text_1152.png");
			$(".mainpop-background").css("background-image","url(images/bg/bg1_1152.jpg)");
			$(".mainpop-text").css({"width":"400px","right":"100px","top":"200px"});
			break;

			default:
			$(".mainpop-text").css({"width":"543px","right":"100px","top":"200px"});
			break;
		}
	}catch(e){;}

	$(".nav > ul > li").hover(function(){
		$(".nav > ul > li").each(function(){
			$(this).attr("class","");
		});

		var ref = $(this).attr('ref');
		$(this).attr("class","here");
		$(".subnav > ul").hide();
		$("#"+ref).show();
		return false;
	});

	$(".popul > ul > li > a").click(function(){
		switch (_width)
		{
			case 1024:
			$(".mainpop-background").css("background-image","url("+ $(this).attr('src_1024') +")");
			break;

			case 1152:
			$(".mainpop-background").css("background-image","url("+ $(this).attr('src_1152') +")");
			break;

			default:
			$(".mainpop-background").css("background-image","url("+ $(this).attr('src') +")");
			break;
		}

		$(".body").fadeIn("slow");
		return false;
	});

	$(".events-ul-li > ul > li > a").click(function(){
		if($(this).attr('ref')=="link"){
			return true;
		}
		else{
			$(".events-li").hide();
			$("#" + $(this).attr('ref')).fadeIn("slow");
			return false;
		}
	});

	$(".subnav > ul").eq(0).attr("class","here");
	init();

	$(window).resize(function() {
		init();
	});

 	try{
	   $(".popul").jCarouselLite({
			auto:5000,
			btnNext: ".next",
			btnPrev: ".prev",
			speed : 800
		});   
	}catch(e){;}

	function init(){
		try{
			$(".mainpop").css({height:$(document).height() - 80});
			$(".mainpop-wrap").css({left:($(document).width() - $(".mainpop-wrap").width())/2});
			$(".mainpop-wrap").css({bottom:0});
			$(".mainpop-background").css({width:$(document).width(),height:$(document).height()});
		}catch(e){;}

		try{
			$(".copyright").css({bottom:-50});
		}catch(e){;}
	}

	$(".png").each(function() {
		$(this).FixIE6PNG();
	});

	$(",png").FixIE6PNG();

	try{
		$(".history-line > ul > li").hover(function(){
			$(".history-text > div").each(function(){
				$(this).hide();
			});

			$(".history-line > ul > li").each(function(){
				$(this).removeClass("here")
			});

			$(this).addClass("here");
			$("." + $(this).attr("ref")).show();
		});
	}catch(e){;}

	$(".events-li").eq(0).show();
});

