function Replace(prmSearchIn,prmFind,prmReplaceWith)
{
	var strReplaced="";
	//navigator.appName.length(
	for(var intLen=0;intLen<=prmSearchIn.length;intLen++)
	{
		if(prmSearchIn.substr(intLen,prmFind.length)==prmFind)
		{
			strReplaced=strReplaced+prmReplaceWith;
			intLen=intLen+prmFind.length-1
		}
		else
		{
			strReplaced=strReplaced+prmSearchIn.substr(intLen,1);			
		}
		
	}
	return strReplaced;
}			

function SyncHeaderWidth(prmHeaderTR,prmDataTable)
{
	for(var intCountCells=0;intCountCells<prmHeaderTR.cells.length;intCountCells++)
		prmHeaderTR.cells(intCountCells).style.width=prmDataTable.rows(0).cells(intCountCells).offsetWidth;

}

function SyncHeaderWidth2(prmHeaderTR,prmDataTable,prmAddToHeader)
{
	for(var intCountCells=0;intCountCells<prmHeaderTR.cells.length;intCountCells++)
	{
		if(prmDataTable.rows(0).cells(intCountCells).offsetWidth+prmAddToHeader>0)
		{
			prmHeaderTR.cells(intCountCells).style.width=prmDataTable.rows(0).cells(intCountCells).offsetWidth+prmAddToHeader;
		}
		else
		{
			prmHeaderTR.cells(intCountCells).style.width=prmDataTable.rows(0).cells(intCountCells).offsetWidth;
		}
	}

}
function ChangeClass(prmObject,prmNewClass)
{
	prmObject.className=prmNewClass;
}
var arrImagePreload = new Array();
function PreLoadImages() {
  if (!document.images) return;
  
  var arguments = PreLoadImages.arguments;
  for (var i = 0; i < arguments.length; i++) {
    arrImagePreload[i] = new Image();
    arrImagePreload.src = arguments[i];
  }
}
function CreatePopUpMenu(prmWidth,prmHeight)
{
	var objPopupMenuToCreate = new Menu(prmWidth,prmHeight);

	objPopupMenuToCreate.Color = "black";
	objPopupMenuToCreate.BgColor = "white";
	objPopupMenuToCreate.HighlightedColor = "white";
	objPopupMenuToCreate.HighlightedBgColor = "#316AC5";
	objPopupMenuToCreate.BorderStyle = "outset 1px";			
	objPopupMenuToCreate.FontFamily = "Arial, Helvetica, sans-serif";
	objPopupMenuToCreate.FontWeight = "bold";
	objPopupMenuToCreate.FontSize = "12px";
	objPopupMenuToCreate.DimmedColor = "gray";
	objPopupMenuToCreate.ItemPadding = "10px";

	return objPopupMenuToCreate

}

function OpenWindow(prmURL,prmHeight,prmWidth)
{
	var intLeftPosition = (screen.width) ? (screen.width-prmWidth)/2 : 0;
	var intTopPosition = (screen.height) ? (screen.height-prmHeight)/2 : 0;

	window.open(prmURL,'winWindow',"height=" + prmHeight + ",width=" + prmWidth + ",status=yes,toolbar=no,menubar=no,location=no,left=" + intLeftPosition + ",top=" + intTopPosition + ",resizable=no");
}

function OpenFullScreenWindow(prmURL)
{
	var intHeight=screen.availHeight-98;
	var intWidth=screen.availWidth-12;
	
	window.open(prmURL,'winWindow',"height=" + intHeight + ",width=" + intWidth + ",status=yes,toolbar=no,menubar=no,location=no,left=0,top=0,resizable=yes");
}
function OpenModalWindow(prmURL,prmTitle,prmHeight,prmWidth)
{
	prmURL=Replace(prmURL,"?","&");
    window.showModalDialog('/BluecomSupport/Screens/Shared/winDialog.aspx?Title=' + prmTitle + '&Page=' + prmURL,window,"dialogHeight:" + prmHeight + "px;dialogWidth:" + prmWidth + "px;status:yes;center:yes;help:no;scroll:no;");			
    //window.open('/BluecomSupport/Screens/Shared/winDialog.aspx?Title=' + prmTitle + '&Page=' + prmURL);			
}

function PutWaitScreen(prmTop,prmLeft,prmRunCommand)
{
	document.all.divWait.innerHTML="<div class='divWaitScreen'></div>" +
						"<iframe id=ifrWait frameborder=no src='/BluecomSupport/Screens/Shared/PleaseWaitForm.aspx' Style='Z-INDEX: 9999; LEFT: " + prmLeft + "px; WIDTH: 300px; POSITION: absolute; TOP: " + prmTop + "px; HEIGHT: 100px'></iframe>";
	setTimeout(prmRunCommand,2000);
	document.onkeydown=DisableKeyDownEvent;

}

function DisableKeyDownEvent()
{
	event.returnValue=false;
}

function PutWaitScreenNoMsg(prmRunCommand)
{
	document.all.divWait.innerHTML="<div class='divWaitScreen'></div>";
	setTimeout(prmRunCommand,100);
	document.onkeydown=DisableKeyDownEvent;

}

function PutReadOnlyScreen()
{
	document.all.divWait.innerHTML="<div class='divReadonly'></div>";
	document.onkeydown=DisableKeyDownEvent;

}

