
function setHeights()
{
	headerFooterHeight = 230+30+30+6; //getStyleHeight('topBanner') + getStyleHeight('bottomBanner') + getStylePadding('mainContent', 'bottom');
	minHeight = document.getElementById('mainContent').offsetHeight;
	//alert('min height: '+minHeight);

}

function getStyleHeight(id)
{
	n = document.getElementById(id).style.height.replace(/px/, '');
	return new Number(n);
}

function getStylePadding(id, direction)
{
	s = document.getElementById(id).style;
	switch(direction)
	{
		case 'top':
			n = s.paddingTop.replace(/px/, '');
			break;
		case 'bottom':
			n = s.paddingBottom.replace(/px/, '');
			alert(s.paddingBottom);
			break;
		case 'left':
			n = s.paddingLeft.replace(/px/, '');
			break;
		case 'right':
			n = s.paddingRight.replace(/px/, '');
			break;
	}

	return new Number(n);
}

function setOnResize()
{

	if (getBrowserId() == 'msie' && getBrowserMajorVersion() < 7) {
		return;
	}
	window.onresize = function(event){adjustHeights();}
}

function adjustHeights()
{
	calcHeight = document.body.offsetHeight - headerFooterHeight;
	h = (calcHeight > minHeight) ? calcHeight : minHeight;
	document.getElementById('mainContent').style.height = h + 'px';
}


function preload(urlArray)
{
	html = '';
	
	for(i=0; i < urlArray.length; i++) {
		url = urlArray[i];
		parts = url.split(/\./);
		fileExt = parts[parts.length-1];
		rest = url.replace(/\.[a-z]+$/, '');
		fileName = url.replace(/.*\//, '').replace(/\..*/, '');
		
		switch(fileExt)
		{
			case 'swf':
				html += AC_FL_GetContent(
					'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
					'width', '0',
					'height', '0',
					'src', rest,
					'quality', 'best',
					'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
					'align', 'middle',
					'play', 'true',
					'loop', 'false',
					'scale', 'showall',
					'wmode', 'transparent',
					'devicefont', 'false',
					'id', fileName,
					'name', fileName,
					'menu', 'true',
					'allowFullScreen', 'false',
					'allowScriptAccess','sameDomain',
					'movie', rest,
					'salign', ''
					);
				break;
		
		}
	}
	document.getElementById('preloader').innerHTML += html;
}


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.shoutmktg.com/_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.shoutmktg.com/_flash/'+swfName,
		'salign', ''
		); //end AC code
		
	document.getElementById('flashContainer').innerHTML = html;

}


function insertBanner(bannerName, thisPage, siteRoot)
{
	
	AC_FL_RunContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'width', '950',
		'height', '230',
		'src', 'http://www.shoutmktg.com/_flash/'+bannerName,
		'FlashVars', 'thisPage='+thisPage+'&siteRoot='+siteRoot,
		'quality', 'high',
		'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'false',
		'scale', 'showall',
		'wmode', 'transparent',
		'devicefont', 'false',
		'id', bannerName,
		'bgcolor', '#b21d0a',
		'name', bannerName,
		'menu', 'true',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', 'http://www.shoutmktg.com/_flash/'+bannerName,
		'salign', ''
		); //end AC code

}


function insertVideo(videoName)
{
	// strip '/' from beginning of videoName (if it exists)
	videoName.replace(/^\//, '');

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


function insertPortfolioVideo(videoName)
{
	// strip '/' from beginning of videoName (if it exists)
	videoName.replace(/^\//, '');

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

}

function getVideo(videoName)
{
	// strip '/' from beginning of videoName (if it exists)
	videoName.replace(/^\//, '');

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

function showBio(bioName)
{
	html = AC_FL_GetContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '520',
			'height', '355',
			'src', 'http://www.shoutmktg.com/_flash/bio-'+bioName,
			'quality', 'best',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', 'bio-'+bioName,
			'bgcolor', '#ffffff',
			'name', 'bio-'+bioName,
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', 'http://www.shoutmktg.com/_flash/bio-'+bioName,
			'salign', ''
		);
		
	var browser = navigator.appName;
	var browserVersion = parseFloat(navigator.appVersion);
	
	document.getElementById('flashProfileContainer').innerHTML = html;
	document.getElementById('flashProfileContainer').style.zIndex = 8;
	
	if (getBrowserId() == 'msie' && getBrowserMajorVersion() < 7) {
		document.getElementById('flashProfileContainer').style.top = '-200px';
		document.getElementById('flashProfileContainer').style.left = '-300px';
	} else {
		document.getElementById('flashProfileContainer').style.top = '0px';
		document.getElementById('flashProfileContainer').style.left = '25px';
	}
}

function hideBio()
{
	document.getElementById('flashProfileContainer').style.zIndex = '-3';
	document.getElementById('flashProfileContainer').style.top = '-1000px';
	insertFlash('group_pic3', 350, 280, true);
}


// media popup

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

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

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

