
//////////////////////////////////////////////////////////////////////////////
// pop up external links in a new window 
		
		function externalLinks()
        {
  		  if(!document.getElementsByTagName) { return; }
  		  var anchors=document.getElementsByTagName("a");

		  for (var i=0; i<anchors.length; i++) 
          {
		    var anchor=anchors[i];
		    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") { anchor.target="_blank"; }
		    }
		  }
		window.onload=externalLinks;

//////////////////////////////////////////////////////////////////////////////
// listing showing and hiding
		//Create an array 
		var allPageTags = new Array(); 

		function toggleOn(theClass) { 
		  var allPageTags = document.getElementsByTagName("*");
		  for (i=0; i<allPageTags.length; i++) {
		    if (allPageTags[i].className==theClass) {
		      allPageTags[i].style.display='';
		    }
		  }
		} 
		function toggleOff(theClass) { 
		  var allPageTags = document.getElementsByTagName("*");
		  for (i=0; i<allPageTags.length; i++) {
		    if (allPageTags[i].className == theClass) {
		      allPageTags[i].style.display = "none";
		    }
		  }
		} 

//////////////////////////////////////////////////////////////////////////////
// addCaption 
// use alt="" text to generate a caption
// from: http://www.suodenjoki.dk/us/productions/articles/addcaption.htm
function addCaption( oImgElem, bUseCaptionMarker )
{
  // Insert Caption
  var oCaptionElem = document.createElement("div");
  oCaptionElem.className = "caption";

  if( bUseCaptionMarker)
  {
    var oCaptionMarkerElem = document.createElement("div");
    oCaptionMarkerElem.className = "caption-marker";
    var oCaptionMarkerTextElem = document.createTextNode("\u00bb");
    oCaptionMarkerElem.appendChild(oCaptionMarkerTextElem);
    oCaptionElem.appendChild(oCaptionMarkerElem );
  }

  var oCaptionTextElem = document.createElement("div");
  oCaptionTextElem.className = "caption-text";
  var oCaptionText = document.createTextNode( oImgElem.alt );
  oCaptionTextElem.appendChild(oCaptionText );
  oCaptionElem.appendChild(oCaptionTextElem);

  if( oImgElem.getAttribute("copyright") != null )
  {
    var oCopyrightElem = document.createElement("div");
    oCopyrightElem.className = "copyright";
    var oCopyrightText = document.createTextNode( 
      oImgElem.getAttribute("copyright") );
    oCopyrightElem.appendChild(oCopyrightText);
    oCaptionElem.appendChild(oCopyrightElem );
  }

  if(oImgElem.nextSibling) 
    oImgElem.parentNode.insertBefore(oCaptionElem,
      oImgElem.nextSibling);
  else
    oImgElem.parentNode.appendChild(oCaptionElem);

  with(oImgElem.style)
  {
    oCaptionElem.style.width = (oImgElem.width+borderLeft+
      borderRight+paddingLeft+paddingRight)+"px";
  }

  return true; 
}

//////////////////////////////////////////////////////////////////////////////
// print license statements
function printBySA()
{
// time to switch away from Creative Commons, since the are not interested in ethics or freedom
//	document.write('<p class="license">All media files are released under a <a href="http://creativecommons.org/licenses/sa/1.0/" rel="external">Creative Commons ShareAlike</a> license.  Please give credit where credit is due.</p>');
// Honestly, fuck all this legal crap, its time to eliminate the lawyers and go public domain
//	document.write('<p class="license">All media files are released under a <a href="http://artlibre.org/licence/lal/en/" rel="external">Free Art License</a> (please give credit where credit is due).</p>');
	document.write('<p class="license">All media files are released into the <Strong>public domain</strong>, no need for lawyers! Please give credit where credit is due.</p>');

	return true;
}
// display GNU GPL
function printGPL()
{
	document.write('<p class="license">All source code is released under the <a href="http://www.fsf.org/licenses/gpl.html" rel="external">GNU GPL</a> License. </p>');
	
	return true;
}

//////////////////////////////////////////////////////////////////////////////
// obfuscate email addresses from the spambots (probably doesn't help, alas...) 
function genAntiSpamBot()	
{			
	var notuser = "hans"; 
	var domain = "eds";
	var root = "org";
	
	document.write(notuser + '@' + domain + '.' + root);
}
function genAntiSpamBotURL(subnotject,bodytext)	
{			
	var second = "lto:";
	var first = "mai";
	var third = "?sub";
	var fourth = "ject=";

	document.write('<a class="email" href="' + first + second);
	genAntiSpamBot();
	document.write(third + fourth + subnotject + '&body=' + bodytext + '">'); 
	genAntiSpamBot();
	document.write('<abbr class="type" title="pref"></abbr></a>');
}

//////////////////////////////////////////////////////////////////////////////
// print PayPal Donate button with spambot safety
function printPayPalDonate(paymentFor) 
{
	document.write('<form action="https://www.paypal.com/cgi-bin/webscr" method="post">');
	document.write('<input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="business" value="');
	genAntiSpamBot();
	document.write('">');
	document.write('<input type="hidden" name="no_note" value="1">');
	document.write('<input type="hidden" name="currency_code" value="USD">');
	document.write('<input type="hidden" name="tax" value="0">');
	document.write('<input type="hidden" name="item_name" value="'+ paymentFor +'">');
	document.write('<input type="hidden" name="no_shipping" value="1">');
	document.write('<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">  ');
		 document.write('	 </form>	');
}

//////////////////////////////////////////////////////////////////////////////
// print PayPal Donate button with spambot safety
function printPayPalDonateEuros(paymentFor) 
{
	document.write('<form action="https://www.paypal.com/cgi-bin/webscr" method="post">');
	document.write('<input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="business" value="');
	genAntiSpamBot();
	document.write('">');
	document.write('<input type="hidden" name="no_note" value="1">');
	document.write('<input type="hidden" name="currency_code" value="EUR">');
	document.write('<input type="hidden" name="tax" value="0">');
	document.write('<input type="hidden" name="item_name" value="'+ paymentFor +'">');
	document.write('<input type="hidden" name="no_shipping" value="1">');
	document.write('<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">  ');
		 document.write('	 </form>	');
}
