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

oSayCastAlert = new SayCastAlert();

// 큐피토 채팅 초대장
function SayAlertMeetInvite(sendmsrl, method){
 //alert("[SayAlertMeetInvite]\n" + toStringArgs(arguments)); 
}

// 큐피토 프로포즈 받음 알림
function SayAlertMeetPropose(){
	//alert("[SayAlertMeetPropose]\n" + toStringArgs(arguments));  
}

//둥둥
function SayAlert(){
  eval('oSayCastAlert.run(' + toStringArgs(arguments) +')');
}
function SayAlertHompy(){
  eval('oSayCastAlert.run(' + toStringArgs(arguments,true) +')');  
}

// 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 SayAlertHompyDisappear(){
  SayCastAlert.prototype.Disappear(); 
} 


/**
 * 둥둥둥.
 * @author jonathan
 */

function SayCastAlert(){

    this._SayAlertIsLive = 0;
    this._SayAlertLastY = 3; //y axis margin
    this._SayAlertLastX = 3; //x axis margin
    this._SayAlertMessageHeight = "100%";
    this._SayAlertBorderHeight = 4;
    this._SayAlertMinIndex;
    this._SayAlertMaxIndex;
    this._SayAlertQueue = new Array();
    this._SayAlertSetTimeoutID;
    this._SayAlertDontPopDown;
    this._SayAlertMoveInterval = 8; //pixel move interval
    this._winX, this._winY;
    
    //arguments default value;
    //사용자가 세팅할 수 있는 값들
    this.o_fgcolor;
    this.o_bgcolor; // SayAlert의 바탕색
    this.o_caption; // SayAlert의 캡션
    this.o_character; // SayAlert안에 들어가는 사용자 캐릭터 .. 테스트 안됨
    this.o_logo; // SayAlert안에 들어가는 세이클럽 로고
    this.o_width; // SayAlert 가로크기
    this.o_height; // SayAlert 세로크기
    this.o_lifetime; // SayAlert 의 멈춤 시간
    this.o_upspeed; // SayAlert 보여질때 속도
    this.o_downspeed; // SayAlert 사라질때 속도
    this.o_charalign; // 캐릭터의 align
    this.o_linktext; // 링크 텍스트
    this.o_linktexthalign; // 링크 텍스트 horizontal alignment
    this.o_linktextvalign; // 링크 텍스트 vertical alignment
    this.o_background; // 백그라운드 이미지
   
   // SayAlertHompy 도 동시에 처리하기 위해서 hp 계열 가져옴.
    this.o_subject;
    this.o_content;
    this.o_type;
    this.o_set_link;
    this.o_content_link;

}

SayCastAlert.prototype.run = function(){
  
    if( $("#_SayAlert").length > 0 ){
        if ($("#_SayAlert").css("display","block")){
            this._SayAlertIsLive = 1;
        }
    }
                    
    if (this._SayAlertIsLive <= 0 && this._SayAlertQueue.length <= 0) 
        this.init(arguments);
    else {
        this._SayAlertQueue.push(arguments);        
    }
    return true;
}

