// A library to handle ad placement - currently with "DoubleClick Dart" Adserver
// Modify for reuse
adbase = "http://ad.doubleclick.net/"
SiteName = "munimarketplace.com"

function getUID() {
	var id = Math.random() + "?"
	return id.substring(2)
}

// JScript 1.0 string replace function
// Performs a basic Find and Replace operation on a string
function Replace(Expression, Find, Replace) {
	var pos = 0
	while ( (pos = Expression.indexOf(Find,pos)) >= 0 )
		Expression = Expression.substring(0, pos) + Replace + Expression.substring(pos+Find.length)
	return Expression
}

function isdigit(x) { return ( x >= '0' && x <= '9' ) }

function getAdTag(PageName, KeyPairs) {
	var Page = PageName
	if ( KeyPairs.indexOf(";") > 0 )
		Page = ";pg=" + Replace(PageName, "_", "")
	var desc = '/' + SiteName + '/' + Page + ';' + KeyPairs + ';ord=' + getUID()
	return '<A HREF="' + adbase + 'jump' + desc + '"><IMG SRC="' +
			adbase + 'ad' + desc + '" BORDER="0"></A>'
}