

// dreamweaver rollovers

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//

function insertFlash(swfName, width, height, loop)
{
	
	html = AC_FL_GetContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'width', width,
		'height', height,
		'src', 'http://www.envirolighting.net/_flash/'+swfName,
		'quality', 'high',
		'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', loop,
		'scale', 'showall',
		'wmode', 'transparent',
		'devicefont', 'false',
		'id', swfName,
		'bgcolor', '#b21d0a',
		'name', swfName,
		'menu', 'true',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', 'http://www.envirolighting.net/_flash/'+swfName,
		'salign', ''
		); //end AC code
		
	document.getElementById('flashContainer').innerHTML = html;

}

function insertVideo(videoName, mode)
{
	// strip '/' from beginning of videoName (if it exists)
	videoName.replace(/^\//, '');
	
	if (!mode) {
		mode == 'http';
	}
	mode = mode.toLowerCase();

	var siteRoot = 'http://www.envirolighting.net';

	AC_FL_RunContent(
			'codebase', mode+'://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '320',
			'height', '290',
			'src', siteRoot+'/_flash/enviro_video_skin',
			'FlashVars', 'videoUrl='+siteRoot+'/_flash/'+videoName+'.flv',
			'quality', 'best',
			'pluginspage', mode+'://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'enviro_video_skin',
			'bgcolor', '#ffffff',
			'name', 'enviro_video_skin',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', siteRoot+'/_flash/enviro_video_skin',
			'salign', ''
			); //end AC code
}

/*
	show a progress image while waiting on form submittal.
	this is hacky because IE is a piece of crap and stops animated gifs while a form is submitting
	to use:  
		- call preloadProgressImage('IMAGES_ROOT_URL'); in onload tag
		- include <img src="IMAGES_ROOT_URL/ajax-loader.gif" id="progressImage" alt="" /> somewhere on the page
		- include an onsubmit function within form tag
		- call showProgressImage(0) in onsubmit function
*/
function preloadProgressImage(imagesUrl)
{
	progressImages = new Array();
	
	if (getBrowserId() == 'msie') {
		var numFrames = 8;
		for(i=0; i<numFrames; i++) {
			progressImages[i] = new Image;
			progressImages[i].src = imagesUrl+'/loader/ajax-loader_0000'+i+'.gif';
		}
	} else {
		progressImages[0] = new Image;
		progressImages[0].src = imagesUrl+'/ajax-loader.gif';
	}
}

function showProgressImage(frame)
{
	if (getBrowserId() == 'msie') {
		frame = (frame > progressImages.length-1) ? 0 : frame;
		document.getElementById('progressImage').src = progressImages[frame].src;
		setTimeout('showProgressImage('+(frame+1)+')', 80);
	} else {
		document.getElementById('progressImage').src = progressImages[0].src;
	}
}


// product popup

function showProductLarge(url)
{
	var h = (document.body.offsetHeight) ? document.body.offsetHeight : window.innerHeight;
	var w = (navigator.appName.indexOf("Microsoft")!=-1) ? 800 : window.innerWidth;
	h = (h < 550) ? 550 : h;
	topPos = (h - 550)/2;
	leftPos = (w - 550)/2;
	prodDiv = document.getElementById('productWindow');
	prodDiv.style.position = 'absolute';
	prodDiv.style.top = topPos+'px';
	prodDiv.style.left = leftPos+'px';
	prodDiv.style.width = '550px';

	html = '<div class="productWindow">';
	html += '<div style="text-align: right; padding: 5px 20px 10px 0px; width: 500px;"><a href="javascript: hideProductLarge();">Close Window</a></div>';
	html += '<img src="SITE_ROOT_URL/'+url+'" alt="" />';
	html += '</div>';
	
	prodDiv.innerHTML = html;
}

function hideProductLarge()
{
	document.getElementById('productWindow').innerHTML = '';	
}


