﻿function MainEvent(Type)
{
	var sid = '';
	
	if(getSiteCookie('_SiteCode') != null)
		sid= getSiteCookie('_SiteCode');

	switch(Type)
	{

		//ex)
		//var url = "/ASPX/Event/2008-04-22/HotelEvent_01.aspx?SID="+sid;
		//window.open(url,'','left=0,top=0,menubar=0,resizable=0,width=930,height=1200,status=0,location=0,toolbar=0,scrollbars=1');
		//alert("이벤트가 마감되었습니다.\n\n그동안 이벤트에 참여해 주셔서 감사합니다.\n\n새로운 이벤트가 준비중입니다.");

		case '2':
			var url = "/ASPX/Common/Loading.aspx?page=HotelProducts/HotelInformation.aspx&ItemCode=PAR0618&CityCode=PAR&ItemNo=1&CheckInDate=&SearchType=URL_SEARCH";
			document.location.href = url;
			//var url = "/ASPX/Event/2008-04-22/HotelEvent_01.aspx?SID="+sid;
			//window.open(url,'','left=0,top=0,scrollbars=1');
			//window.open(url,'','left=0,top=0,menubar=0,resizable=0,width=945,height=1200,status=0,location=0,toolbar=0,scrollbars=1');
			break;
		default : //메이트아이 이벤트먼저 진행때문에 Default 이벤트 2(보물상자이벤트)로 설정
			var url = "/ASPX/Common/Loading.aspx?page=HotelProducts/HotelInformation.aspx&ItemCode=PAR0618&CityCode=PAR&ItemNo=1&CheckInDate=&SearchType=URL_SEARCH";
			document.location.href = url;
			break;
	}
}

function getSiteCookie(name)
{
	var prefix = name + "=";
	var cookieStartIndex = document.cookie.indexOf(prefix);

	if (cookieStartIndex == -1)
	{
		return null;
	}

	var cookieEndIndex = document.cookie.indexOf("&", cookieStartIndex + prefix.length);

	if (cookieEndIndex == -1)
	{
		cookieEndIndex = document.cookie.length;
	}

	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
	
}
