﻿function Ieswf(src, w, h)
{
	html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+w+'" height="'+h+'" id="banner" align="middle">';
	html += '<param name="movie" value="'+src+'" />';
	html += '<param name="quality" value="high" />';
	html += '<param name="bgcolor" value="#ffffff" />';
	html += '<param name="play" value="true" />';
	html += '<param name="loop" value="true" />';
	html += '<param name="wmode" value="transparent" />';
	html += '<param name="scale" value="showall" />';
	html += '<param name="menu" value="true" />';
	html += '<param name="devicefont" value="false" />';
	html += '<param name="salign" value="" />';
	html += '<param name="allowScriptAccess" value="sameDomain" />';
	html += '<a href="http://www.adobe.com/go/getflash">';
	html += '<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />';
	html += '</a>';
	html += '</object>';
	document.write(html);
}

function Etcswf(files, width, height,flag) {
	var wmode = (flag == 1) ? 'window' : 'transparent';
	var sTag = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ width + '" height="'+ height + '" id="'+ name +'" align="middle">'
		+ '<param name="allowScriptAccess" value="always" />'
		+ '<param name="movie" value="' + files + '" />'
		+ '<param name="quality" value="high" />'
		+ '<param name="wmode" value="'+wmode+'">'
		+ '<param name="Menu" value="false">'
		+ '<embed wmode="transparent" src="' + files + '" quality="high" bgcolor="#ffffff" width="' + width + '" height="'+ height +'" name="'+ name +'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" swLiveConnect="true" Menu="false" /></object>';
		document.write (sTag);
	}

// IE Flicker Bug위한 Hack
(function(){
	/*Use Object Detection to detect IE6*/
	var m = document.uniqueID /*IE*/
				&& document.compatMode /*>=IE6*/
				&& !window.XMLHttpRequest /*<=IE6*/
				&& document.execCommand ;

				try{
					if (!!m) {
						m("BackgroundImageCache", false, true) /* = IE6 only */
					}
				} catch(oh) {};
})();

function logoClick() {
	location.href = "/Home/Home.aspx";
}

function exitClick() {

}

function eventClick() {
	chkCbt();
}

function startClick() {
    gameStart();
}



//CBT이벤트 관련
function chkCbt()
{
	$.get("/Event/20110520/Ajax/UserStatus.aspx", {},function (data)
	{
		if(	data.ret == 4){alert("The following are available \n after login");	}
		else{	openWindow("/Event/20110520/Apply.aspx?cbt="+data.ret, 'cbt', "width=350, height=500, scrollbars=no");	}

	},"json");
}

