/*
=====================================================
A Quick Sale
Global JavaScript functions library

Version 1.0
=====================================================
*/

// Function to open links to external sites in a new browser window (target attribute not allowed by XHTML 1.0 Strict)
// (c) SitePoint.com 2003 (http://www.sitepoint.com/article/standards-compliant-world/)
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;

// Function to clear a text input field on click (eg search box)
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

// Function to write default text to a text input field (eg search box)
function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

// Function to toggle visibility of a block-level element
<!--
function hidetoggleb (idtogg)
{
	document.getElementById(idtogg).style.display = (document.getElementById(idtogg).style.display == 'block') ? 'none' : 'block';
}

/*
Trigger code:

onClick="hidetoggleb('ID'); return false;"
*/

// Function to toggle visibility of an inline element
<!--
function hidetogglei (idtogg)
{
	document.getElementById(idtogg).style.display = (document.getElementById(idtogg).style.display == 'inline') ? 'none' : 'inline';
}

/*
Trigger code:

onClick="hidetogglei('ID'); return false;"
*/