var _flashids = 0;

function SquirtFlashUploader(moviepath, width, height, flashVars)
{
	var onmouseover = "";
	var onmouseout = "";

	document.write("<object onmouseout=\"" + onmouseout + "\" onmouseover=\"" + onmouseover + "\" id=\"fileUploader\" align=\"middle\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"" + width + "\" height=\"" + height + "\"> \n");
	document.write("	<param name=\"allowScriptAccess\" value=\"sameDomain\" /> \n");
	document.write("	<param name=\"movie\" value=\"" + moviepath + "\" /> \n");
	document.write("	<param name=\"quality\" value=\"high\"> \n");
	document.write("	<param name=\"wmode\" value=\"transparent\"> \n");
	document.write("	<PARAM NAME=\"FlashVars\" VALUE=\"" + flashVars + "\"> \n");
	document.write("	<embed src=\"" + moviepath + "\" onmouseout=\"" + onmouseout + "\" onmouseover=\"" + onmouseover + "\" \n");
	document.write("		FlashVars=\"" + flashVars + "\" \n");
	document.write("		quality=\"high\" wmode=\"transparent\" width=\"" + width + "\" height=\"" + height + "\" \n");
	document.write("		name=\"fileUploader\" align=\"middle\" allowScriptAccess=\"sameDomain\" \n");
	document.write("		type=\"application/x-shockwave-flash\" \n");
	document.write("		pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /> \n");
	document.write("	</embed> \n");
	document.write("</object> \n");
}

function SquirtFlash(moviepath, width, height, id, onmouseover, onmouseout)
{
	var objectId = "";
	if(moviepath.indexOf("http://") == -1) moviepath = _sBasePath + "/res/flash/" + moviepath;
	if(id == null || "" == id)
	{
		_flashids ++;
		objectId = "FlashObject_" + _flashids;
	}
	else
	{
		objectId = id;
	}

	if(onmouseover == null) var onmouseover = "";
	if(onmouseout == null) var onmouseout = "";

	document.write("<object onmouseout=\"" + onmouseout + "\" onmouseover=\"" + onmouseover + "\" id=\"" + objectId + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + width + "\" height=\"" + height + "\"> \n");
	document.write("	<param name=\"movie\" value=\"" + moviepath + "\"> \n");
	document.write("	<param name=\"quality\" value=\"high\"> \n");
	document.write("	<embed onmouseout=\"" + onmouseout + "\" onmouseover=\"" + onmouseover + "\" src=\"" + moviepath + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed> \n");
	document.write("</object> \n");
}
function Element_GetYPos(obj)
{
	var curtop = 0;
	if (document.getElementById || document.all)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (document.layers)
		curtop += obj.y;
	return curtop;
}
function Element_GetXPos(obj)
{
	var curleft = 0;
	if (document.getElementById || document.all)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (document.layers)
		curleft += obj.x;
	return curleft;
}
function showdiv(message) 
{ 
	var objTooltip = document.getElementById("StaticTooltipDiv");
	
	objTooltip.innerHTML = message;
	objTooltip.style.visibility = 'visible'; 
	if (document.getElementById) 
	{ // DOM3 = IE5, NS6 
		
		
	} 
	else 
	{ 
		if (document.layers) 
		{ // Netscape 4 	
			document.hideshow.visibility = 'visible'; 
		} 
		else 
		{ // IE 4 
			document.all.hideshow.style.visibility = 'visible'; 
		} 
	} 
}
function hidediv() 
{
	if (document.getElementById)
	{ // DOM3 = IE5, NS6 
		document.getElementById("StaticTooltipDiv").style.visibility = 'hidden';
	}
	else
	{
		if (document.layers) 
		{ // Netscape 4 
			document.hideshow.visibility = 'hidden'; 
		} 
		else 
		{ // IE 4 
			document.all.hideshow.style.visibility = 'hidden'; 
		} 
	} 
} 

function getStyle(oElm, strCssRule){
	var strValue = "";
	if(document.defaultView && document.defaultView.getComputedStyle){
		strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
	}
	else if(oElm.currentStyle){
		strCssRule = strCssRule.replace(/-(w)/g, function (strMatch, p1){
			return p1.toUpperCase();
		});
		strValue = oElm.currentStyle[strCssRule];
	}
	return strValue;
}

/*
Checks if the string is null, empty or only
has whitespace, anything found that is not
whitespace will return false;
*/
function isNullEmptyOrWhitespace(strString)
{
	if(strString == null || strString == "")
	{
		return true;
	}
	
	var objMatchTest = strString.match(/^\s+$/im);
	
	if(objMatchTest != null)
	{
		return true;
	}
	
	return false;
	if(strString == null)
	{
		return true;
	}
	
	var regex = new RegExp(/\S+/gi);
	
	return !regex.test(strString.replace(/\s+/g, ""))
}
function findPos(obj) 
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
function ShowHelp(qs)
{
	top.Dialog_Window.Show('Help', _sBasePath + '/vitals/help.aspx?' + qs, 850, 600, 1, '', '', 0, true)
}


function setListeners()
{
	inputList = document.getElementsByTagName("INPUT");
	for(i=0;i<inputList.length;i++)
	{
		if(window.attachEvent)
			inputList[i].attachEvent("onpropertychange",restoreStyles);

		inputList[i].style.backgroundColor = "";
	}
	
	selectList = document.getElementsByTagName("SELECT");
	
	for(i=0;i<selectList.length;i++)
	{
		if(window.attachEvent)
			selectList[i].attachEvent("onpropertychange",restoreStyles);
			
		selectList[i].style.backgroundColor = "";
	}
}

function restoreStyles()
{
	if(event.srcElement.style.backgroundColor == "#ffffa0")
		event.srcElement.style.backgroundColor = "";
}

// Stop the pesky Google Yellow Highlighting.
if(window.attachEvent)
{
	window.attachEvent("onload",setListeners);
}
else
{
	window.onload = setListeners;
}

function copyToClipboard(s)
{
	if( window.clipboardData && clipboardData.setData )
	{
		clipboardData.setData("Text", s);
	}
	else
		alert("Not Supported in your browser");
}