$(document).ready(function(){
	$(".asideNav ul li").mouseover(function(){
		if ($(this).hasClass('on')) {
			return false;
		} else {
			$(this).addClass('on');
			$(this).mouseout(function(){
				$(this).removeClass('on')
			});
		}
	});

	var timer = setInterval ( moveUp, 3000);

	$('.electronicDspBg').hover(function(){
		clearInterval( timer);
	},function(){
		timer = setInterval( moveUp, 3000);
	});


	var i = 0;
	var h = -37;

	function moveUp () {
		var j = $('#idElectronicDsp p').length;
		if(i > j - 1) { i = -1; }
		i++;

		var z = i*h;
		if(z == j * h) {
			$('.electronicDspBg div:first-child').animate({marginTop:z},function(){
				$('.electronicDspBg div:first-child').clone().hide().appendTo('.electronicDspBg:first').css('marginTop',0).fadeIn(500);
				$(this).remove();
			});	
		} else {
			$('.electronicDspBg div:first-child').animate({marginTop:z});
		}
	}

	$('#quick p.top').click(function(e){
		e.preventDefault(); e.returnValue = false;
		$( 'html, body' ).animate( { scrollTop: 0 }, 'swing' );
	});

	$(window).scroll(function(){
		if(checkVersion()<=6&&checkVersion()>0) {
			$('#quick').offset({top:$(document).scrollTop()+607});
		}
	});
/* gnb */
	$('.gnb > h3 > a').mouseover(function() {
		$(this).parent('h3').next('ul').css('display','block').mouseover(function() {
			$(this).css('display','block')
			$(this).mouseout(function() {
				$(this).css('display','none');
			});
		});
		$(this).mouseout(function() {
			$(this).parent('h3').next('ul').css('display','none');
			
		});
	});

/* gallery 
	
	$('.galleryList li a').click(function() {
		$('.galleryPopup').css('display','block');
		return false;
	});
	$('.galleryPopup .btnClosed').click(function() {
		$('.galleryPopup').css('display','none');
		return false;
	});
*/

/* gameinfo tab */
	$('.introTab li a').click(function(){
		if(!$(this).parent().hasClass('on')){
			$(this).parent().addClass('on').siblings().removeClass('on');
		};

	
	});
/* rasecs tab-layer */
	$(".racesSection").css('display', 'none');
	$("#layer_t01").css('display', 'block');
	$('.racesTab li a').click(function(){
		if(!$(this).parent().hasClass('on')){
			$(this).parent().addClass('on').siblings().removeClass('on');
		};
		$(".racesSection").hide();
		var tHref = this.href;
		var tId = tHref.slice(-3); //id 문자수
		var tabId = $('.' + tId);
		tabId.fadeIn(0);
		return false;

	
	});
/* class tab-layer */
	$(".classSection").css('display', 'none');
	$("#layer_c01").css('display', 'block');
	$('.classTab li a').click(function(){
		if(!$(this).parent().hasClass('on')){
			$(this).parent().addClass('on').siblings().removeClass('on');
		};
		$(".classSection").hide();
		var tHref = this.href;
		var tId = tHref.slice(-3); //id 문자수
		var tabId = $('.' + tId);
		tabId.fadeIn(0);
		return false;

	
	});
/* map tab-layer */
	$(".mapSection").css('display', 'none');
	$("#layer_m01").css('display', 'block');
	$('.mapTab li a').click(function(){
		if(!$(this).parent().hasClass('on')){
			$(this).parent().addClass('on').siblings().removeClass('on');
		};
		$(".mapSection").hide();
		var tHref = this.href;
		var tId = tHref.slice(-3); //id 문자수
		var tabId = $('.' + tId);
		tabId.fadeIn(0);
		return false;

	
	});
/* gamesystem tab-layer */
	$(".gameSection").css('display', 'none');
	$("#layer_g01").css('display', 'block');
	$('.gameTab li a').click(function(){
		if(!$(this).parent().hasClass('on')){
			$(this).parent().addClass('on').siblings().removeClass('on');
		};
		$(".gameSection").hide();
		var tHref = this.href;
		var tId = tHref.slice(-3); //id 문자수
		var tabId = $('.' + tId);
		tabId.fadeIn(0);
		return false;

	
	});

});

promotion = 1;
		function playPromotion(){
			if(promotion>$('div.bannerArea ul li').length) { promotion = 1; }
			$('div.bannerArea div.number span').removeClass('current');
			$('div.bannerArea div.number span:nth-child('+promotion+')').trigger('mouseenter').addClass('current');
			
			promotion++;
			setTimeout(playPromotion,5000);
		}
		try{
		$(document).ready(function(){
	    $('div.bannerArea').append('<div class="number"></div>');
	    $.each($('div.bannerArea ul li'), function(index,value){
		    $('div.bannerArea div.number').append('<span rel='+(index+1)+'></span>');
	    })
	    $('div.bannerArea div.number span').mouseenter(function(){
			/* $('div.bannerArea div.number span').removeClass('current'); */
		    $('div.bannerArea ul li').hide();
		    $('div.bannerArea ul li:nth-child('+$(this).attr('rel')+')').show();
	    });
	    playPromotion();

});
	}catch(e){}
