﻿/// <reference path="jquery-1.3.2-vsdoc.js" />
/// <reference path="miya_validator.js" />
/// <reference path="Justgo.js" />

/*------------이벤트 제주여행2탄 을 위한 스크립트-----------------------------------*/
function hideLayer(){
document.getElementById("jeju2SWF").style.display='none';
}

function iconClick()
{

	hideLayer();
//	if(getJejuEventCookie("MMIF_MEID")!=false)
//	{
//		
//		if(getJejuEventCookie("MMIF_MEID").split('&')[0].length>0)
//		{
//	
//			setJejuEventCookie("JejuEvent","1","1");
//			SetCenterPopup('/JejuTrip/jejuProm_PopUP.aspx','popup','550','490','no',false);

//		
//		}
//		else
//		{
//			if(confirm("로그인이 필요합니다. 로그인 하시겠습니까"))
//			{
//				location.href="/Member/SignIn.aspx";
//			}
//			
//		}
//	}
//	else
//	{
//		if(confirm("로그인이 필요합니다. 로그인 하시겠습니까"))
//		{
//			location.href="/Member/SignIn.aspx";
//		}
	//	}

	var returnValue = "";
	//alert("bbb");
	jQuery.ajax
	(
		{
			type: "POST",
			url: "/inc/EventAjaxMethod.ashx?ProcessType=CheckLogin",
			success: function(returnValue) {

				//alert(returnValue);
				if (returnValue == "False") {
					//로그인 안됫을 경우
					if(confirm("저스트고 회원으로 로그인해주세요!"))
					{
						var myUrl = location.href;
						location.href="/Member/SignIn.aspx?ReturnUrl="+escape(myUrl);
					}
				}
				else if (returnValue == "") {
					//로그인 됫을 경우
					SetCenterPopup('/JejuTrip/jejuProm_PopUP.aspx', 'popup', '550', '490', 'no', false);
				}
				else if (returnValue == "100") {
					alert('짝짝짝! 이미 100개를 다 찾으셨습니다~! 내일 또 도전해주세요!');
				}
			}
		}
	);
}


function ShowIcon()
{
//	var divWidth = document.getElementById("jeju2SWF").style.width;

//	var tempTop = Math.ceil(Math.random() * 740); 
//	var tempLeft = Math.ceil(Math.random() * 1024); 
//	var tempShow = Math.ceil(Math.random() * 2);
//	
//	document.getElementById("jeju2SWF").style.top=tempTop;
//	document.getElementById("jeju2SWF").style.left = tempLeft;
//	if(tempShow!=1)
//	{
		hideLayer();
//	}
}
 function getJejuEventCookie( cookieName )
 {
  var search = cookieName + "=";
  var cookie = document.cookie;

  // 현재 쿠키가 존재할 경우
  if( cookie.length > 0 )
  {
   // 해당 쿠키명이 존재하는지 검색한 후 존재하면 위치를 리턴.
   startIndex = cookie.indexOf( cookieName );
   // 만약 존재한다면
   if( startIndex != -1 )
   {
    // 값을 얻어내기 위해 시작 인덱스 조절
    startIndex += cookieName.length;

    // 값을 얻어내기 위해 종료 인덱스 추출
    endIndex = cookie.indexOf( ";", startIndex );

    // 만약 종료 인덱스를 못찾게 되면 쿠키 전체길이로 설정
    if( endIndex == -1) endIndex = cookie.length;

    // 쿠키값을 추출하여 리턴
    return unescape( cookie.substring( startIndex + 1, endIndex ) );
   }
   else
   {
    // 쿠키 내에 해당 쿠키가 존재하지 않을 경우
    return false;
   }
  }
  else
  {
   // 쿠키 자체가 없을 경우
   return false;
  }
 }
 

 function setJejuEventCookie( cookieName, cookieValue, expireDate )
 {
  var today = new Date();
  today.setDate( today.getDate() + parseInt( expireDate ) );
  document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; expires=" + today.toGMTString() + ";";
 }

 

 /**
  * 쿠키 삭제
  * @param cookieName 삭제할 쿠키명
  */
 function deleteCookie( cookieName )
 {
  var expireDate = new Date();
  
  //어제 날짜를 쿠키 소멸 날짜로 설정한다.
  expireDate.setDate( expireDate.getDate() - 1 );
  document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString() + "; path=/";
 }
	
/*----------------------------------------------------------------------------------*/
