function tmh__make_ad_fodder(src, width, height) 
{ 
 src = src.replace(" ", ""); 
 var TEMP_IMAGE = '<img src="$src$" height="$height$" width="$width$" border="0" />'; 
 var TEMP_FLASH = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' 
  + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" ' 
  + ' height="$height$" width="$width$"> ' 
  + '<param name="movie" value="$src$" /> ' 
  + '<param name="quality" value="high" /> ' 
  + '<PARAM NAME="wmode" VALUE="transparent" /> ' 
  + '<EMBED src="$src$" quality="high" WIDTH="$width$" HEIGHT="$height$" ' 
  + ' wmode="opaque" TYPE="application/x-shockwave-flash" ' 
  + ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> ' 
  + '</object>'; 
 return (/\.swf$/gi.test(src) == true ? TEMP_FLASH : TEMP_IMAGE) 
  .replace(/\$src\$/gi, src) 
  .replace(/\$width\$/gi, width) 
  .replace(/\$height\$/gi, height) 
}
function tmh__make_ad_fodder2(src, width, height) 
{ 
 src = src.replace(" ", ""); 
 var TEMP_IMAGE = '<img src="$src$" height="$height$" width="$width$" border="0" />'; 
 var TEMP_FLASH = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' 
  + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" ' 
  + ' height="$height$" width="$width$"> ' 
  + '<param name="movie" value="$src$" /> ' 
  + '<param name="quality" value="high" /> ' 
  + '<EMBED src="$src$" quality="high" WIDTH="$width$" HEIGHT="$height$" ' 
  + ' wmode="opaque" TYPE="application/x-shockwave-flash" ' 
  + ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED> ' 
  + '</object>'; 
 return (/\.swf$/gi.test(src) == true ? TEMP_FLASH : TEMP_IMAGE) 
  .replace(/\$src\$/gi, src) 
  .replace(/\$width\$/gi, width) 
  .replace(/\$height\$/gi, height) 
}
var isFirefox=(window.navigator.userAgent.indexOf("Firefox")!=-1);
// ---------------------------------------------------
function showSelectBoxes(){
	
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}
// ---------------------------------------------------
function hideSelectBoxes(){
	
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}
// ---------------------------------------------------
function showFlash(){
	
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "visible";
	}
	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "visible";
	}
}
// ---------------------------------------------------
function hideFlash(){
	
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "hidden";
	}
	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "hidden";
	}
}
// ---------------------------------------------------
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
// ---------------------------------------------------
function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}
// ---------------------------------------------------
function startup(txt) {
	
	hideFlash();
	hideSelectBoxes();
	var overlayOpacity = 0.8;
	var overlayDuration = 0.2;
	var objBody = document.getElementsByTagName('body').item(0);
	var objOverlay = document.createElement('div');
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
		
	objOverlay.setAttribute('id','overlay');
	objOverlay.style.display = 'block';
	objOverlay.style.minHeight = arrayPageSize[1];
	objBody.appendChild(objOverlay);
	
	var objLightbox = document.createElement("div");
	objLightbox.setAttribute('id','lightbox');
	objLightbox.style.display = 'block';
	objLightbox.style.top = (102 + 'px');
	objBody.appendChild(objLightbox);
		
	var objOuterImageContainer = document.createElement('div');
	objOuterImageContainer.setAttribute('id','sys_msg');
	objLightbox.appendChild(objOuterImageContainer);
	
	document.getElementById('sys_msg').innerHTML = txt;
	//Generates opacity effects for startup
	start_opacity_effect_interval = setInterval("startup_opacity_effect('overlay')", 4);
}
// ---------------------------------------------------
function startup_opacity_effect(id){	
	
	element = $(id);
	if (isFirefox) {
		//for firefox
		if (element.style.MozOpacity == 0.4) clearInterval(start_opacity_effect_interval);
		alpha = (element.style.MozOpacity * 100 + 10) / 100;
		element.style.MozOpacity = alpha;	  
	}else{
		if (element.filters.alpha.opacity == 40) clearInterval(start_opacity_effect_interval);
		element.filters.alpha.opacity += 10;
	}
}
// ---------------------------------------------------
function end_opacity_effect(id){
	
	element = $(id);
	if (isFirefox) {
		//for firefox
		if (element.style.MozOpacity == 0.0) {
			clearInterval(end_opacity_effect_interval);
			//when effect done, remove the overlay div
			var objBody = document.getElementsByTagName('body').item(0);
			objBody.removeChild($('overlay'));
		}else{
			alpha = (element.style.MozOpacity * 100 - 10) / 100;
			element.style.MozOpacity = alpha;	  
		}		
	}else{
		if (element.filters.alpha.opacity == 0) {
			clearInterval(end_opacity_effect_interval);
			var objBody = document.getElementsByTagName('body').item(0);
			objBody.removeChild($('overlay'));
		}else{
			element.filters.alpha.opacity -= 10;
		}		
	}
}
// ---------------------------------------------------
function end() {
	
	showSelectBoxes();
	showFlash();
	var objBody = document.getElementsByTagName('body').item(0);
	//Generates opacity effects for end
	end_opacity_effect_interval = setInterval("end_opacity_effect('overlay')", 4);
	objBody.removeChild($('lightbox'));
}
// ---------------------------------------------------
function $(re) {
	return document.getElementById(re);
} 

 


