function isDate(DateToCheck)
	{
	if(DateToCheck=="")
		return false;

	var m_arrDate = m_strDate.split("-");
	var m_YEAR = m_arrDate[0];
	var m_MONTH = m_arrDate[1];
	var m_DAY = m_arrDate[2];


	if(m_YEAR.length > 4 || m_YEAR.length < 4 || m_MONTH < 0 || m_MONTH > 12 || m_DAY < 1 || m_DAY > 31 )
		return false;
	else
		return true;
	}


function GetHeight()
{
	var oHeight;
	if(window.innerHeight!=null)
	{
		oHeight=window.innerHeight;
	}
	else
	{
		oHeight=document.body.offsetHeight;
	}
	return oHeight;
}
function GetWidth()
{
	var oWidth;
	if(window.innerWidth!=null)
	{
		oWidth=window.innerWidth;
	}
	else
	{
		oWidth=document.body.offsetWidth;
	}
	return oWidth;
}
function removeElementById(divNum)
	{
	var olddiv = document.getElementById(divNum);
	olddiv.parentNode.removeChild(olddiv);
	}
function GetFrameHeight()
{
	if(window.innerHeight!=null)
	{
		oHeight=window.innerHeight;
	}
	else
	{
		oHeight=document.body.offsetHeight;
	}
	return oHeight;
}

function setPrefix(prefix)
{
	window['prefix'] = prefix;
}


function BrowseForAsset(args)
{
	if(!args.prefix) args.prefix = window['prefix'];
	if(!args.startNode) args.startNode = 0;
	if(!args.returnInput) args.returnInput = null;
	if(!args.returnFunction) args.returnFunction = null;
	if(!args.onSelectionChange) args.onSelectionChange = null;
	if(!args.windowWidth) args.windowWidth = 510;
	if(!args.windowHeight) args.windowHeight = 240;
	if(!args.viewMode) args.viewMode = 'list';
	if(!args.showTree) args.showTree = 'false';
	
	
	var wnd = window.open(args.prefix+'v3/generic/assetbrowser.cfm?nodeid='+args.startNode+'&mode='+args.viewMode+'&showTree='+args.showTree,'','width='+args.windowWidth+', height='+args.windowHeight+', location=no, resizable=yes, status=no, toolbar=no, directories=no,menubar=no');
	wnd.focus();
	wnd.g_returnInput = args.returnInput;
	wnd.g_returnFunction = args.returnFunction;
	wnd.g_OnSelectionChange = args.onSelectionChange;
	
	return wnd;
}

function BrowseForNode(args)
{
	if(!args.prefix) args.prefix = window['prefix'];
	if(!args.startNode) args.startNode = 0;
	if(!args.returnInput) args.returnInput = null;
	if(!args.returnFunction) args.returnFunction = null;
	if(!args.onSelectionChange) args.onSelectionChange = null;
	if(!args.windowWidth) args.windowWidth = 200;
	if(!args.windowHeight) args.windowHeight = 500;
	if(!args.type) args.type = 'node';
	
	var wnd = null;
	if(args.targetWindow == null)
		wnd = window.open(args.prefix+'v3/generic/nodebrowser.cfm?nodeid='+args.startNode+'&type='+args.type,'','width='+args.windowWidth+', height='+args.windowHeight+', location=no, resizable=yes, status=no, toolbar=no, directories=no,menubar=no,scrollbars=yes');
	else
	{
		wnd = args.targetWindow;
		args.targetWindow.location=args.prefix+'v3/generic/nodebrowser.cfm?nodeid='+args.startNode+'&type='+args.type;
	}
	wnd.focus();
	wnd.g_returnInput = args.returnInput;
	wnd.g_returnFunction = args.returnFunction;
	wnd.g_OnSelectionChange = args.onSelectionChange;
	
	return wnd;
}

function BrowseForFile(args)
{
	if(!args.prefix) args.prefix = window['prefix'];
	if(!args.startNode) args.startNode = 0;
	if(!args.returnInput) args.returnInput = null;
	if(!args.returnFunction) args.returnFunction = null;
	if(!args.onSelectionChange) args.onSelectionChange = null;
	if(!args.windowWidth) args.windowWidth = 200;
	if(!args.windowHeight) args.windowHeight = 500;
	if(!args.type) args.type = 'node';
	
	var wnd = window.open(args.prefix+'v3/generic/filebrowser.cfm?nodeid='+args.startNode+'&type='+args.type,'','width='+args.windowWidth+', height='+args.windowHeight+', location=no, resizable=yes, status=no, toolbar=no, directories=no,menubar=no,scrollbars=yes');
	wnd.focus();
	wnd.g_returnInput = args.returnInput;
	wnd.g_returnFunction = args.returnFunction;
	wnd.g_OnSelectionChange = args.onSelectionChange;
	
	return wnd;
}

