function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		preloadFlag = true;
	}
}

function popWindow(fileName, popupName, height, width) { 
	window.open(fileName, popupName, 'width=' + width + ',height=' + height + ',scrollbars=no,resize=no,toolbar=no');
}

function popWindowScrollbar(fileName, popupName, height, width) { 
	window.open(fileName, popupName, 'width=' + width + ',height=' + height + ',scrollbars=no,resize=no,toolbar=no');
}

var winStatTim, rotString, iframeHasNotLd = new Array();
function getRefToDivNest( divID, oDoc ) {
	if( !oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
				y = getRefToDivNest(divID,oDoc.layers[x].document); }
			return y; } }
	if( document.getElementById ) { return document.getElementById(divID); }
	if( document.all ) { return document.all[divID]; }
	return document[divID];
}
function reWriteDiv(oDiv,oString,oFrame,oBGCol,oWidth,oHeight,oBorder,oRepeat) {
	if(oRepeat) { oString = unescape(oString); }
	if( !oRepeat && typeof(oWidth) != 'undefined' && typeof(oHeight) != 'undefined'  && typeof(oBorder) != 'undefined' ) {
		oString = '<table border="'+oBorder+'" cellpadding="0" cellspacing="0"><tr><td height="'+
			oHeight+'" width="'+oWidth+'" valign="top">'+oString+'</td></tr></table>'; }
	var oContent = getRefToDivNest(oDiv); //create fake objects if needed
	if( !oContent ) { oContent = new Object(); } if( !window.frames ) { window.frames = new Object(); }
	if( typeof(oContent.innerHTML) != 'undefined' ) { 
		try
		{
			oContent.innerHTML = oString; //DOM
		}
		catch (exception)
		{
			// if innerHTML is not supported, use xml build
			var parser = new DOMParser();
			while (1==1)
			{
				var b = oString.match(/<img[^>]*[^\/]>/);
				if (b == null)
					break;
				b = b.toString();
				b = b.substring(0, b.length - 1) + "/>";
				oString = oString.replace((/<img[^>]*[^\/]>/), b);
			}
			var doc = parser.parseFromString('<div xmlns="http://www.w3.org/1999/xhtml">' + oString + '<\/div>', 'application/xhtml+xml');
			var root = doc.documentElement;
			for (var i=0; i < root.childNodes.length; ++i)
				oContent.appendChild(document.importNode(root.childNodes[i], true))
//							return;

		}
		if( oContent.style ) { oContent.style.backgroundColor = oBGCol; } return; } //& Proprietary DOM
	if( oContent.document == document || !oContent.document ) { if( !window.frames.length ) { window.clearTimeout(winStatTim);
		rotString = '   -------  '+oString.replace(/<!--([^>]|[^-]>|[^-]->)*-->/g,' ').replace(/<[\/!]?[a-z]+\d*(\s+[a-z][a-z\-]*(=[^\s>"']*|="[^"]*"|='[^']*')?)*\s*(\s\/)?>/gi,' ').replace(/[^\S ]+/g,' ').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&nbsp;/g,' ').replace(/&quot;/g,'"').replace(/&amp;/g,'\t').replace(/&#?\w+;/g,' ').replace(/\t/g,'&').replace(/ +/g,' ');
		startrot(rotString.length); return; } //use status bar. Clears HTML ( clears script & CSS if in comments )
		if(!oRepeat) { window.clearTimeout(iframeHasNotLd[oFrame]); } //if they rewrite more than once before the iframe loads, only show the last one
		if(!window.frames[oFrame]) { //the iframe is unavailable until its content has loaded
			iframeHasNotLd[oFrame] = window.setTimeout('reWriteDiv(\''+oDiv+'\',\''+oFrame+'\',\''+escape(oString)+'\',\''+oBGCol+'\','+oWidth+','+oHeight+','+oBorder+',true)',100); return; }
		oContent = window.frames[oFrame].window; } //use iframe
	oContent.document.open(); //Separate contents syntax
	oContent.document.write('<html><head><title>Dynamic content</title></head><body bgcolor="'+oBGCol+'">'+oString+'</body></html>');
	oContent.document.close();
}
function startrot(rotNum) {
	if( !rotString.replace(/\s/g,'').replace(/-------/,'') ) { rotString = ''; }
	window.status = rotString.substr(rotNum) + rotString.substr(0,rotNum);
	if( rotNum == rotString.length ) { rotNum = -1; }
	if(rotString) { winStatTim = window.setTimeout('startrot('+(rotNum+1)+')',60); }
}

var submitClickTime = 0;

function submitOnce() {
    if (submitClickTime <= 0) {
        submitClickTime ++;
	return true;
    }
    else {
        alert ("Request being processed!");
        return false;
    }
}
