var BW_DEFAULT_V1O_NS=function(){
function bwOb(obj)
{    
    this.x=0;
    this.y=0;
    this.width=parseInt(obj.style.width);
    this.height=parseInt(obj.style.height);
    
    if(obj.offsetParent)
    {
        while(1)
        {
          this.x += obj.offsetLeft;          
          this.y += obj.offsetTop;
          if (!obj.offsetParent)
            break;
          obj=obj.offsetParent;
        }
    }
    else if(obj.x)
    { this.x += obj.x; this.y += obj.y; }
}

function bw_d(id)
{ return document.getElementById(id); }

function bw_sh(id)
{ bw_d(id).style.display=''; }

function bw_hi(id)
{ bw_d(id).style.display='none'; }

function bw_dde()
{return document.documentElement; }

function bw_ddb()
{return document.body; }


function bwSc()
{
    this.width =0;
    this.height=0;
    this.scrolltop = 0;
    if (bw_dde() && bw_dde().scrollTop) this.scrolltop=bw_dde().scrollTop;
    else if (bw_ddb()) this.scrolltop =bw_ddb().scrollTop;    
    if (typeof(window.innerWidth)=='number')
    { this.width =window.innerWidth; this.height=window.innerHeight; } 
    else if (bw_dde() && (bw_dde().clientWidth || bw_dde().clientHeight))
    { this.width =bw_dde().clientWidth; this.height=bw_dde().clientHeight; }
    else if (bw_ddb() && (bw_ddb().clientWidth || bw_ddb().clientHeight))
    { this.width=bw_ddb().clientWidth; this.height=bw_ddb().clientHeight; }
    this.sh = bw_ddb() ? bw_ddb().clientHeight : this.height;
}

function bwMorph(x0, y0, x1, y1, steps)
{
    this.x0_=x0; this.x1_=x1; this.y0_=y0; this.y1_=y1;
    this.a_=(y0-y1)/(x0-x1);
    this.b_=y0 - this.a_*x0;
    this.step_=(x1-x0)/steps;        
}
bwMorph.prototype.x=function(step)
{ return parseInt(this.step_ * step+this.x0_); }
bwMorph.prototype.y=function(step)
{ return parseInt(this.x(step)*this.a_+this.b_); }


var bw_fr=new Array();
var bw_steps=10;
var bw_delay=30;
var bw_su;
var bw_wtw=920;
var bw_wth=400;
var bw_wtl=10;
var bw_wtt=10;
var bw_0='0px';
var bw_screen;

function bw_fi()
{
    bws=bw_d("bw_s");
    bws.style.width=bw_wtw+'px';
    bws.style.height=bw_wth+'px';
    bw_sh("bw_s");
    bw_d('bw_sf').src=bw_su;
    bw_sh('bw_sing');
}

return {
g_bw_fr : function(){ return bw_fr; },
bw_mo : function(bw_fr, s)
{
    if (s == bw_steps+1)
    { bw_fi(); return; }
    bws=bw_d("bw_sd");
    bws.style.left=bw_fr[0].x(s)+'px';
    bws.style.top=bw_fr[0].y(s)+'px';
    bws.style.width=(bw_fr[1].x(s) - bw_fr[0].x(s))+'px';
    bws.style.height=(bw_fr[1].y(s) - bw_fr[0].y(s))+'px';
    s++;
    setTimeout("BW_DEFAULT_V1O_NS.bw_mo(BW_DEFAULT_V1O_NS.g_bw_fr(), "+s+ ")",bw_delay);
},
bw_close : function () {
    bw_d('bw_sf').src='';
    bws=bw_d("bw_sd").style;
    bws.top=bw_0; bws.width=bw_0; bws.left=bw_0; bws.height=bw_0;
    bw_hi("bw_sd");
    bw_hi("bw_s");
    return false;
},
sbw : function(h, f, host_el_name) {
    if (null == host_el_name)
      host_el_name = 'bw_bt';
    if (!bw_d('bw_sd'))
    {      
      var ol_div = document.createElement('div');
      ol_div.setAttribute('id', 'bw_sd');
      ol_div.style.zIndex = '101'; ol_div.style.position = 'absolute';
      ol_div.style.top ='0px'; ol_div.style.height ='0px'; ol_div.style.left = '0px'; ol_div.style.width = '0px';
      ol_div.style.display = 'none'; ol_div.style.border = '1px solid #ff9600';      
      ol_div.innerHTML = '<div id="bw_s" style="color:gray; background:white; text-align:center; font-family:Verdana;">\
<table border="0" width="100%"><tr><td style="background:white;"><a href="http://www.bitwine.com" target="_blank"><img id="bw_l" align="left" border="0" /><a/></td>\
<td style="vertical-align:top; background:white; text-align:right"><a href="javascript:void(0);" style="text-decoration:none; padding:1px; font-weight:bold; border:1px solid #999; color:#999; font-size:0.9em; font-familiy:Verdana;" onclick="return BW_DEFAULT_V1O_NS.bw_close();">X</a>&nbsp;</td>\
</tr></table><div id="bw_sing"><span style="padding-top:70px;"><h3>Searching for Advisors...</h3><br/><img border="0" id="bw_pw" /></span></div>\
<iframe style="display:none;" width="0" height="0" frameborder="0" onload="BW_DEFAULT_V1O_NS.bw_onsf(this);" id="bw_sf" scrolling="auto"></iframe></div>';      
      document.getElementsByTagName('body')[0].appendChild(ol_div);
    }
    while (bw_fr.length) bw_fr.pop();
    bw_host = h;
    bw_su='http://'+bw_host+f;
    bw_screen=new bwSc();
    if (bw_screen.width+10 >= bw_wtw)
        bw_wtl=parseInt((bw_screen.width - bw_wtw) / 2);
    if (bw_screen.height+10 >= bw_wth)
        bw_wtt=parseInt((bw_screen.height - bw_wth)/2) + parseInt(bw_screen.scrolltop);
    bw_hi("bw_s");
    bw_hi('bw_sf');
    var bw_b=new bwOb(bw_d(host_el_name));
    bw_sh("bw_sd");
    bw_hi("bw_s");
    bw_d("bw_pw").src='http://'+bw_host+'/images/swidget_loading.gif';
    bw_d("bw_l").src='http://'+bw_host+'/images/sw/wbwpowered_white.gif';
    bw_fr.push(new bwMorph(bw_b.x, bw_b.y, bw_wtl, bw_wtt, bw_steps),new bwMorph(bw_b.x+bw_b.width, bw_b.y+bw_b.height, bw_wtl+bw_wtw, bw_wtt+bw_wth, bw_steps));
    setTimeout("BW_DEFAULT_V1O_NS.bw_mo(BW_DEFAULT_V1O_NS.g_bw_fr(), 0)",bw_delay);    
    return false;
},
bw_onsf : function(f) {    
    if (f.src != '' && f.src != null)
    { bw_hi("bw_sing"); f.width=bw_wtw; f.height=bw_wth-32; bw_sh('bw_sf'); }
}
}
}();(function()
{
  var search_url = '/search?widget_id='+bt_w.widget_id+'&amp;query='+bt_w.query+'&amp;wide_query='+bt_w.wide_query;
  if (bt_w.auid != '') {
	  search_url += '&amp;auid=' + bt_w.auid;
	  bt_w.auid = 'auid=' + bt_w.auid;
  }
  var res = '<div id="' + bt_w.div + '" style="width:145px !important;height:145px !important;padding:0pt !important;margin:0pt !important; background:url(http://'+ bt_w.program_host+'/images/affiliation_programs/145x145_bg.gif) repeat-y ! important;">';
  
  res += '<a href="javascript:void(0);" style="text-decoration:none !important;margin:0 !important;padding:0 !important;border:none !important;display:inline !important;background:none;"';
  res += 'onclick="return BW_DEFAULT_V1O_NS.sbw(\'' + bt_w.program_host + '\',\'' + search_url + '\',\''+bt_w.div+'\');">';
  res += '<img alt="BitWine Network" src="http://' + bt_w.program_host + '/images/affiliation_programs/default/145x145_top.gif?1320671855" ';
  res += 'style="border:none !important;margin:0 !important;padding:0 !important;width:145px !important;height:111px !important;" />';
  res += '</a>';

  res += '<a target="_blank" href="http://'+ bt_w.program_host +'/user/greeting?advisor=true&amp;' + bt_w.auid + '" style="display:inline !important;text-decoration: none !important;border:none !important;margin:0 !important; padding:0 !important;background:none;">';
  res += '<img alt="Become an Advisor" src="http://' + bt_w.program_host + '/images/affiliation_programs/145x145_mid.gif?1320671855" ';
  res += 'style="border:none !important;margin:0 !important;padding:0 !important;width:145px !important;height:13px !important;display:inline !important;" />';
  res += '</a>';
  
  res += '<a target="_blank" href="http://www.bitwine.com/?' + bt_w.auid + '" style="display:inline !important;text-decoration: none !important;margin:0 !important; padding:0 !important;border:none !important;background:none;">';
  res += '<img alt="Powered by BitWine" src="http://' + bt_w.program_host + '/images/affiliation_programs/145x145_bot.gif?1320671855" ';
  res += 'style="border:none !important;margin:0 !important;padding:0 !important;width:145px !important;height:21px !important;" />';
  res += '</a>';
  
  res += '</div>';
  document.write(res);  
})()