function SetTrans(Obj)
{
	if (!Obj || 1==1)
		return;
	Obj.style.opacity=0.9;
	Obj.style.filter="alpha(opacity=90)";
}

function ShowPopup(oMenuName,url,title,width,height,onclose,pxTop,pxLeft)
{
	oBg=document.getElementById('popupwindowbg');
	titlebarframe=document.getElementById(oMenuName+"menuframe");
	closelink=document.getElementById(oMenuName+"closelink");
	if(oBg)
	{
		oBg.style.visibility='visible';
	}
	oDiv=document.getElementById(oMenuName);
	if(pxTop==null)
		pxTop=30;
	if(pxLeft==null)
		pxLeft=(800-width)/2;

	oDiv.style.top=pxTop+document.body.scrollTop;
	oDiv.style.left=pxLeft;
//	oDiv.style.visibility='visible';
	if(oDiv.style.display=="none"){
		oDiv.style.display="inline";
	}
	else
	{
		oDiv.style.visibility='visible';
	}

	SetTrans(oBg);
	SetTrans(oDiv);

	
	pFrame=document.getElementById(oMenuName+"frame");
	
	if(pFrame&&url!=null)
	{
		pFrame.src=url;
	}
	if(title!=null)
	{
		pTitle=document.getElementById(oMenuName+'title');
		pTitle.innerHTML=title;
	}
	if(width!=null&&height!=null)
	{
		pFrame.height=height;
		pFrame.width=width;
		pTable=document.getElementById(oMenuName+"table");
		if(pTable!=null)
		{
			pTable.width=width;
			
		}
		pTableBar=document.getElementById(oMenuName+"topbar");
		if(pTableBar!=null)
			pTableBar.width=width-10;
	}
	if(onclose!=null && closelink!=null)
	{
		closelink.href="javascript: "+onclose+";HideMenu('"+oMenuName+"'); HideMenu('popupwindowbg');";
	
	}
	if(titlebarframe)
	{
		titlebarframe.style.height = oDiv.offsetHeight - 1;
		titlebarframe.style.width = oDiv.offsetWidth - 1;
		titlebarframe.style.left = oDiv.offsetLeft;
		titlebarframe.style.top = oDiv.offsetTop;
		titlebarframe.style.display = "inline";
	}
}

function ResizePopup(oMenuName,width,height)
{
	oDiv=document.getElementById(oMenuName);
	pFrame=document.getElementById(oMenuName+"frame");
	pFrame.height=height;
	pFrame.width=width;
	
	iFrame=document.getElementById(oMenuName+"menuframe");
	if(iFrame)
	{
		iFrame.style.height=height;
		iFrame.style.width=width;
	}
	
	pTable=document.getElementById(oMenuName+"table");
	if(pTable!=null)
	{
		pTable.width=width;
		
	}
	pTableBar=document.getElementById(oMenuName+"topbar");
	if(pTableBar!=null)
		pTableBar.width=width-10;
}
function ShowMenu(obj,oMenuName,align,iLeftExtra,iTopExtra)
{
	if(iLeftExtra==null)
		iLeftExtra=18;
	if(iTopExtra==null)
		iTopExtra=18;
	oDiv=document.getElementById(oMenuName);
	
	if(oDiv.style.display=="none")
		oDiv.style.display="inline";
	else
		oDiv.style.visibility='visible';
	
	iLeft=0;
	iTop=0;
	while(obj!=null)
	{
		iLeft+=obj.offsetLeft;
		iTop+=obj.offsetTop;

		obj=obj.offsetParent;
		if(obj&& obj.style.position == 'absolute'&& navigator.userAgent.indexOf("MSIE") >= 0 || oDiv.offsetParent== obj)
			obj=null;
	
	}
	oWidth=oDiv.style.width.substring(0,oDiv.style.width.length-2);
	
	if(align == 'right')
		oDiv.style.left=iLeft-oWidth+iLeftExtra; 
	else
		oDiv.style.left=iLeft;
	
	oDiv.style.top=iTop+iTopExtra;
	StopTimeout(oMenuName);
}
function isMenuHidden(menuId)
{
	oDiv=document.getElementById(menuId);
	if(oDiv.style.visibility=='hidden'||oDiv.style.display=='none')
		return 1;
	else
		return 0;
}

