// JavaScript Document


/**
 * Returns the portion of (string) that is between the first instance of (first)
 *    and the next instance of (next) after that.
 * If either substring not found, return null;
 */
function strBetween(string, first, next) {
	var strAry = string.split(first, 2);
	if (strAry.length == 2) {
		strAry = strAry[1].split(next, 2);
		if (strAry.length == 2) {
			return strAry[0];
		}
	}
	return null;
}



document.write('<style type="text/css">');
document.write('<!--');

document.write('.jsHide { display: none; }');
document.write('.jsShow { display: inherit; }');

document.write('.jsInvisible { visibility: hidden; }');
document.write('.jsTransparent { opacity: 0; filter: alpha(opacity=0); }');

document.write('-->');
document.write('</style>');


/*
function goSetHeight() {
  if (parent == window) return;
  else parent.setIframeHeight('ifrm');
}
*/

/**
 * Copies the body of the document in the given frame into the tag with given Id.
 * Then hides the frame.
 * Then changes the document's forms to target the hidden frame.
 * 
 * @param string frameId - must match both name and ID of the frame
 */
function copyFrameToArea(frameTag, targetTagId) {
	//alert("copyFrameToArea starting");
	//var frameTag = document.getElementById(frameId);
	var targetTag = document.getElementById(targetTagId);
	var frameTag2 = document.getElementById(frameTag.name);
	var bodyHtm = frameTag.document.body.innerHTML;
	//alert(bodyHtm);
	targetTag.innerHTML = bodyHtm;
	//frameTag.className = 'hidden_iframe';
	frameTag2.width = 1;
	frameTag2.height = 1;
	formAry = targetTag.getElementsByTagName("form");
	for (var i = 0; i < formAry.length; ++ i) {
		var formTag = formAry[i];
		formTag.target = frameTag.name;
		formTag.action = frameTag2.src;
	}
	frameTag2.frameBorder = 0;
}



function setCookie(cookieName, cookieValue, nDays) {
	var today = new Date();
	var expire = new Date();
	if (nDays==null || nDays==0) nDays=1;
	expire.setTime(today.getTime() + 3600000*24*nDays);
	document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}


