var up_sURL="http://cache.static.userplane.com/presence"; //d
var up_dURL="http://feed.presence.userplane.com/presence";
var up_wmURL="";
var up_cmdURL="";
var up_alwaysNotify=true;
var up_pServ="03.presence.userplane.com,04.presence.userplane.com";  

   
function up_launch(_1)
{
	up_ow[_1]=up_ow[_1]==undefined?null:up_ow[_1];  
	var _2=false;
	if(up_ow[_1]!=null)
	{
		try
		{							
					_2=up_ow[_1].opener==top&&!up_ow[_1].closed;
		}
		catch(e){}
	}
	if(up_ow[_1]==null||!_2)
	{		
      up_ow[_1]=window.open(up_wmURL+"&strDestinationUserID="+_1,"ICWindow_"+_1,"width=500,height=500,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=0");	
																																																			
			if(up_ow[_1]==null)
      { 			
        up_notify(_1);
      }
      else
      {				
        up_clear(_1,false);
      }
      
  }
}

function up_clear(_3,_4)
{

  var l=up_la;
  up_la=new Array();
  var _6=false;
  if(_4)
  {
    up_notifyOnClickedNo(_3);
  }
  while(l.length>0)
  {
    var _7=l.pop();
    if(_7.uid!=_3)
    {
      up_la.push(_7);
    }
    else
    {
      _6=true;
    }
  }
  if(_6||!_4)
  {			
    frames["up_lf"].location.href=up_dURL+"/o.php?domain_id="+up_domain_id+"&sid="+up_user_id+"&ou="+_3+"&forceClear="+(_4?"true":"false");
  }
  up_show();
}

function up_notify(_8)
{

  var _9=true;
  for(var i=0;i<up_la.length;i++)
  {
    if(up_la[i].uid==_8)
    {
      _9=false;
    }
  }
  if(_9)
  {
    var _b=new Object();
    _b.uid=_8;
    _b.n="A website member";
    up_la.push(_b);
  }
  up_show();
}

function up_show()
{

	var html = '';
  var e=document.getElementById("up_nd");
  if(up_la.length>0)
  {
  
    if(up_uid_display!=up_la[0].uid)
    {       
			html +="<div style=\"text-align:center\">";			
			html +="<table height=\"99%\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"DIV_IWM\" >"
			html +="<tr class=\"DIV_IWM_title\"><td nowrap align=\"center\">"
			html +="Incoming IM Message from employer"
			html +="</td></tr>"

			html +="<tr><td class=\"DIV_IWM_desc\" align=\"center\">"
			//html +=up_la[0].n
			html +="An employer would like to chat<br/>with you about one of the jobs<br/>in your matched jobs list."
			html +="<br><b>Would you like to accept?</b>"
			html +="</td></tr>"
			html +="<tr><td class=\"DIV_IWM_desc\" nowrap align=\"center\">"
			html +="<a class=\"BtnsGif1 whiteBtnTile1 linkBlue boldText4\" onClick=\"javascript: up_launch( '"+up_la[0].uid+"' ); return false;\"><b>Yes</b></a>"
			html +="&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"
			html +="<a class=\"BtnsGif1 whiteBtnTile1 linkBlue boldText4\" onClick=\"javascript: up_clear( '"+up_la[0].uid+"', true ); return false;\"><b>No</b></a>"
			html +="</td></tr>"
			html +="<tr><td class=\"DIV_IWM_desc\"><br/></td></tr>"			
			html +="</table>"			
		  html +="</div>"
			
      e.innerHTML= html;
      up_uid_display=up_la[0].uid;
      up_animate(200);
    }
  }
  else
  {
    up_uid_display="";
    up_animate(-200);
  }
}

function up_animate(dY)
{

  var e=document.getElementById("up_nd");
  if(up_divY!=dY||up_la.length>0)
  {
    if(up_divY!=dY)
    {
      up_divY+=dY<up_divY?-10:10;
    }
    var px=up_divY+document.body.scrollTop+"px";    
    e.style.top=px;
    clearTimeout(up_at);
    up_at=setTimeout("up_animate("+dY+")",33);
  }
  else
  {
    e.style.top=dY;
  }
}

