//<![CDATA[
var doc = document

//lijit hack
function lijitHackFn() 
 { if (navigator.userAgent.toLowerCase().indexOf("windows ce") < 0)
    { document.write(   "<div id='searchBox'><script type='text/javascript' "+
                       "src='http://www.lijit.com/informers/wijits?"+
                       "type=pvs&username=marxidad&js=1'>"+
                       "</s"+"cript><a style='color: #999' "+
                       "href='http://www.lijit.com' id='lijit_wijit_pvs_link'>"+
                       "Lijit Search</a></div>") 
   }
 }

// Netscape Stylesheet Fixes
// " {}\n"+
if (document.layers)
 { css = "<style type='text/css'><!--\n"+
         "body,td,li {font-size:small;margin: glub}\n"+
         "p {text-indent:1em;font-size:small}\n"+
         "hr {width: 100%;margin-right: 0px}\n"+
         ".date,.time,.hr {background-image:none;padding:3px}\n"+
         ".date{font-size:small;font-weight:bold}\n"+
         ".time{font-size:small}\n"+
         "hr {margin: auto}\n"+
         ".links, td div.links {font-size:small;padding:5px}\n"+
         ".top .links,.last-updated {position: glub}\n"+
         ".tagline {font-size: small}\n"+
         "P.geek {width: auto}\n"+
         "td table.hCalendarTable td {background-color: #666;color:#fff}\n"+
         "td.hCalendarDayLinked a{font-weight:bold;color:#fff}\n"+
         "td td.hCalendarDay,tr.hCalendarMonthYearRow td,tr.hCalendarDayNameRow td\n"+
         " { border:0px;font-weight:bold}\n"+
         "td td.hCalendarDay {color: #ccc}\n"+
         "* {} \n"+
         "--></style>"

   doc.write(css)
 }

// Textarea Editor Functions
function sel() // Returns selected text as a textRange object
 { return document.selection.createRange()
 }
function isTextarea() // Checks to see if selection is in a text area
 { if (sel().parentElement().tagName == "TEXTAREA") return true
 }
function date()
 { if (isTextarea()) sel().text = "<div class=\"date\">"+selText()+"</div>\n"
 }
function time()
 { if (isTextarea()) sel().text = "<div class=\"time\">"+selText()+"</div>\n"
 }
function paragraph()
 { if (isTextarea()) sel().text = "<p>"+selText()+"</p>\n"
 }
function strongEmphasis()
 { var space = (sel().text.charAt(sel().text.length-1)==" ") ? " " : ""; 
   if (isTextarea()) sel().text = "<strong>"+selText()+"</strong>"+space
 }
function emphasis()
 { var space = (sel().text.charAt(sel().text.length-1)==" ") ? " " : ""; 
   if (isTextarea()) sel().text = "<em>"+selText()+"</em>"+space
 }
function link()
 { if (isTextarea())
    { var url   = prompt("Type in a URL","http://")
      var space = (sel().text.charAt(sel().text.length-1)==" ") ? " " : ""; 
      if (url==null || url == "http://") url = "http://www.marxidad.com/"
      var urlTitle = prompt("Type in the link's TITLE","")
      if (urlTitle==null || urlTitle == "") urlTitle = ""
      else urlTitle = " title=\""+urlTitle+"\""
      sel().text = "<a href=\""+url+"\""+urlTitle+">"+selText()+"</a>"+space
    }
 }
function scriptTag()
 { var space = (sel().text.charAt(sel().text.length-1)==" ") ? " " : ""; 
   if (isTextarea()) sel().text = "<scrip"+"t type='text/javascript'>"+
                                  selText()+"</scrip"+"t>"+space
 }
function anyTag()
 { if (isTextarea())
    { var tag   = prompt("Type in a tag name","div")
      var space = (sel().text.charAt(sel().text.length-1)==" ") ? " " : ""; 
      if (tag==null) tag = ""
      var attribs = prompt("Type in any attributes","")
      if (attribs==null||attribs=="") attribs = ""
      else attribs = " "+attribs
      sel().text = "<"+tag+attribs+">"+selText()+"</"+tag+">"+space
    }
 }
function editButtons()
 { for (var i=0;i < doc.forms.length;i++)
    { if (doc.forms[i].body)
      {doc.write("<button onclick='date()'>Date</button> &nbsp; "+
                 "<button onclick='time()'>Time</button> &nbsp; "+
                 "<button onclick='paragraph()'>&lt;P&gt;</button> &nbsp;"+
                 "<button onclick='strongEmphasis()'><strong>"+
                 "STRONG</strong></button> &nbsp; <button onclick='emphasis()'"+
                 "><em>EM</em></button> &nbsp; "+
                 "<button onclick='link()' style='color: blue;"+
                 "text-decoration:underline'>A&nbsp;</button> &nbsp; "+
                 "<button onclick='scriptTag()'>script</button> &nbsp; "+
                 "<button onclick='anyTag()'>&lt;?&gt;</button>"
                );

       return;
      }
    }
 } 

//randomNumber - used by circleImage()
function randomNumber()
 { var randNum = Math.round((19)*Math.random());
   return randNum
 }

//Circle Image - mod'd by ERC
function circleImage()
 { RandomNumber = randomNumber() 
   var x        = (document.location.toString().indexOf("BurningMan") > -1) ? 
                  "bm" : RandomNumber ;
   //var path     = (RandomNumber < 19) ? "weblogger.com/weblogger1/" :
                                        //"redjupiter.com/users/images/";

   //Weblogger.com workaround for failed attempts to replace static files
  // { if (x == 8 || x== 9) x += "007";
  //   if (x == 19)         x += "001"
 //  }

   //document.write("<img src='http://downloads."+ path +"marxidad/circledot"+
   //               x +".gif' width='120' height='115' border='0' alt=''>"
   //              )
   document.write("<img src='/wp-content/themes/marxidad/images/circledot" + x +".gif' width='120' height='115' border='0' alt=''>")
 }



//Em-dash
function mdash()
 { document.write((document.all) ? "&mdash;" : "--")
 }

//Trademark symbol
function tm()
 { document.write((document.layers) ? "<sup>TM</sup>" : "&trade;")
 }

//Link To Archive 
function prevLink()
 {  if (document.location=='http://www.marxidad.com/' ||
       document.location=='http://www.marxidad.com/default'
       ) 
    { document.write("<div class=\"see-also\" style=\"margin-left:5%\">"+
                     "<a href=\"http://www.marxidad.com/2001/04/23\">"+
                     "April 28 entry...</a></div>"
                     )
    
    }
 }