function creatediv(id, html, width, height, left, top) { 
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id', id);
	if (width) { 
		newdiv.style.width = 300; 
	} 
	
	if (height) { 
		newdiv.style.height = 300; 
	} 
	
	if ((left || top) || (left && top)) { 
		newdiv.style.position = "absolute"; 
		if (left) { 
			newdiv.style.left = left; 
		} 
		
		if (top) { 
			newdiv.style.top = top; 
		} 
	} 
	
	newdiv.style.background = "#00C"; 
	newdiv.style.border = "4px solid #000"; 
	
	if (html) {
		newdiv.innerHTML = html; 
	} 
	else { 
		newdiv.innerHTML = "nothing"; 
	} 
	
	document.body.appendChild(newdiv);
} 


function grayOut(vis, options) { 
	// Pass true to gray out screen, false to ungray  
	// options are optional.  This is a JSON object with the following (optional) properties  
		// opacity:0-100         
		// Lower number = less grayout higher = more of a blackout   
		// zindex: #            
		// HTML elements with a higher zindex appear on top of the gray out 
		// bgcolor: (#xxxxxx)    
		// Standard RGB Hex color code  
		// grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'}); 
		// Because options is JSON opacity/zindex/bgcolor are all optional and can appear  
		// in any order.  Pass only the properties you need to set.  
		
	var options = options || {};   
	var zindex = options.zindex || 50; 
	var opacity = options.opacity || 70;  
	var opaque = (opacity / 100);  
	var bgcolor = options.bgcolor || '#000000';  
	var dark=document.getElementById('darkenScreenObject');  
	if (!dark) {    
		// The dark layer doesn't exist, it's never been created.  So we'll   
		// create it here and apply some basic styles.    
		// If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917    
		var tbody = document.getElementsByTagName("body")[0];    
		var tnode = document.createElement('div');           
		// Create the layer.        
		tnode.style.position='absolute';
		// Position absolutely
		tnode.style.top='0px';
		// In the top
		tnode.style.left='0px';
		// Left corner of the page
		tnode.style.overflow='hidden';
		// Try to avoid making scroll bars
		tnode.style.display='none';
		// Start out Hidden
		tnode.id='darkenScreenObject';
		// Name it so we can find it later
		tbody.appendChild(tnode);
		// Add it to the web page
		dark=document.getElementById('darkenScreenObject');
		// Get the object.  
	}  
	if (vis) {    
		// Calculate the page width and height     
		if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
			var pageWidth = document.body.scrollWidth+'px';        
			var pageHeight = document.body.scrollHeight+'px';    
		}
		else if( document.body.offsetWidth ) {
			var pageWidth = document.body.offsetWidth+'px';      
			var pageHeight = document.body.offsetHeight+'px';    
		}
		else {
			var pageWidth='100%';
			var pageHeight='100%';
		}
	
		//set the shader to cover the entire page and make it visible.
		dark.style.opacity=opaque;
		dark.style.MozOpacity=opaque;
		dark.style.filter='alpha(opacity='+opacity+')';
		dark.style.zIndex=zindex;
		dark.style.backgroundColor=bgcolor;
		dark.style.width= pageWidth;
		dark.style.height= pageHeight;
		dark.style.display='block';
	}
	else {
		dark.style.display='none';  
	}
}

function openVideo(file, position) {
	
	instance = 0;
	instance_available = 0;
	while (instance_available != 1) {
		instance++;
		test_div = document.getElementById('videoOverlay' + instance);
		if (!test_div) {
			instance_available = 1;
		}
	}
	
	var divWidth = "442";
	var divHeight = "402";
	
	var tbody = document.getElementsByTagName("body")[0];
	var tnode = document.createElement('div');           
	// Create the layer.        
	tnode.style.position='absolute';
	// Position absolutely
	
	tnode.style.width=divWidth + "px";
	tnode.style.height=divHeight + "px";
	
	winW = document.documentElement.clientWidth;
  	winH = document.documentElement.clientHeight;
	
	if (position == "bottomLeft") {
		divH = winH - divHeight;
		divW = 0;
	}
	// ELSE CENTER
	else {
		divH = (winH / 2) - (divHeight / 2);
		divW = (winW / 2) - (divWidth / 2);
	}
	

	tnode.style.top = divH + "px";
	// In the top
	tnode.style.left = divW + "px";
	
	// Left corner of the page
	
	tnode.style.background='#FFFFFF';
		
	tnode.style.overflow='hidden';
	// Try to avoid making scroll bars
	//tnode1.style.display='none';
	// Start out Hidden
	tnode.id='videoOverlay' + instance;
	// Name it so we can find it later
	tnode.style.zIndex = "100";
	tnode.innerHTML = '<iframe id="videoOverlayFRAME' + instance + '" src="/videos/video-iframe.cfm?id=' + instance + '&file=' + file + '" width="440px" height="400px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"></iframe>';
	tbody.appendChild(tnode);
	// Add it to the web page
}


function closeIFRAME(instance, redirectLocation) {
	var thediv = document.getElementById('videoOverlay' + instance);
	if (thediv) {
		thediv.parentNode.removeChild(thediv);
	}
	if (redirectLocation != '0') {
		window.location = redirectLocation;
	}
	
	grayOut(false);
}

<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
//-->