SayCastAlert.prototype.init = function(arguments){
    
    //arguments setting
    this.o_fgcolor = "#FFFFFF";
    this.o_bgcolor = "";
    this.o_caption = "&nbsp";
    this.o_character = "<table border=0 cellpadding=0 cellspacing=0 width=100 height=40><tr><td>&nbsp;</td></tr></table>";
    this.o_logo = "http://filei.sayclub.kr/images/tiffany/ico_sayclub_sayalert.gif";
    this.o_width = 158;
    this.o_height = 131;
    this.o_lifetime = 4000;
    this.o_upspeed = 2;
    this.o_downspeed = 2;
    this.o_charalign = 'center';
    this.o_linktext = '';
    this.o_linktexthalign = 'center';
    this.o_linktextvalign = 'middle';
    this.o_background = '';
    
     // SayAlertHompy 도 동시에 처리하기 위해서 hp 계열 가져옴.
    this.o_subject = '';
    this.o_content = '';
    this.o_type = '';
    this.o_set_link = '';
    this.o_content_link = '';
		this.o_alllinktext = '';
    
    
    this._SayAlertDontPopDown = false;   /* Stop Alert = false*/
    
    var ar = arguments;
    if (ar.length == 1) {
      this.o_caption = ar[0];
    }else{
      
      // 홀수번째 argument 는 다음에 나오는 argument 가 필드명이다.
      // 예를 들어, SayAlert('o_lifetime', 10000) 의 경우
      // o_lifetime 이라는 변수에 10000 의 값이 들어가면 된다.

      for (var i=0; i < ar.length; i++)
      {
        ar[i] = ar[i].replace(/hp\_/g,"o_");
                
        if (ar[i] == 'o_fgcolor') 
          this.o_fgcolor = ar[i+1]; 
        else if (ar[i] == 'o_bgcolor')
          this.o_bgcolor = ar[i+1]; 
        else if (ar[i] == 'o_caption') 
          this.o_caption = ar[i+1]; 
        else if (ar[i] == 'o_character') 
          this.o_character = ar[i+1]; 
        else if (ar[i] == 'o_logo') 
          this.o_logo = ar[i+1]; 
        else if (ar[i] == 'o_width') 
          this.o_width = ar[i+1]; 
        else if (ar[i] == 'o_height') 
          this.o_height = ar[i+1]; 
        else if (ar[i] == 'o_lifetime') 
          this.o_lifetime = ar[i+1]; 
        else if (ar[i] == 'o_upspeed') 
          this.o_upspeed = ar[i+1]; 
        else if (ar[i] == 'o_downspeed') 
          this.o_downspeed = ar[i+1]; 
        else if (ar[i] == 'o_linktext') 
        { 
          this.o_linktext = ar[i+1]; 
          this.o_charalign = 'right'; 
        }
        else if (ar[i] == 'o_linktexthalign') 
          this.o_linktexthalign = ar[i+1]; 
        else if (ar[i] == 'o_linktextvalign') 
          this.o_linktextvalign = ar[i+1]; 
        else if (ar[i] == 'o_background') 
          this.o_background = ar[i+1]; 
       else if (ar[i] == 'o_subject') 
          this.o_subject = ar[i+1];
       else if (ar[i] == 'o_type') 
          this.o_type = ar[i+1];  
       else if (ar[i] == 'o_content') 
          this.o_content = ar[i+1]; 
       else if (ar[i] == 'o_set_link') 
          this.o_set_link = ar[i+1]; 
       else if (ar[i] == 'o_content_link') 
          this.o_content_link = ar[i+1];
			 else if(ar[i] == 'o_alllinktext')
			 		this.o_alllinktext = ar[i+1];
           
        i++;
      }
    }
    
    //arguments default setting
    // character div id 변경
    this.o_character = this.o_character.replace(/id=character/g, "id=SayAlertCharacter");
    this.o_character = this.o_character.replace(/id=ImgChar/g, "id=SayAlertImgChar");
     
    if( $("#_SayAlertBorder").length <= 0  ) 
    {
      var divs = '<DIV id="_SayAlertBorder" style="display:none;position:absolute;';
      divs += 'width:'+this.o_width+'px;height:'+ this.o_height +'px;overflow:hidden">';
      divs += '<DIV id="_SayAlert" style="display:none;position:relative;margin:0px';
      divs += 'width:'+ this.o_width+'px;height:'+this.o_height+'px;"></DIV></DIV>';
      $("body").append(divs); 
    }
   
    var o = $("#_SayAlert");
    var self = this;
    
    o.hover( function(){self.Stop()},function(){self.Go()});    
    
    $(window).resize( function (){ self.fixHeight();});    
    $(window).scroll( function (){ self.fixHeight();});
     
    o.css('backgroundColor',this.o_bgcolor);
    o.css('zindex' , 255);
    
    this.Slide();
    
    return o;
}

