$(document).ready(function() {
	
	new Observe( document.getElementById( 'keyword' ) );
	
	$('#go_search_btn').click(function(){
		var search_word = $( '#keyword' ).val();
		
		if( $.trim( $('#keyword').val() ) == "" ){
			alert( "검색어를 입력해 주세요." );
			$('#keyword').focus();
			
		} else {
			$( '#search' ).submit();
		}
	});
	
	$('#search_btn1').click(function(){
		if( $.trim( $('#keyword2').val() ) == "" ){
			alert( "검색어를 입력해 주세요." );
			$('#keyword2').focus();
			
		} else {
			$('#searchform').submit();	
		}
		
	});
	
	$('#contactUs_btn').click(function(){
		location.href='/gik/?reqCmd=contactUsForm';
	});
	
	$('#impint_btn').click(function(){
		location.href='/gik/?reqCmd=forwardPage&board_cate=32';
	});
	
	$('#sitemap_btn').click(function(){
		location.href='/gik/?reqCmd=forwardPage&board_cate=30';
	});
	
	$('#impint_bottom').click(function(){
		location.href='/gik/?reqCmd=forwardPage&board_cate=32&mapnum=1';
	});
	
	$('#institutions_btn').click(function(){
		location.href='/gik/?reqCmd=forwardPage&board_cate=33';
	});
	
	
	$('#sitemap_bottom').click(function(){
		location.href='/gik/?reqCmd=forwardPage&board_cate=30';
	});
	
	$('#germanyLink_btn').click(function(){
		window.open('http://www.young-germany.de/');
	});
	
	$('#palyerLink_btn').click(function(){
		//window.open('http://www.germany-in-korea.or.kr/rediscover_germany/player_main.php');
		window.open('/view/web/rediscover/rediscover_main.jsp');
	});
	
	$('#searchform').find('#keyword').focus(function() {
		$(this).val('');
	});
	
	var num  = Math.round( Math.random() * 3 );
	$( "#ticker_text" ).text( getTickerMsg( num ) );
	
	$("ul#ticker01").liScroll({travelocity: 0.05});
	
	$('#scrollimg').cycle({
		fx: 'fade'
	});
	
	$('#mainlog').click(function(){
		location.href='/';
	});
	
});


function getTickerMsg( num ) {
	switch ( num ) {
	case 0:
		return "'호프'가 '정원'이라는 의미의 독일어 단어 Hof에서 왔다는 것을 아세요?";
	case 1:
		return "'아르바이트'가 '일'이라는 의미의 독일어 단어 Arbeit에서 왔다는 것을 아세요?";
	default:
		return "자동차의 전세계 첫 발명가가 독일인이라는 것을 아세요?";
	}
	
}


















