//rollover swap technique.
function swapImage(imgName,imgURL){
	if (imgURL.length>0) {
    		document.images[imgName].src = imgURL;
    	}
}

// take a passed anchor and pop the detail based on the anchor's HREF
var detail_win = null;

function showDetail(anchor_obj) {
	if (anchor_obj.href == '') return;

	var win_width = 498;
	var win_height = 415;

//	if ( (detail_win == null) || (detail_win.closed) ) {
		detail_win = window.open(anchor_obj.href, 'detailWin', 'width=' + win_width + ',height=' + win_height + ',toolbars=no,scrolling=no,scrollbars=no');
//	}

	if (window.focus) {
		detail_win.focus();
	}

} // END: showDetail() 

// take a passed anchor and pop the detail based on the anchor's HREF
var detail_win = null;

function showRegisters(anchor_obj) {
	if (anchor_obj.href == '') return;

	var win_width = 300;
	var win_height = 300;

//	if ( (detail_win == null) || (detail_win.closed) ) {
		detail_win = window.open(anchor_obj.href, 'detailWin', 'width=' + win_width + ',height=' + win_height + ',toolbars=no,scrolling=no,scrollbars=no');
//	}

	if (window.focus) {
		detail_win.focus();
	}

} // END: showRegisters() 



// written by: WillyDuitt@hotmail.com 04/03/2004
var myNumbers = [];
function randomLink(){// ADD YOUR IMAGES/LINKS BELOW //;
var theLinks = [
	[ '/images/promo.bill-of-rights.big.gif' , 'http://www.merchantbillofrights.com/', 'target="_blank"' ],
	[ '/images/promo.cash_register.big.gif' , 'http://www.directretailpos.com/store/home.php?cat=1906', '' ],
	[ '/images/promo.demo_dl2.big.gif' , 'http://www.directretailpos.com/contact.php', '' ],
	[ '/images/promo.directretail.big.gif' , 'http://www.directretailpos.com/store/home.php?cat=1561', '' ],
	[ '/images/promo.scale.big.gif' , 'http://www.directretailpos.com/store/home.php?cat=889', '' ],
	[ '/images/promo.scanner.big.gif' , 'http://www.directretailpos.com/store/home.php?cat=928', '' ],
	[ '/images/promo.retail-news.big.gif' , 'http://www.directretailpos.com/articles/index.php', '' ],
	[ '/images/promo.leasing.big.gif' , 'http://www.directretailpos.com/leases.php', '' ],
	[ '/images/promo.warranty-support.big.gif' , 'http://www.directretailpos.com/faq/systems-support.php', '' ],
	[ '/images/promo.product-specialist.big.gif' , 'mailto:info@directretailpos.com', '' ],
	[ '/images/promo.pci.gif' , 'http://www.pos-help.com/pci/index.php', '' ],
	[ '/images/promo.backup.big.jpg' , 'http://www.rdbup.com/partner/?id=drpos', 'target="_blank"' ],
	[ '/images/promo.why_buy.big.gif' , 'http://www.directretailpos.com/articles/archives/why_buy_pos.php', '' ]
];

var theNumber = Math.round(Math.random()*(theLinks.length-1));
if(myNumbers.length<theLinks.length){
for(var count=0; count<myNumbers.length; count++){
while(theNumber == myNumbers[count]){
theNumber = Math.round(Math.random()*(theLinks.length-1));
count = 0;
}
} myNumbers.push(theNumber);
} else{theNumber = 0};
var anchor = '<a href="'+theLinks[theNumber][1]+'", '+theLinks[theNumber][2]+'>';
anchor+= '<img src="'+theLinks[theNumber][0]+'"></a>';
document.writeln(anchor);
}

/**
 * Copy the value of an input field's title attribute to its value attribute.
 * Clear the input field on focus if its value is the same as its title.
 * Repopulate the input field on blur if it is empty.
 * Hide the input field's associated label if it has one.
 */
var autoPopulate = {
	sInputClass:'populate', // Class name for input elements to autopopulate
	sHiddenClass:'structural', // Class name that gets assigned to hidden label elements
	bHideLabels:true, // If true, labels are hidden
	/**
	 * Main function
	 */
	init:function() {
		// Check for DOM support
		if (!document.getElementById || !document.createTextNode) {return;}
		// Find all input elements with the given className
		var arrInputs = autoPopulate.getElementsByClassName(document, 'input', autoPopulate.sInputClass);
		var iInputs = arrInputs.length;
		var oInput;
		for (var i=0; i<iInputs; i++) {
			oInput = arrInputs[i];
			// Make sure it's a text input
			if (oInput.type != 'text') { continue; }
			// Hide the input's label
			if (autoPopulate.bHideLabels) { autoPopulate.hideLabel(oInput.id); }
			// If value is empty and title is not, assign title to value
			if ((oInput.value == '') && (oInput.title != '')) { oInput.value = oInput.title; }
			// Add event handlers for focus and blur
			autoPopulate.addEvent(oInput, 'focus', function() {
				// If value and title are equal on focus, clear value
				if (this.value == this.title) {
					this.value = '';
					this.select(); // Make input caret visible in IE
				}
			});
			autoPopulate.addEvent(oInput, 'blur', function() {
				// If the field is empty on blur, assign title to value
				if (!this.value.length) { this.value = this.title; }
			});
		}
	},
	hideLabel:function(sId) {
		var arrLabels = document.getElementsByTagName('label');
		var iLabels = arrLabels.length;
		var oLabel;
		for (var i=0; i<iLabels; i++) {
			oLabel = arrLabels[i];
			if (oLabel.htmlFor == sId) {
				oLabel.className = oLabel.className + ' ' + autoPopulate.sHiddenClass;
			}
		}
	},
	/**
	 * getElementsByClassName function included here for portability.
	 * Remove if you are already using one.
	 * Written by Jonathan Snook, http://www.snook.ca/jonathan
	 * Add-ons by Robert Nyman, http://www.robertnyman.com
	 */
	getElementsByClassName:function(oElm, strTagName, strClassName) {
	    var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
	    var arrReturnElements = new Array();
	    strClassName = strClassName.replace(/\-/g, "\\-");
	    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	    var oElement;
	    for(var i=0; i<arrElements.length; i++){
	        oElement = arrElements[i];      
	        if(oRegExp.test(oElement.className)){
	            arrReturnElements.push(oElement);
	        }   
	    }
	    return (arrReturnElements)
	},
	/**
	 * addEvent function included here for portability.
	 * Remove if you are already using an addEvent/DOMReady function.
	 * Found at http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	 */
	addEvent:function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};

/**
 * Init on window load.
 * Replace this with a call to your own addEvent/DOMReady function if you use one.
 */
autoPopulate.addEvent(window, 'load', autoPopulate.init);