var isMSIE = /*@cc_on!@*/false;
function jsBox(goThere, w, h, noTitle, noFooter, caption) {
	var pSize =	getPageSize();
	var contentW = (w !== undefined)?w:(pSize[0]/2);
	var contentH = (h !== undefined)?h:(pSize[1]/2);
	var contentT = 0;
	var contentL = 0;
	var arrayPageScroll = getPageScrollTop();
	noTitle = (noTitle==1)?noTitle:0;
	noFooter = (noFooter==1)?noFooter:0;
	caption = (caption !== undefined)?caption:'';
	
	//Stamp = new Date();
	var ts = '0';
	//ts = Stamp.getHours() +''+ Stamp.getMinutes() +''+  Stamp.getSeconds();

    if(!document.getElementById) {
		return;
	}
	if (!noTitle)
		var title = '<div align="right"><img src="images/iconClose.gif" border="0" onclick="jsBoxClose('+ts+');return false;" style="cursor: pointer;cursor: hand" align="top"></div>';
	if (!noFooter) {
		var footer = "<div align='center' style='background:#ffffff;padding:0px;margin:0px;'><table border='0' cellpadding='0' cellspacing='0' width='"+w+"' style='background:#ffffff;padding:0px;margin:0px;'><tr><td align='left'><div style='font-size:16px;color:#666666;font-weight:bold;padding:0px;margin:0px;'>"+caption+"</div></td><td align='right'><div align=\"right\" style='padding:0px;margin:0px;'><img src='images/closelabel.gif' border='0' onclick=\"window.frames['jsBox_iframe'].muTogStop();jsBoxClose("+ts+");return false;\" style=\"cursor: pointer;cursor: hand\" align=\"top\"></div></td></tr></table></div>";
	}
	
	overlay = document.getElementById('overlay'+ts);
	if (!overlay) {
		overlay = document.createElement('div');
		overlay.id = 'overlay'+ts;
		document.body.appendChild(overlay, 0);
		overlay.style.border = 'none';
		overlay.style.position = 'absolute';
		overlay.style.top = "0px";
		overlay.style.height = overlaySize()+"px";
		overlay.style.left = "0px";
		if (isMSIE) {
			overlay.style.width = pSize[0]+"px";
		} else {
			overlay.style.right = "0px";
		}
		overlay.style.marginLeft = "0px";
		overlay.style.marginRight = "0px";
		overlay.style.paddingLeft = "0px";
		overlay.style.paddingRight = "0px";
		overlay.className = "PU_overlay";

		if(window.addEventListener){ // Mozilla, Netscape, Firefox
			overlay.addEventListener('click', overlayClick, false);
		} else { // IE
			overlay.attachEvent('onclick', overlayClick);
		}
	}
	overlay.style.display = 'block';
	
	a = document.getElementById('jsBox'+ts);
	if(!a) {
		a = document.createElement('div');
		a.id = 'jsBox'+ts;
		document.body.appendChild(a, 0);
		a.style.display = 'none';
		a.style.border = 'solid 2px #556677';
		a.style.position = 'absolute';
		a.style.background = '#ffffff';
		a.style.zIndex = 1000;
		a.style.top = (arrayPageScroll[1] + pSize[1]/2 - contentH/2 - 40) +"px";
		a.style.left = (pSize[0]/2 - contentW/2 - 20) +"px";
		//if (!noTitle) {
			a.style.marginLeft = "10px";
			a.style.marginRight = "10px";
		/*} else {
			a.style.marginLeft = "0px";
			a.style.marginRight = "0px";			
		}*/
		a.style.fontFamily = 'Arial, verdana, sans-serif';
		a.style.fontSize   = '11px';
		if (!noTitle) {
			a.titlebar = document.createElement('div');
			a.titlebar.style.padding = '4px 10px';
			a.titlebar.style.background = '#54799F url(images/thumbBG.gif) repeat-x fixed center left';
			a.titlebar.style.color      = '#ffffff';
			a.appendChild(a.titlebar);
		}
		a.content = document.createElement('div');
		a.content.style.padding = '9px';
		a.appendChild(a.content);
		if (!noFooter) {
			a.footerbar = document.createElement('div');
			a.footerbar.style.padding = '4px 10px';
//			a.footerbar.style.background = '#54799F url(images/thumbBG.gif) repeat-x fixed center left';
//			a.footerbar.style.color      = '#ffffff';
			a.footerbar.style.color      = '#cccccc';
			a.appendChild(a.footerbar);
		}
		
	}
	a.style.display = 'block';
	a.content.innerHTML = '<iframe src="'+goThere+'" width="'+contentW+'" height="'+(contentH+14)+'" marginwidth="0" marginheight="0" style="padding: 0px;border: 3px solid #666666;" scrolling="no" frameborder="0" vspace="0" name="jsBox_iframe"></iframe>';
	if (!noTitle) {
		a.titlebar.innerHTML = title;
	}
	if (!noFooter) {
		a.footerbar.innerHTML = footer;
	}
}

function jsBoxClose(which)
{
	document.getElementById('jsBox'+which).style.display='none';
	document.getElementById('overlay'+which).style.display='none';
	//document.getElementById('overlay'+which).parentNode.removeChild(document.getElementById('overlay'+which));
	//document.getElementById('jsBox'+which).parentNode.removeChild(document.getElementById('jsBox'+which));
}

function overlayClick(evt)
{
	alert('You must close the web commercial before proceeding.');
}

function getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function getPageScrollTop(){
	var yScrolltop;
	if (self.pageYOffset) {
		yScrolltop = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScrolltop = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScrolltop) 
	return arrayPageScroll;
}

function overlaySize(){
	if (window.innerHeight && window.scrollMaxY) {	
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
  	}
	return yScroll;
}
