﻿function StartModifyEvent(){
 
	$("div#worldCup_pop").load("/popup/event_modify.html").show();
}

function ModifyEvent(){

	if (isLogin == false)
	{
		if (confirm("로그인 후 이용해 주시기 바랍니다.\n로그인하시겠습니까?"))
		{
			loginpop();
			return;
		};
		return;
	}

 modifymember();

}

function IntroModify(){

	 


	if (isLogin==false)
	{
		if (confirm("로그인 후 이용해 주시기 바랍니다.\n로그인하시겠습니까?"))
		{
			loginpop();
			return;
		};
		return;
	}

eCode = "";
sendToIntro();



}


function sendToIntro(){

	 
	$.post("/event/1007_IntroModify.aspx", {"ei" : eCode},function(data){
		 
		  
		if (data == "-1")
		{
			//로그인 해야 함
			alert("로그인이 필요합니다.");		

		}
		else if (data=="1")
		{
			//이벤트 정상 참여함
			alert("친구에게 소개하기 이벤트를 통해 방문하셨습니다.\n회원님의 다른 친구분들에게 이벤트를 소개해 보세요.");

		}
		else if (data=="2")
		{
			//같은 IP임
			alert("친구들에게 알려주세요.\n본인의 링크로 접근하셨습니다.");

		}
		else if (data.length == 10 )
		{
		 
		
		CopyPath_2("http://www.cocacola.co.kr/?ei="+data);

		 alert("URL이 복사되었습니다.\nctrl+v로 친구들에게 알려 주세요.");


		}else
			{
			//오류 사항

			alert("죄송합니다. 이벤트 참여 도중 오류가 발생하였습니다.\n다시 시도해 주시기 바랍니다.");
		}
			
	});
}

function ModifyWinner(){

window.open("/popup/pop_myinfo_event.html","eventWinner","width=659, height=577").focus();
}

function CloseIntro(){

$("div#worldCup_pop").hide();
}



 //클립보드
function CopyPath_2(val) {

   meintext = val;//eval(inputPath + ".value");

   if (window.clipboardData) { 

       // the IE-manier 
       window.clipboardData.setData("Text", meintext); 

       // waarschijnlijk niet de beste manier om Moz/NS te detecteren; 
       // het is mij echter onbekend vanaf welke versie dit precies werkt: 
   }else if (window.netscape){ 

      // dit is belangrijk maar staat nergens duidelijk vermeld: 
      // you have to sign the code to enable this, or see notes below 
      netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 

      // maak een interface naar het clipboard 
      var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 
      if (!clip) return; 

      // maak een transferable 
      var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 
      if (!trans) return; 

      // specificeer wat voor soort data we op willen halen; text in dit geval 
      trans.addDataFlavor('text/unicode'); 

      // om de data uit de transferable te halen hebben we 2 nieuwe objecten nodig om het in op te slaan 
      var str = new Object(); 
      var len = new Object(); 

      var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 

      var copytext=meintext; 

      str.data=copytext; 

      trans.setTransferData("text/unicode",str,copytext.length*2); 

      var clipid=Components.interfaces.nsIClipboard; 

      if (!clip) return false; 

      clip.setData(trans,null,clipid.kGlobalClipboard); 

  } 


  

}

//팝업

$(function(){

if ( location.href.toLowerCase().indexOf("e=intro") > 5 || location.href.toLowerCase().indexOf("ei=") > 5)
{
}else{
//window.open("/popup/popup_myinfo.html","myinfo","width=527, height=400,status=0,resizable=1").focus();
}
});