/**
 * Dynamic Popup JS File
 **/

try{
  var SP_SILENT_FAIL = typeof(spSilentFail) == "boolean" ? spSilentFail : true;
  var SP_ID = typeof(spId) == "string" ? spId : null;
  var SP_HOST = typeof(spHost) == "string" ? spHost : 'http://my.springpadit.com';
  var SP_LABEL = typeof(spLabel) == "string" ? spLabel : 'Spring It!';
  var SP_COLOR = typeof(spTextColor) == "string" ? spTextColor : '#000099';
  var SP_HOVER_COLOR = typeof(spTextHoverColor) == "string" ? spTextHoverColor : SP_COLOR;
  if(SP_ID !== null && SP_ID.length > 0){
    var SP_SPANID = SP_ID.replace(/\W+/gi,'') + new Date().valueOf() + Math.floor(Math.random()*1001);
    document.write(
        '<span id="'+SP_SPANID+'" class="sp_'+SP_ID+'" style="cursor:pointer;">'+
        '<img style="border:0px none; margin:0px; display:inline; vertical-align:text-top; margin-right:5px;" src="http://www.springpadit.com/images/springpad_smallicon.gif"/><a>'+
        SP_LABEL+
        '</a></span>'
        );
    var el = document.getElementById(SP_SPANID);
    el.onclick = function(){ window.open(SP_HOST+"/s?id="+this.className.replace('sp_','')+"&pu=true","springit","width=620,height=600,resizable=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no").focus(); }
  }else{
    throw 'Blank "id" specified';
  }
}catch(e){
  if(!SP_SILENT_FAIL){
    document.write('<strong style="color:#F00;">*** Error with springit generation: '+e+' ***</strong>');
  }
}