function up_clean(ins)
{
  var _11="";
  for(var i=0;i<ins.length;i++)
  {
    var c=ins.charAt(i);
    if((c>="A"&&c<="Z")||(c>="a"&&c<="z")||(c>="0"&&c<="9"))
    {
      _11+=c;
    }
    else
    {
      _11+="_";
    }
  }
  return _11;
}

function receiveData(_14)
{
  if(_14!="")
  {
    var a=_14.split(",");
    if(a.length>0)
    {
      while(u=a.shift())
      {
        if(up_alwaysNotify)
        {
          up_notify(u);
        }
        else
        {
          up_launch(u);
        }
      } //{While}
    } //{if}
  } //{if}
}


function URLencode(_16)
{
  return escape(_16).replace(/\+/g,"%2B").replace(/\"/g,"%22").replace(/\'/g,"%27").replace(/\//g,"%2F");
}

function up_runPresence(_17,_18)
{
 
	var divLeft = 30;  //String(document.body.clientWidth - 300) + 'px'	
  up_user_id=URLencode(_18);
  up_domain_id=_17;
  up_divY=-200;
  up_la=new Array();
  up_ow=new Object();
  up_uid_display="";
  document.write("<iframe name=\"up_lf\" id=\"up_lf\" style=\"position:absolute; top: -200px; z-index:9998; width:100px; height:100px; border: 0px\" src=\"\"></iframe>");
  document.write("<iframe name=\"up_cf\" id=\"up_cf\" style=\"position:absolute; top: -200px; z-index:9977; width:1px; height:1px; border: 0px\" src=\"\"></iframe>");
  document.write("<div id=\"up_nd\" style=\"position:absolute; width:250px; z-index:111111; left: " + divLeft + "; top: -200px; background-color:#eeeeee; border: 1px solid #000000;\"></div>");
  if(up_user_id!="")
  {
    var _19="server="+up_pServ+"&uid="+up_user_id+"&domain_id="+up_domain_id+"&interval=5";    
    document.write("<div id=\"up_presence_swf\" style=\"position:absolute; width:100px; z-index:9996; top: -200px;\"><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" id=\"presence\" width=\"1\" height=\"1\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"movie\" value=\""+up_sURL+"/presence.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><param name=\"flashvars\" value=\""+_19+"\" /><embed src=\""+up_sURL+"/presence.swf\" flashvars=\""+_19+"\" quality=\"high\" bgcolor=\"#ffffff\" width=\"1\" height=\"1\" swLiveConnect=true id=\"presence\" name=\"presence\" align=\"middle\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object></div>");
  }
}

function up_notifyOnClickedNo(_1a)
{
  if(up_cmdURL!="")
  {
    frames["up_cf"].location.href=up_cmdURL+"?strDestinationUserID="+_1a+"&strEvent=User.ConversationRefused";
  }
}

var up_user_id=null;
var up_domain_id=null;
var up_divY=null;
var up_la=null;
var up_uid_display=null;
var up_at=null;
var up_ow=null;
var up_agt=navigator.userAgent.toLowerCase();
var up_appVer=navigator.appVersion.toLowerCase();
var up_is_mac=up_agt.indexOf("mac")!=-1;
var up_is_safari=up_agt.indexOf("safari")!=-1&&up_is_mac;
var up_is_khtml=up_is_safari||up_agt.indexOf("konqueror")!=-1;
var up_is_ie=up_appVer.indexOf("msie")!=-1&&up_agt.indexOf("opera")==-1&&!up_is_khtml;
var up_is_win=up_is_mac?false:(up_agt.indexOf("win")!=-1||up_agt.indexOf("16bit")!=-1);
var up_is_win_ie=up_is_win&&up_is_ie;