SayCastAlert.prototype.Slide = function(){
  
    var ob = $("#_SayAlertBorder");
    var o = $("#_SayAlert");
    
    var _scrollX = $(document).scrollLeft();
    var _scrollY = $(document).scrollTop();
    
    this._winX = $(window).width();
    this._winY = $(window).height();
    
    var pixelTop = ( _scrollY + this._winY ) - this.o_height - this._SayAlertLastY - 15 ;
    var pixelLeft = ( _scrollX + this._winX ) - this.o_width - this._SayAlertLastX - 15;
    
    $("body").css("overflowY","scroll");
    
    ob.css("top", pixelTop + "px" );
    ob.css("left", pixelLeft + "px");
    
    ob.css("display","block");
    ob.css('width',this.o_width + 'px');
    ob.css('height',this.o_height + 'px');
        
    o.css("position","absolute");
    o.css("left", "0px");
    o.css("top",this.o_height + "px");    
    o.css("display","block");
    
    this._SayAlertMinIndex = parseInt(o.css("top")) - this.o_height;  
    this._SayAlertMaxIndex = parseInt(o.css("top"));             
   
    var pop = this.SlideUp(false);
    this.Contents(o, true);
   
    return true
}

SayCastAlert.prototype.SlideUp = function(fixed){
  
  var o = $("#_SayAlert");
 
  if (parseInt(o.css("top")) - this.o_upspeed < this._SayAlertMinIndex) {
    this.o_upspeed = parseInt(o.css('top')) - this._SayAlertMinIndex;
  }
  
  o.css("top", (parseInt(o.css("top")) - this.o_upspeed) + 'px');
  
  var self = this; // setTimeout 에서  호출되는  function 안에서 this를 사용할려면 self 에 따로 복사해준다.
  if( parseInt(o.css("top")) > this._SayAlertMinIndex)
  {
    this._SayAlertSetTimeoutID = setTimeout(function(){self.SlideUp(fixed);}, this._SayAlertMoveInterval );
    return;
  }
  else
  {
    clearTimeout(this._SayAlertSetTimeoutID);  
  }
  
  if(fixed == true)
    return;
  
  var self = this;
  setTimeout( function(){ self.SlideDown();}, this.o_lifetime);
  
  return true
  
}

SayCastAlert.prototype.SlideDown = function(){
   
  if(this._SayAlertDontPopDown) return;

  var ob = $("#_SayAlertBorder");
  var o = $("#_SayAlert");

  o.css("backgroundColor",this.o_bgcolor);
  o.css("top" , (parseInt(o.css("top")) + this.o_downspeed) + 'px');
  
  var self = this;
  if( parseInt(o.css("top")) < this._SayAlertMaxIndex)
  {
    this._SayAlertSetTimeoutID = setTimeout( function (){ self.SlideDown();}, this._SayAlertMoveInterval);
    return false;
  }else
  {
    clearTimeout(this._SayAlertSetTimeoutID);
  }
    
  this.Contents(o, false);
    
  o.css("display","none");
  ob.css("display", "none");

  this.End();
  return true;  
}

SayCastAlert.prototype.Go = function(){
    this._SayAlertDontPopDown = false;
    clearTimeout(this._SayAlertSetTimeoutID); 
    this.SlideDown();
    return
}

SayCastAlert.prototype.Stop = function(){
    this._SayAlertDontPopDown = true;
    clearTimeout(this._SayAlertSetTimeoutID); 
    this.SlideUp(true);  
    return;
}

SayCastAlert.prototype.End = function()
{
    if("undefined" == typeof(this._SayAlertQueue))
      return;
    
    if(this._SayAlertQueue.length > 0)
    {
      var arguments = this._SayAlertQueue.pop(); 
      if(arguments != "undefined")
      {
        this.init(arguments);
      }      
    } 
   return true
}

SayCastAlert.prototype.fixHeight = function(){
    
    var _scrollX = $(document).scrollLeft();
    var _scrollY = $(document).scrollTop();
    
    this._winX = $(window).width();
    this._winY = $(window).height();
    
    
    var pixelTop = this._winY - this.o_height - this._SayAlertLastX + _scrollY - 15;
    var pixelLeft =this._winX - this.o_width - this._SayAlertLastX -15;
    
    $("#_SayAlertBorder").css("top",pixelTop);
    $("#_SayAlertBorder").css("left",pixelLeft);  
 }  

