/*
둥둥이
Notify 로 전송되는 스크립트 오류방지 및  적절한 내부코드를 호출하기 위해서
해당 function 을  정의함 -> 실제 동작은 재작성.
by jonathan
*/

// 큐피토 채팅 초대장 - swj 0414
// frame is ''(no frame) or frame_name
document.domain = 'sayclub.com';

function findWindow(wname, options, framename, chkvariable) 
{
  var chkwin = window.open('',wname, options);
  try {
    if( framename == '' || framename == null ) {
      if( eval("chkwin."+chkvariable) != null )
        return chkwin;
    } else {
      if( eval("chkwin."+framename) != null)
      {
        if( eval("chkwin."+framename+"."+chkvariable) != null )
          return chkwin;
      }
    }
    return null;
  }catch(Exception){ return null; }
}

function open_win (url, name, w, h)
{
  var vleft;
  var vtop;
  vleft = (screen.width - w)/2;
  vtop = (screen.height - h)/2-150;
  var oWin = window.open(url, name, "scrollbars=no,resizable=yes,width="+w+",height="+h+", top="+vtop+", left="+vleft );
  try{ oWin.focus(); }catch(Exception){}
}

var cntFail =  0 ;
var smsrllist = new Array;

function checkInArray(obj, val) {
  for (var i=0; i < obj.length; i++) {
    if (obj[i]==val) return true;
  }
  return false;
}


function SayAlertMeetInvite(sendmsrl, method) {
  windowHandle = open_win("http://saychatting.sayclub.com/meeting/pop_memo_list.nwz?yourmsrl="+sendmsrl, '',416,156);
}



// 큐피토 프로포즈 받음 알림
function SayAlertMeetPropose(srl, text){
  windowHandle = open_win('http://saychatting.sayclub.com/meeting/pop_meet_view_propose.nwz?notified=yes&srl='+srl,'',445,284);
}

//둥둥
function SayAlert(){
	 //alert("[SayAlert]\n" + toStringArgs(arguments)); 
}
function SayAlertHompy(){
	//alert("[SayAlertHompy]\n" + toStringArgs(arguments)); 
}

// arguments  파라미터 확인용..
function toStringArgs(arguments, ishompy )
{
  var args = arguments;
  var strArg = "";  
  for( var i = 0 ; i < args.length ; i++)
  { 
   
    if (ishompy == true) {
      if (args[i] == 'hp_type') 
        ishompy = false;
    }   
    
 	  strArg = strArg +"'"+args[i] +"'";
    if(i < (args.length - 1 ) )
      strArg = strArg + ",";
  } 
  
  if(ishompy == true)
    strArg = strArg + ", 'o_type' , 'default' ";
   
 
  return strArg;  
}

function open_hompy2_srl(srl,str) // 홈피쪽에서 오는 notify를 받기위해서 래핑.
{
	openHompy(srl,str);
}

function open_hompy2(lusrid,str)/*{{{*/
{
  if(lusrid == '-1' || lusrid == '')
    return;
  var url='http://hompy.sayclub.com/hompy.nwz?targetid='+lusrid+'&pop=pop';
  if(str)
    url = url + '&' + str;
  hompy_win = window.open(url, '_hompy', 'scrollbars=no,resizable=no,width=995,height=585');
  try{ hompy_win.focus(); }catch(Exception){}
}

// call function by notify2 ( notify가 랜덤하게 오기 때문에 공통파일에 넣어두자 )
// 장미꽃 구매후
function updateRoseCntNotify(pRoseCnt,pCjmsrl)
{
  if (typeof(chatConsole) != "undefined")
  {
    if (pRoseCnt)
      chatCommon.setMyRoseCnt(pRoseCnt,-1,-1);
    chatConsole.sendRose();
  }
  else if (pCjmsrl && pCjmsrl != "0" && loginStatus)
  {
    openSendRose(pCjmsrl);
  }
}
// 장미꽃 선물도착팝업 띄우기
function SayRecvRose(pMsrl,roseCnt,hideNickFlag,message,starhistoryId)
{
  var url = _staticSaycastUrl+"/saycast/rosegift/recv/?msrl="+pMsrl+"&roseCnt="+roseCnt+"&hideNickFlag="+hideNickFlag+"&starhistoryId="+starhistoryId+"&message="+message;
  window.open(url,"_blank","resizable=no,width=420,height=620");
}
// 장미꽃 선물도착팝업 답장 띄우기
function SayRecvRoseReply(pMsrl,replyMsg,starhistoryId)
{
  var url = _staticSaycastUrl+"/saycast/rosegift/reply/?msrl="+pMsrl+"&starhistoryId="+starhistoryId+"&replyMsg="+replyMsg;
  window.open(url,"_blank","resizable=no,width=420,height=470");
}
// 로그인시 쌓여있는 장미꽃선물팝업 띄우기 ( 답장도 함께 구한다 )
function openRecvRosePop()
{
}