function HideMenu(menuId)
{
	oDiv=document.getElementById(menuId);
	if(oDiv)
		oDiv.style.display='none';
	pFrame=document.getElementById(menuId+"frame");
	if(pFrame)
		pFrame.src='../../empty.html';
	
	var oMM = document.getElementById(menuId+"menuframe");
	if(oMM)
	 oMM.style.display = "none";
}


function StartTimeout(menuId)
{
	StopTimeout(menuId);
	var iTimer = window.setTimeout("HideMenu('"+menuId+"')",500);
	eval("iTimer"+menuId+"="+iTimer);
	 	

}
function StopTimeout(menuId)
{
	
	var iTimer=window["iTimer"+menuId];
	if(iTimer!=0)
	{
		window.clearTimeout(iTimer);
	}
}

function embed(strCode)
{
	document.write(strCode);
}

function popupZoom(assetid)
{
	window.open('../../v3/asset_manager/asset_zoom.cfm?assetid='+assetid+'&amp;template=view','AssetZoom','resizable=yes,scrollbars=no,status=no,top=50,left=50,width=800,height=600').focus();
}

var messageId = 0;

var status_color = 0;
var status_color_modifier = 1;

function setStatusMessage(message,timeout,rotatecolor,nobackground)
{
	
	status_color = 0;
	status_color_modifier = 4;
	if(timeout == undefined)
		timeout = 5000;
	if(nobackground == undefined)
		nobackground = false;
	
	var infoBox= null;
	var infoBox_Text = null;
	if(document.getElementById('StatusDiv') != null)
	{
		infoBox = document.getElementById('StatusDiv');
		infoBox_Text = document.getElementById('StatusDiv_Text');
	}
	else if(parent.header.document.getElementById('StatusDiv') != null)
	{	
		infoBox = parent.header.document.getElementById('StatusDiv');
		infoBox_Text = parent.header.document.getElementById('StatusDiv_Text');
	}
	else
	{
		return;
	}

	
	if(!infoBox)
	{
		infoBox = parent.header.document.createElement('div');
		infoBox.style.position='absolute';
		infoBox.style.top='0px';
		infoBox.style.backgroundColor='#7F7F7F';
		infoBox.style.padding='2px';
		infoBox.style.fontFamily='Verdana';
		infoBox.style.fontSize='11px';
		infoBox.style.color='#7F7F7F';
		infoBox.style.zIndex='100';
		infoBox.id='StatusDiv';
		//infoBox.class='content';
		parent.header.document.body.appendChild(infoBox);
	}
	if(!infoBox_Text)
	{
		infoBox_Text = parent.header.document.createElement('div');
		infoBox_Text.style.position='absolute';
		infoBox_Text.style.top='0px';
		infoBox_Text.style.padding='2px';
		infoBox_Text.style.fontFamily='Verdana';
		infoBox_Text.style.fontSize='11px';
		infoBox_Text.style.color='#000000';
		infoBox_Text.style.zIndex='101';
		infoBox_Text.id='StatusDiv_Text';
		//infoBox_Text.class='content';
		parent.header.document.body.appendChild(infoBox_Text);
	}
	infoBox.style.backgroundColor='#7F7F7F';
	infoBox_Text.style.color='#000000';
	
	infoBox_Text.style.opacity='';
	infoBox_Text.style.filter='';
	
	if(nobackground)
	{
		infoBox.style.filter='alpha(opacity=0)';
		infoBox.style.opacity='.0';
	}
	else
	{
		infoBox.style.filter='alpha(opacity=30)';
		infoBox.style.opacity='.3';
	}
	infoBox.style.display=infoBox_Text.style.display='';
	infoBox.innerHTML = infoBox_Text.innerHTML = message;
	infoBox.style.left=infoBox_Text.style.left=(997-infoBox.offsetWidth)+'px';
	messageId++;
	if(timeout != 0)
		window.setTimeout("statusMessageFadeout("+(messageId)+");",timeout);
	
	if(rotatecolor)
		window.setTimeout("statusUpdateTextColor();",10);
}