SayCastAlert.prototype.Disappear = function(){
  $("#_SayAlert").css("display","none");
  $("#_SayAlertBorder").css("display","none");
  this.End();
} 
  
SayCastAlert.prototype.Contents = function(o , on){
  
  var tmpContent;

  if (!on) {
    o.html("");
    return ;
  }
    
  if (this.o_type == 1 || this.o_type == 2) {
      tmpContent = "" +
      "<table width='291' border='0' cellspacing='0' cellpadding='0'>" +
      "  <tr height='7'>" +
      "    <td style='line-height:5px;' valign='top' width='7' height='7'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_01.gif' width='7' height='7'></td>" +
      "    <td style='line-height:5px;' valign='top' height='7' background='http://filei.sayclub.kr/images/hompy2/img_notice_14.gif'></td>" +
      "    <td style='line-height:5px;' valign='top' width='7' height='7' ><img src='http://filei.sayclub.kr/images/hompy2/img_notice_02.gif' width='7' height='7'></td>" +
      "  </tr>" +
      "  <tr>" +
      "    <td background='http://filei.sayclub.kr/images/hompy2/img_notice_05.gif'></td>" +
      "    <td bgcolor='FFFFFF' style='padding-left:7px;padding-right:7px;'>" +
      "      <table border='0' cellspacing='0' cellpadding='0'>" +
      "        <tr> " +
      "          <td width='18' valign='bottom' style='padding-bottom:9px'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_09.gif' width='15' height='12'></td>" +
      "          <td valign='bottom' style='padding-bottom:6px;' height='29' width='205'>" +
      this.o_title +
      "</td>" +
      "          <td valign='bottom' style='padding-bottom:6px' width='23'>" +
      this.o_set_link +
      "</td>" +
      "          <td width='13' valign='bottom' style='padding-bottom:8px'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_08.gif' width='13' height='13' border='0' onclick='javascript:SayAlertHompyDisappear();'></td>" +
      "        </tr>" +
      "        <tr> " +
      "          <td height='1' background='http://filei.sayclub.kr/images/hompy2/img_notice_07.gif' colspan='4'></td>" +
      "        </tr>" +
      "<span onclick=" +
      this.o_content_link +
      " ><tr style='cursor:hand;'> " +
      "          <td height='28' valign='bottom' colspan='4'>" +
      this.o_subject +
      "</td>" +
      "        </tr>";
      
      
      if (this.o_type == 1) {
          tmpContent = tmpContent +
          "        <tr style='cursor:hand;'> " +
          "          <td style='padding-top:5px' height='43' valign='top' colspan='4'>" +
          this.o_content +
          "</td>" +
          "        </tr>";
      }
      else {
          tmpContent = tmpContent +
          "        <tr style='cursor:hand;'> " +
          "          <td style=padding-bottom:10px valign=top colspan=4> " +
          "            <table width=100% border=0 cellspacing=0 cellpadding=0 style=margin-top:5px>" +
          "              <tr> " +
          "                <td width=30 align=right><img src='http://filei.sayclub.kr/images/hompy2/bu_new_reply.gif' width=15 height=12 style=margin-right:5px></td>" +
          "                <td>" +
          this.o_content +
          "</td>" +
          "              </tr>" +
          "            </table>" +
          "          </td>" +
          "        </tr>";
      }
      
      tmpContent = tmpContent +
      "</span></table>" +
      "    </td>" +
      "    <td background='http://filei.sayclub.kr/images/hompy2/img_notice_06.gif'></td>" +
      "  </tr>" +
      "  <tr>" +
      "    <td style='line-height:5px;' height='7' valign='top'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_03.gif' width='7' height='7'></td>" +
      "    <td style='line-height:5px;' background='http://filei.sayclub.kr/images/hompy2/img_notice_15.gif'></td>" +
      "    <td style='line-height:5px;' valign='top'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_04.gif' width='7' height='7'></td>" +
      "  </tr>" +
      "</table>";
      
      o.html(tmpContent);
      return;
  }
  
  
  if (this.o_type == 3) {
      tmpContent = "" +
      "<table width='291' border='0' cellspacing='0' cellpadding='0'>" +
      " <tr>" +
      "<td width='7' height='7'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_01.gif' width='7' height='7'></td>" +
      "<td bgcolor='FFFFFF' valign='top'> " +
      "<table width='100%' border='0' cellspacing='0' cellpadding='0'>" +
      "<tr>" +
      "<td bgcolor='919191' height='1'></td>" +
      "</tr>" +
      "<tr>" +
      "<td bgcolor='E8E8E8' height='3'></td>" +
      "</tr>" +
      " </table>" +
      "</td>" +
      "<td width='7' height='7'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_02.gif' width='7' height='7'></td>" +
      "</tr>" +
      "<tr>" +
      " <td background='http://filei.sayclub.kr/images/hompy2/img_notice_05.gif'></td>" +
      "    <td bgcolor='FFFFFF' style='padding:7 7 7 7'>" +
      "      <table width='100%' border='0' cellspacing='0' cellpadding='0'>" +
      "        <tr> " +
      "<span onclick=" +
      this.o_content_link +
      "><td width='60' style='cursor:hand;'>" +
      this.o_character +
      "</td>" +
      "          <td style='cursor:hand;'>" +
      this.o_title +
      "            </td></span>" +
      "          <td valign='top' style=padding-top:1px width='24'><font style='letter-spacing:-1;color:#777777; font-family:돋움; font-size:11px; cursor:hand;text-decoration:none;' onclick='javascript:var tmp = window.open(\"http://my.sayclub.com/preference.nwz\");' onmouseover='javascript:this.style.textDecoration=\"underline\"' onmouseout='javascript:this.style.textDecoration=\"none\"'>설정</font></td>" +
      "          <td width='13' valign='top' style=padding-top:1px width='24'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_08.gif' width='13' height='13' border='0' onclick='javascript:SayAlertHompyDisappear();'></td>" +
      "        </tr>" +
      "      </table>" +
      "    </td>" +
      "    <td background='http://filei.sayclub.kr/images/hompy2/img_notice_06.gif'></td>" +
      "  </tr>" +
      "  <tr>" +
      "    <td height='7' valign='top'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_03.gif' width='7' height='7'></td>" +
      "    <td valign='bottom' bgcolor='FFFFFF'> " +
      "      <table width='100%' border='0' cellspacing='0' cellpadding='0'>" +
      "        <tr> " +
      "          <td bgcolor='E8E8E8' height='3'></td>" +
      "        </tr>" +
      "        <tr> " +
      "          <td bgcolor='919191' height='1'></td>" +
      "        </tr>" +
      "        <tr> " +
      "          <td bgcolor='696969' height='1'></td>" +
      "        </tr>" +
      "      </table>" +
      "    </td>" +
      "    <td valign='top' width='7' height='7'><img src='http://filei.sayclub.kr/images/hompy2/img_notice_04.gif' width='7' height='7'></td>" +
      "  </tr>" +
      "</table>";
      
      o.html(tmpContent);
      return;
  }
  
 if (this.o_type == 9) { //만남채팅 
      tmpContent = "<table width=291  border=0 cellpadding=0 cellspacing=0>" +
      "	<tr>" +
      "		<td height=136 background=http://filei.sayclub.kr/images/incredible/chatting/bg_bglayer2.gif align=center valign=top style=padding-right:2px>" +
      "      <table width=265 border=0 cellpadding=0 cellspacing=0>" +
      "        <tr><td colspan=2 height=10></td></tr>" +
      "      	<tr height=24>" +
      "      		<td><img src=http://filei.sayclub.kr/images/incredible/chatting/bullet/icon_heart.gif align=absmiddle class=bullet> <b>당신과의 인연을 만들어보고 싶어요.</b></td>" +
      "          <td align=right>" +
      "            <a href=#><img src=http://filei.sayclub.kr/images/incredible/chatting/button/btn_close4.gif onclick='SayAlertHompyDisappear()' border=0></a></td>" +
      "        </tr>" +
      "        <tr>" +
      "          <td colspan=2 height=1 background=http://filei.sayclub.kr/images/incredible/common/dotline_02.gif>" +
      "        </tr>" +
      "      </table>" +
      "      <table width=250 border=0 cellpadding=0 cellspacing=0 class=fixed>" +
      "      <col width=76></col><col width=6></col><col width=183></col>" +
      "      	<tr style=padding-top:10>" +
      "      		<td rowspan=2 align=center>" +
      this.o_character +
      "</td>" +
      "          <td></td>" +
      "          <td>" +
      this.o_title +
      "</td>" +
      "        </tr>" +
      "        <tr>" +
      "          <td></td>" +
      "          <td align=right valign=bottom><a href=#><img src=http://filei.sayclub.kr/images/incredible/chatting/button/btn_confirm_zzim.gif border=0 onclick=\"window.location='http://saychatting.sayclub.com/meeting/meet_yourzzim_list.nwz'\"></a></td>" +
      "        </tr>" +
      "      </table>" +
      "    </td>" +
      "  </tr>" +
      "</table>";
      
      o.html(tmpContent);
      return;
  }
  
  if (this.o_type == 10) {
      tmpContent = "" +
      "<table width='280' height='100' border='0' cellpadding='0' cellspacing='0'>" +
      "<tr><td background='http://filei.sayclub.kr/images/ditto//common/g_alert_bg.gif' style='padding:5px 0 0 80px;'>" +
      "<table width='185' height='75' border='0' cellpadding='0' cellspacing='0'>" +
      "<tr><td height='25' valign='top'>" +
      this.o_title +
      "</td></tr>" +
      "<tr><td><a href=" +
      this.o_content_link +
      ">" +
      this.o_content +
      "</td></tr>" +
      "</table></td></tr></table>";
      
      o.html(tmpContent);
      return;
  }
  

  
  
  if (this.o_type == 11) {
      tmpContent = "<table width=280 height=100 border=0 cellpadding=0 cellspacing=0>" +
      "<tr><td background='http://filei.sayclub.kr/images/ditto/lounge/g_alert_bg.gif' style='padding:5px 0 0 80px;'>" +
      "<table width=185 height=75 border=0 cellpadding=0 cellspacing=0>" +
      "<td height=25 valign=top>" +
      this.o_title +
      "</td></tr>" +
      "<tr><td><a href=" +
      this.o_content_link +
      " target=_self>" +
      this.o_content +
      "</td></tr></table>" +
      "</td></tr></table>"
      
      o.html(tmpContent);
      return;
  }
  
  
  if (this.o_type == 'default') { // SayAlertHompy 로 올때 기본.
      tmpContent = "" +
      "<style type='text/css'>" +
      "<!--" +
      "td {  font-family: '굴림'; font-size: 12px}" +
      "-->" +
      "</style>" +
      "<table width='158' border='0' cellspacing='0' cellpadding='0' style='layout:fixed;'>" +
      "<tr> " +
      "<td><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_round_01.gif' width='6' height='6'></td>" +
      "<td><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_round_02.gif' width='145' height='6'></td>" +
      "<td><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_round_03.gif' width='7' height='6'></td>" +
      "</tr>" +
      "<tr> " +
      "<td><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_round_04.gif' width='6' height='110'></td>" +
      "<td width='145' height='110' valign='top' style='padding-top:8px; padding-left:8px;' bgcolor='#FFFFFF'> " +
      "<table width='129' border='0' cellspacing='0' cellpadding='0' height='97'>" +
      "<tr> " +
      "<td valign='top' style='letter-spacing:-1;' height='17'><b><font color='464646'>" +
      this.o_title +
      "</font></b></td>" +
      "</tr>" +
      "<tr> " +
      "<td valign='top' height='18'><u><font color=ff6600><span style='width:125;text-overflow:ellipsis;overflow:hidden'><nobr>" +
      this.o_caption +
      "</nobr></span></font></u></td>" +
      "</tr>" +
      "<tr> " +
      "<td valign='top' height='62'> " +
      "<table width='129' border='0' cellspacing='0' cellpadding='0'>" +
      "<tr> " +
      "<td width='60' valign=middle>" +
      this.o_character +
      "</td>" +
      "<td align='center'> " +
      "<table width='57' border='0' cellspacing='0' cellpadding='0' height='17'>" +
      "<tr> " +
      "<td width='3' valign='top' style='padding-top:4px;'><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_bullet_arrow.gif' width='3' height='6' align='absmiddle'></td>" +
      "<td width='4'></td>" +
      "<td width='50' style='letter-spacing:-1;'><font color='336699'><a href='#' onclick=\"javascript:open_hompy2_srl('_myself');\">홈피가기</a></font></td>" +
      "</tr>" +
      "</table>" +
      "<table width='57' border='0' cellspacing='0' cellpadding='0' height='17'>" +
      "<tr> " +
      "<td width='3' valign='top' style='padding-top:4px;'><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_bullet_arrow.gif' width='3' height='6' align='absmiddle'></td>" +
      "<td width='4'></td>" +
      "<td width='50' style='letter-spacing:-1;'><font color='336699'><a href='#' onclick=\":open_window('http://my.sayclub.com/popup_change_whorualert.nwz','_blank','width=300,height=200,resizable=no,scrollbars=no,scrolling=no')\">알림설정</a></font></td>" +
      "</tr>" +
      "</table>" +
      "</td>" +
      "</tr>" +
      "</table>" +
      "</td>" +
      "</tr>" +
      "</table>" +
      "</td>" +
      "<td><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_round_05.gif' width='7' height='110'></td>" +
      "</tr>" +
      "<tr> " +
      "<td><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_round_06.gif' width='6' height='7'></td>" +
      "<td><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_round_07.gif' width='145' height='7'></td>" +
      "<td><img src='http://filei.sayclub.kr/images/hompy2/dongdong/img_saypopup_round_08.gif' width='7' height='7'></td>" +
      "</tr>" +
      "</table>";
      
      o.html(tmpContent);
      return;
  }
  
  
  // 여기서 아래 두개는 기본...
  
  if (this.o_background == "") {
      o.html("" +
      "<table valign='top' cellpadding='0' cellspacing='0' border='0' width='" +
      this.o_width +
      "px' height='" +
      this.o_height +
      "px' " + this.o_alllinktext+ "margin='0px';>" +
      "  <col width='9px'><col width='*'><col width='9px'>" +
      "  <tr height='9px'>" +
      "    <td style='line-height:5px;'><img src='http://filei.sayclub.kr/images/sayalert/img_homealert_box_round01.gif' width='9px' height='9px' border='0'></td>" +
      "    <td style='line-height:5px;'><img src='http://filei.sayclub.kr/images/sayalert/img_homealert_box_top.gif' border='0' width='100%' height='9px'></td>" +
      "    <td style='line-height:5px;'><img src='http://filei.sayclub.kr/images/sayalert/img_homealert_box_round02.gif' border='0' width='9px' height='9px'></td>" +
      "  </tr>" +
      "  <tr valign='top'>" +
      "    <td style='line-height:5px;'><img src='http://filei.sayclub.kr/images/sayalert/img_homealert_box_left_top.gif' border='0' width='9px' height='" +
      (this.o_height - 18) +
      "px'></td>" +
      "    <td bgcolor='#FFFFFF' valign='middle'>" +
      "    <!-- ===================================================== -->" +
      "      <table cellpadding='0px' cellspacing='0px' border='0' align='center'>" +
      "        <tr><td height='" +
      this._SayAlertMessageHeight +
      "' style='line-height:140%'>" +
      this.o_caption +
      "        </td></tr>" +
      "        <tr><td height=3></td></tr>" +
      "        <tr>" +
      "         <td style='padding:3px;'>" +
      "          <table border=0 cellpadding=0 cellspacing=0 width=100%>" +
      "           <tr>" +
      "            <td align=" +
      this.o_linktexthalign +
      " valign=" +
      this.o_linktextvalign +
      ">" +
      this.o_linktext +
      "</td>" +
      "            <td align=" +
      this.o_charalign +
      " valign='middle'>" +
      this.o_character +
      "</td>" +
      "           </tr>" +
      "          </table>" +
      "         </td>" +
      "        </tr>" +
      "      </table>" +
      "    <!-- //===================================================== -->" +
      "    </td>" +
      "    <td  style='line-height:5px;'><img src='http://filei.sayclub.kr/images/sayalert/img_homealert_box_right_top.gif' border='0' width='9px' height='" +
      (this.o_height - 18) +
      "px'></td>" +
      "  </tr>" +
      "  <tr height='9px'>" +
      "    <td style='line-height:5px;'><img src='http://filei.sayclub.kr/images/sayalert/img_homealert_box_round03.gif' border='0' width='9px' height='9px'></td>" +
      "    <td style='line-height:5px;'><img src='http://filei.sayclub.kr/images/sayalert/img_homealert_box_bottom.gif' border='0' width='100%' height='9px'></td>" +
      "    <td style='line-height:5px;'><img src='http://filei.sayclub.kr/images/sayalert/img_homealert_box_round04.gif' border='0' width='9px' height='9px'></td>" +
      "  </tr>" +
      "</table>");
      
      return;
  }
  else {
      o.html("" +
      "<table cellpadding=0 cellspacing=0 border=0 width=" +
      this.o_width +
      " height=" +
      this.o_height +
      " style='position:absolute; top:0px; left:0px; z-index:0;'>" +
      "  <tr><td><img src='" +
      this.o_background +
      "'></td></tr>" +
      "</table>" +
      "" +
      "<table cellpadding=0 cellspacing=0 border=0 width=" +
      this.o_width +
      " height=" +
      this.o_height +
      " style='position:absolute; top:0px; left:0px; z-index:1;'>" +
      "  <tr height=9><td></td></tr>" +
      "  <tr height=" +
      (this.o_height - 14) +
      ">" +
      "    <td width=7></td>" +
      "    <td align=center valign=bottom>" +
      "      <table cellpadding=0 cellspacing=0 border=0 width=" +
      (this.o_width - 25) +
      ">" +
      "        <tr><td height=" +
      this._SayAlertMessageHeight +
      " valign=top>" +
      this.o_caption +
      "</td></tr>" +
      "        <tr height=3><td></td></tr>" +
      "        <tr><td>" +
      "          <table cellpadding=0 cellspacing=0 border=0 border=0 width=100%>" +
      "            <tr>" +
      "              <td align=" +
      this.o_linktexthalign +
      " valign=" +
      this.o_linktextvalign +
      ">" +
      this.o_linktext +
      "</td>" +
      "              <td align=" +
      this.o_charalign +
      " valign=middle>" +
      this.o_character +
      "</td>" +
      "            </tr>" +
      "          </table>" +
      "        </td></tr>" +
      "      </table>" +
      "    </td>" +
      "    <td width=7></td>" +
      "  </tr>" +
      "  <tr height=5><td></td></tr>" +
      "</table>");
      
      return;
  }

  return;
}

