﻿var thumb_count=0
var fID
var langCode
function avatarClick(p_lUserID){
  document.location = 'user_home.asp?uid='+p_lUserID
}
function avatarUserBlock(p_lUserID,p_lSwitch){
  document.ifrmAction.document.location='user_action_block.asp?uid='+p_lUserID+'&s='+p_lSwitch
}
function avatarUserAdd(p_lUserID,p_lSwitch){
  document.ifrmAction.document.location=
    'user_action_invite.asp?uid='+p_lUserID+'&s='+p_lSwitch
}
function avatarUserMessage(p_lUserID){
  window.open('./message_pop.asp?uid='+p_lUserID,'winMsg'+p_lUserID,'width=533,height=427,resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no')
}
function avatarUserChat(p_lUserID,p_sNick){
  document.ifrmAction.document.location=
    'IM/action_invite.asp?uid='+p_lUserID

  window.open('./im/im_pop.asp?uid='+p_lUserID+'&nick='+encodeURI(p_sNick),'winIM','width=628,height=493,resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no')
//  window.open('./chat_pop.asp?with='+p_lUserID,'winChat'+Math.round(4294967295*Math.random()),'width=628,height=493,resizable=no,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no')
}
function thumbUpdate(p_lUserID){
  var objects=document.getElementsByTagName('object')
  var thumbs=new Array()
  for(var i=objects.length-1;i>=0;i--)
    if(objects[i].getAttribute('name')=='kita_thmb'+p_lUserID)
      thumbs.push(objects[i])
  for(var i=thumbs.length-1;i>=0;i--){
    thumbs[i].insertAdjacentHTML('beforeBegin',thumbCode(p_lUserID))
    thumbs[i].parentNode.removeChild(thumbs[i])
  }
}
function thumbCode(p_lUserID){
  thumb_count++
  var fmail=(fID!=0)?getCookie('EMail'):''
  var viewerID=(fID!=p_lUserID)?'&fid='+fID+'&fmail='+fmail+'&fcode='+getCookie('SessionCode'):''
  return '<object style="margin-left: 4px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="68" height="106" id="kita_thmb'+thumb_count+
    '" name="kita_thmb'+p_lUserID+'" align="middle">'+'<param name="allowScriptAccess" value="sameDomain" />'+
    '<param name="allowFullScreen" value="false" /><param name="wmode" value="transparent" />'+
    '<param name="movie" value="./flash/'+langCode+'/Avatar/kita_thumb.swf?uid='+p_lUserID+viewerID+
    '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />'+'</object>'
  // +'&'+Math.random()
}
function thumbDiv(p_lUserID,p_parentElement){
  thumb_count++
  var fmail=(fID!=0)?getCookie('EMail'):''
  var viewerID=(fID!=p_lUserID)?'&fid='+fID+'&fmail='+fmail+'&fcode='+getCookie('SessionCode'):''
  var thmb=document.createElement('span')
  thmb.id='kita_thmb'+thumb_count
  var thmbSwf=document.createElement('span')
  thmbSwf.id='kita_thmb'+thumb_count+'Swf'
  p_parentElement.appendChild(thmb)
  thmb.appendChild(thmbSwf)
  swfobject.embedSWF('./flash/'+langCode+'/Avatar/kita_thumb.swf?uid='+p_lUserID+viewerID,thmbSwf.id,68,106,'9.0.0')
  if(navigator.userAgent.indexOf('Firefox') !=-1)thmb.style.display='-moz-inline-stack'
  thmb.style.display='inline-block'
  thmb.style.paddingRight='4px'
}
function getCookie(c_name){
  if (document.cookie.length>0){
    c_start=document.cookie.indexOf(c_name+'=')
    if (c_start!=-1){
      c_start+=c_name.length+1
      c_end=document.cookie.indexOf(';',c_start)
      if (c_end==-1) c_end=document.cookie.length
      return document.cookie.substring(c_start,c_end)
    } 
  }
  return ''
}