function statusRecursiveSetColor(obj,color)
{
	if(obj.style)
		obj.style.color = color;
	for(var i = 0; i < obj.childNodes.length; i++)
		statusRecursiveSetColor(obj.childNodes[i],color);
}

function statusUpdateTextColor()
{
	var infoBox= null;
	var infoBox_Text = null;
	if(document.getElementById('StatusDiv') != null)
	{
		infoBox = document.getElementById('StatusDiv');
		infoBox_Text = document.getElementById('StatusDiv_Text');
	}
	else if(parent.header.document.getElementById('StatusDiv') != null)
	{	
		infoBox = parent.header.document.getElementById('StatusDiv');
		infoBox_Text = parent.header.document.getElementById('StatusDiv_Text');
	}
	else
	{
		return;
	}
	
	if(infoBox.style.display != 'none')
	{
		status_color+=status_color_modifier;
		var rotated_color = (255-status_color);
		if(status_color > 254 || status_color < 1)
			status_color_modifier = -status_color_modifier;
		
		statusRecursiveSetColor(infoBox,'rgb('+rotated_color+','+rotated_color+','+rotated_color+')');
		statusRecursiveSetColor(infoBox_Text,'rgb('+status_color+','+status_color+','+status_color+')');
		infoBox.style.backgroundColor = 'rgb('+rotated_color+','+rotated_color+','+rotated_color+')';
		window.setTimeout("statusUpdateTextColor();",20);
	}
}

function statusMessageFadeout(msgID)
{
	var infoBox= null;
	var infoBox_Text = null;
	if(document.getElementById('StatusDiv') != null)
	{
		infoBox = document.getElementById('StatusDiv');
		infoBox_Text = document.getElementById('StatusDiv_Text');
	}
	else if(parent.header.document.getElementById('StatusDiv') != null)
	{	
		infoBox = parent.header.document.getElementById('StatusDiv');
		infoBox_Text = parent.header.document.getElementById('StatusDiv_Text');
	}
	else
	{
		return;
	}
 	
	if(messageId == msgID)
	{
		if(parseFloat(infoBox.style.opacity) <= 0)
			infoBox.style.display=infoBox_Text.style.display='none';
		else
		{
			var opacity = parseFloat(infoBox.style.opacity) - 0.05;
			infoBox.style.opacity = infoBox_Text.style.opacity = opacity;
			infoBox.style.filter = infoBox_Text.style.filter = 'alpha(opacity='+parseInt(opacity*100)+')';
			window.setTimeout("statusMessageFadeout("+msgID+")",10);
		}
	}
}

function fcEventManager(obj,name)
{
	this.eventHandlers={};
	this.eventArrays={};
	this.obj=obj;
	this.registerEvent = function (eventName,fn){
		var cArray=this.eventArrays[eventName];
		if(cArray==null)
		{
			this.eventArrays[eventName] = new Array();
			this.eventHandlers[eventName]= new Function ("a","b","c","d","e","var cArray=gEventManager.eventTypes."+name+".eventArrays['"+eventName+"'];for(var i=0;i < cArray.length;i++){cArray[i](a,b,c,d,e);}");
			cArray=this.eventArrays[eventName];
			//if(this.obj[eventName]!=null)
				//this.registerEvent(eventName,this.obj[eventName]);
			this.obj[eventName]=this.eventHandlers[eventName];
		}
		cArray[cArray.length]=fn;
	}
}

gEventManager = new function () {
	this.eventTypes={};
	this.registerObject = function (obj,name,events)
	{
		this.eventTypes[name]= new fcEventManager(obj,name,events);	
	}
	this.registerEvent = function (objName,eventName,fn)
	{
		if(this.eventTypes[objName]==null)
		{
			alert("Error. gEventManager.registerObject must be called on " + objName +" before being used on registerEvent.");
			return;
		}
		this.eventTypes[objName].registerEvent(eventName,fn);
	}
}

gEventManager.registerObject(window,"window");
gEventManager.registerObject(document,"document");
gEventManager.registerObject(document.body,"body");

window["gWindowLoaded"] = false;

var OldWinOnLoad_4788 = window.onload;

function window_loaded()
{
	window["gWindowLoaded"] = true;
	if (OldWinOnLoad_4788)
		OldWinOnLoad_4788();
}
gEventManager.registerEvent("window","onload",window_loaded);