// call function by notify2 ( notify가 랜덤하게 오기 때문에 공통파일에 넣어두자 )
// 신청곡 게시판
function setHotRequestNotify(str,nick,mode)
{
  if (typeof(chatCommon) != "undefined")
    chatCommon.setHotRequestNotify(str,nick,mode);
  else if (typeof(window.opener) != "undefined" && typeof(window.opener.chatCommon) != "undefined")
    window.opener.chatCommon.setHotRequestNotify(str,nick,mode);
}
// 최근글 CJ톡
/* @TODO: 로즈프로젝트 오픈후 삭제하자
function setHotCjtalkNotify(str)
{
  if (typeof(chatCommon) != "undefined")
    chatCommon.setHotCjtalkNotify(str);
  else if (typeof(window.opener) != "undefined" && typeof(window.opener.chatCommon) != "undefined")
    window.opener.chatCommon.setHotCjtalkNotify(str);
}
*/
// 장미꽃 구매후
function updateRoseCntNotify(pRoseCnt,pCjmsrl)
{
  if (typeof(chatCommon) != "undefined")
  {
    if (pRoseCnt)
      chatCommon.setMyRoseCnt(pRoseCnt,-1,-1);
    chatConsole.sendRose();
  }
  else if (typeof(sayradioJs) != "undefined")
  {
    sayradioJs.popGift();
  }
  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");
}
