//<script language="javascript">  //This tag is to fake Interdev into recognizing this file as a javascript file 
// Copyright 1994-2005 Onyx Software Corporation. All rights reserved.
var gbTimerEnabled = 0; // 1=ON 0=OFF
var gbUseNewProfileCode = 1; // 1=ON 0=OFF
var gsTimerLogFile = "c:\\OEPUITimers.txt";
var goOEPTimer;		// holds a reference to the XTimer object in main_frame

function jsPerfTimerStart(sTimerName,plLevel) {
	//jsTimerStart(sTimerName,plLevel);
}

function jsPerfTimerStop(sTimerName) {
	//jsTimerStop(sTimerName);
}

function jsPrefTimerLogMarkInsert(psLogMark,plLevel) {
	//jsTimerLogMarkInsert(psLogMark,plLevel);
}

function jsTimerStart(sTimerName,plLevel){
	if (gbTimerEnabled){
		if (gbUseNewProfileCode){
			if (jsReturnXTimerReference()){goOEPTimer.actionStart(sTimerName,plLevel)}
		}else{		
			var oFSO = new ActiveXObject("Scripting.FileSystemObject");
			var oFile = oFSO.OpenTextFile(gsTimerLogFile,8,1);
			var oTime = new Date();
			var lCurrentTime = oTime.getTime();
			var sLine = sTimerName + '\t' + "begin\t" + lCurrentTime;
			oFile.WriteLine(sLine);
			oFile.Close();
			delete oFSO;
		}
	}
}
function jsTimerStop(sTimerName){
	if (gbTimerEnabled){
		if (gbUseNewProfileCode){
			if (jsReturnXTimerReference()){goOEPTimer.actionFinish(sTimerName)}
		}else{		
			var oTime = new Date();
			var lCurrentTime = oTime.getTime();
			var sLine = sTimerName + '\t' + "end\t" + lCurrentTime;
			var oFSO = new ActiveXObject("Scripting.FileSystemObject");
			var oFile = oFSO.OpenTextFile(gsTimerLogFile,8,1);
			oFile.WriteLine(sLine);
			oFile.Close();
			delete oFSO;
		}
	}
}
function jsTimerSampleStart(psTargetAction, psSubActions, piLevel){
	if (gbTimerEnabled){
		if (gbUseNewProfileCode){
			if (jsReturnXTimerReference()) {
				goOEPTimer.actionSampleStart(psTargetAction, psSubActions, piLevel);
			}
		}else{		
			// not supported
		}
	}
}


// prevent code errors on legacy function
function jsTimerSample(psSample) {
	//alert("unsupported sample, action=" + psSample);
}

function jsTimerSectionStart(psSectionName,psType,plLevel){
	if (gbTimerEnabled){
		jsReturnXTimerReference()
		goOEPTimer.sectionStart(psSectionName,psType,plLevel)
	}
}
function jsTimerSectionFinish(psSectionName,plLevel){
	if (gbTimerEnabled){
		jsReturnXTimerReference()
		goOEPTimer.sectionFinish(psSectionName,plLevel)
	}
}
function jsTimerLogMarkInsert(psLogMark,plLevel){
	if (gbTimerEnabled){
		jsReturnXTimerReference()
		goOEPTimer.logMarkInsert(psLogMark,plLevel)
	}
}

function jsTimerPauseAll(){
	if (gbTimerEnabled){
		jsReturnXTimerReference()
		goOEPTimer.pauseAll()
	}
}
function jsTimerUnPauseAll(){
	if (gbTimerEnabled){
		jsReturnXTimerReference()
		goOEPTimer.unPauseAll()
	}
}

function jsReturnXTimerReference(){
	var oMainFrameRef = null; 

	if (!goOEPTimer){
		oMainFrameRef = jsGetMainFrameRef();
		if (oMainFrameRef){
			goOEPTimer = oMainFrameRef.jsReturnOEPPref();
			return true;
		}else{
			return false;
		}
	}else{
		return true;
	}

}
