/* Browser check */
IS_DOM = (document.getElementById) ? true : false;
IS_IE = (document.all) ? true : false;
IS_IE50 = (navigator.userAgent.indexOf("IE 5.0") != -1);
IS_Mac = (navigator.appVersion.indexOf("Mac") != -1);

// preload level 1 buttons
var btnLevel1 = new Array();
btnLevel1 = ["","Services","Results","Clients","About","Contact","Blog"];
for (i=0;i<btnLevel1.length;i++) { 
	eval("menu"+i+"on = new Image();"); eval("menu"+i+"off = new Image();");
	eval("menu"+(i)+"on.src = \"" + sFolderLevel + "images/navigation/mnu"+btnLevel1[i]+"OVER.gif\";");
	eval("menu"+(i)+"off.src = \"" + sFolderLevel + "images/navigation/mnu"+btnLevel1[i]+".gif\";");
	if (sSelectedButton == btnLevel1[i]) {
		eval("menu"+(i)+"off.src = \"" + sFolderLevel + "images/navigation/mnu"+btnLevel1[i]+"OVER.gif\";");
	}
}

// General Site Functions

function imgOn(imgName) {
  if (IS_DOM) {
    document.getElementById(imgName).src = eval(imgName + "on.src");
  }
}
 
function imgOff(imgName) {
  if (IS_DOM) {
    document.getElementById(imgName).src = eval(imgName + "off.src");
  }
}

// image swapper
function changeImages() 
{
  if (document.getElementById) {
    for (var i = 0; i < changeImages.arguments.length; i += 2) { 
  		document.getElementById(changeImages.arguments[i]).src = eval(changeImages.arguments[i + 1] + ".src"); 
	}
  }
}

// image-swapping function for input image type
function changeInputImage(imageName,newImageSource) {
		if (document.getElementById) {
			document.getElementById(imageName).src = newImageSource;
		}
	}

// Get an ID 
function getThis(sId)
{
	var oObject;
	oObject = false;
	
	if (IS_DOM) {
		if (document.getElementById(sId)) {
			oObject = document.getElementById(sId);
		}
	}
	
	return oObject;
}

// This function is used when you want to have browsers that do not 
//have flash player installed write an image file instead

function writeFlashOrImage(FlashName,ImageName,Width,Height,Alt,FlashVersion) {
	// first, write the opening object tag

	strObjectTag = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	strObjectTag = strObjectTag + ' width="' + Width + '" height="' + Height + '" ';
	strObjectTag = strObjectTag + 'codebase="http://active.macromedia.com/flash5/cabs/swflash.cab#version=';
	strObjectTag = strObjectTag + FlashVersion + '">';
	strMovieParam = '<param name="movie" value="' + FlashName + '">';
	document.write(strObjectTag);
	document.write(strMovieParam);
	document.write('<param name=\"play\" value=\"true\">');
	document.write('<param name=\"loop\" value=\"true\">');
	document.write('<param name=\"quality\" value=\"high\">');
	document.write('<param name=\"wmode\" value=\"transparent\">');

	// if the Flash Plug-in is installed and a browser than user plug-ins is the browser, write an embed tag
	plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
		strImageTag = '<image src="' + ImageName + '" width="' + Width + '" height="' + Height + '" ';
		strImageTag = strImageTag + ' border="0" alt="' + Alt + '">';
	if ( plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 4 )
		{
		strEmbedTag = '<embed src="' + FlashName + '" width="' + Width + '" height="' + Height + '" ';
		strEmbedTag = strEmbedTag + 'play="true" loop="true" quality="high" ';
		strEmbedTag = strEmbedTag + 'wmode="transparent"';
		strEmbedTag = strEmbedTag + 'pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
		document.write(strEmbedTag);
		document.write('</embed>');
		}
	// otherwise, then write an image tag.
	else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
		document.write(strImageTag);
		}
	
	//finally, write the closing object tag
	document.write('</object>');
}
	
// accessible popup functions, this will work with or without javascript enabled
// reference like this "<a href="popup.htm" onclick="popUp(this.href,'console',400,200);return false;" target="newWin" title="This link will pop open a new window">This is my link</a>"
	function popUp(strURL,strType,strHeight,strWidth,strWindow)
	{
	  var strOptions="";
	  if (strType=="console") {
	    strOptions="resizable,height=" + strHeight + ",width=" + strWidth;
	  }
	  if (strType=="fixed") {
	    strOptions="status,height=" + strHeight + ",width=" + strWidth;
	  }
	  if (strType=="elastic") {
	    strOptions="toolbar,menubar,scrollbars,resizable,location,height=" + strHeight + ",width=" + strWidth;
	  }
	  window.open(strURL, strWindow, strOptions);
	}

	// proper way to close a popup window, to be referenced in the popup window
	// if (window.opener) document.write('<strong><a href="#" onclick="self.close();">Close this window</a></strong>');


/*
	tableruler()
	written by Chris Heilmann for alistapart.
	enables a rollover of rows for each table with the classname "hlrows"
*/

function tableruler()
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++)
		{
			if(tables[i].className=='ruler')
			{
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++)
				{
					if(trs[j].parentNode.nodeName=='TBODY')
					{
						trs[j].onmouseover=function(){this.className='ruled';return false}
						trs[j].onmouseout=function(){this.className='';return false}
					}
				}
			}
		}
	}
}


