
// ************ function Integration LSE **************** //


function SwitchPagingLinks(obj){
	var el = document.getElementById("menu"+obj);
	if(el.style.display == "none"){ 
		for (i=1; i<=4; i=i+1){
			document.getElementById("menu"+i).style.display="none";
		}
		el.style.display="block";
	}
}

function sendto(page)
{
	if (window.opener != null)
	{
		var win = this;
		window.opener.location.href = page;
		window.opener.parent.focus();
	}
	else
	{
		window.location.href = page;
	}
}

function openWin2(sURL, sWinName, iWidth, iHeight, sFeatures) {
	var iPopupLeft, iPopupTop;
	iPopupLeft = 10 //(screen.width - iWidth)/2;
	iPopupTop = 10 //(screen.height - iHeight)/2;
	sFeatures = sFeatures + 'screenX='+iPopupLeft+',screenY='+iPopupTop+',left='+iPopupLeft+',top='+iPopupTop+',height='+iHeight+',width='+iWidth;
	var oWindow = window.open(sURL, sWinName, sFeatures, true);
	// make sure that each instance of a portal parent window has a unique name
	window.name="portalparentwindow" + Math.random();
	oWindow.focus();
	return true;
}

function openWinBig(sURL) {
	if(sURL!=""){
		var oWindow = window.open(sURL);
		oWindow.focus();
		
	}else{
		return false;
	}
	return true;
}

// functions for Search Instruments //

var OpenerFormIdentifier;
var OpenerHiddenIdentifier;

function searchInstrument(formIdentifier,hiddenIdentifier, pageName, queryString)
{
	openString = pageName + "?FI=" + formIdentifier + "&HI=" + hiddenIdentifier + queryString;
	var win = window.open(openString, "SInstrument","width=365,height=580,status=yes,resizable=yes,menubar=no,scrollbars=yes");
	OpenerFormIdentifier = formIdentifier;
	OpenerHiddenIdentifier = hiddenIdentifier;
		
	win.focus();
}

function Update(assetName, symbol) {		
	var namebox = document.getElementById(OpenerFormIdentifier);
	var hidsymbol = document.getElementById(OpenerHiddenIdentifier);
				
	if (namebox != null && hidsymbol != null)
	{
		namebox.value = assetName;
		hidsymbol.value = symbol;
		return true;
	}			
	return false
	
}

function UpdateOpener(assetName, symbol) {
	var update = true;
	
	if (window.opener.CheckForDuplicates != null)
	{
		update = !window.opener.CheckForDuplicates(symbol)
	}
			
	if (update)
	{
		
		if (window.opener.Update != null)
		{
			if (window.opener.Update(assetName,symbol)) self.close();
		}
	}
	else
	{
		alert('Asset has already been selected');
	}
}

// end functions for Search Instruments //






// ************ function Actual LSE **************** //

<!--

// Code for User Survey
function hideObject() {
	if (document.layers) {
	window.location.reload();
}
	else if (document.all) {
		window.location.reload();
	}
	else if (document.getElementById && !document.all) {
		window.location.reload();
	}
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		if (oldonload) {
			oldonload();
		}
		func();
		}
	}
}

var da = (document.all) ? 1 : 0;

var pr = (window.print) ? 1 : 0;

var mac = (navigator.userAgent.indexOf("Mac") != -1); 

// Prints a document in a new window and appends &print=true to the querystring
function printThisNewWin()
{
	// create reference to current location
	var url = document.location.href;
	var delim = "?";
	
	if (url.indexOf("?") > 0)
		delim = "&";
	
	url += delim + "print=true";
	
	popupscroll(url, 780, 500);
	
}
function isAutoPrint()
{
	var url = document.location.href;
	if (url.indexOf("print=true") > 0)
		return true;
	else
		return false;
}
function autoPrint()
{
	//determine if "print=true" exists in the QueryString
	if (isAutoPrint())
		printThis();
}
function printThis() 
{
	

	if (pr) 
	{ 	// NS4, IE5
		
		window.print();
	
	} 
	else if (da && !mac) 
	{ 	// IE4 (Windows)
		
		vbPrintPage();
	
	} 
	else 
	{ 	// other browsers
		
		alert("Sorry, your browser doesn't support this feature.\n\n Please try using the Print button on the browser toolbar.");
	
	}


}


if (da && !pr && !mac) with (document) 
{
	
	writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
	
	writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
	
	writeln('Sub window_onunload');
	writeln('  On Error Resume Next');
	
	writeln('  Set WB = nothing');
	writeln('End Sub');
	
	writeln('Sub vbPrintPage');
	writeln('  OLECMDID_PRINT = 6');
	
	writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
	
	writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
	
	writeln('  On Error Resume Next');
	
	writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
	
	writeln('End Sub');
	
	writeln('<' + '/SCRIPT>');

}


function bookmarkThis() 
{
	

	if (window.external) 
	{
		
		window.external.AddFavorite(location.href,document.title)
	
	} 
	else 
	{
	
		alert("Sorry, your browser doesn't support this feature.")
	}
	}


function imgOver(image) 
{
	
	if(document.images && image.src.indexOf("-over.gif")==-1) 
	{
   		
		image.src = image.src.substring(0,(image.src.indexOf(".gif"))) + "-over.gif";
    
	}

}


function imgOut(image) 
{
	
	if(document.images && image.src.indexOf("-over.gif")!=-1) 
	{
    	
		image.src = image.src.substring(0,(image.src.indexOf("-over.gif"))) + ".gif";
    
	}

}


function checkKeyPress(imageButton)

{	
	
	if (event.keyCode==13)
	
	{
		
		var theform;
		
		event.keyCode = 0;
		
		event.returnValue = false;
		
		event.cancelBubble = true;
		
		theform = document.forms[0];
		

		if (theform.__EVENTTARGET) 
		{
			
			theform.__EVENTTARGET.value = imageButton.split("$").join(":");
		
		}
		

		if (document.getElementById)
			
			document.getElementById(imageButton).click();
		
		else if (document.all)
			
			document.all[imageButton].click();				
	
	}

}



function js_forcessl()

{
	
	var strRootURL = location.href;
	
	var itMatches;
	
	itMatches = strRootURL.match(/^https/);


	if(itMatches!="https")
	
	{
		
		strRootURL = strRootURL.replace(/^http/,"https");
		
		location.replace(strRootURL);
		
		//window.navigate(strRootURL);
	
	}
	

}



function js_forcenonssl()

{
	
	var strRootURL = location.href;
	
	var itMatches;
	
	itMatches = strRootURL.match(/^https/);
	
	if(itMatches!="https")
	{
	}
	
	else
	
	{
		
		strRootURL = strRootURL.replace(/^https/,"http");
		
		location.replace(strRootURL);
		
		//window.navigate(strRootURL);
	
	}
	

}



function popup(strPath, iWidth, iHeight) 
{
	
	strWindow = window.open(strPath, 'popup', 'width=' + iWidth + ',height=' + iHeight)

}

function popupscroll(strPath, iWidth, iHeight) 
{
	
	strWindow = window.open(strPath, 'popup', 'scrollbars,resizable,width=' + iWidth + ',height=' + iHeight)
}


function popupscrollpositioned(strPath, iWidth, iHeight, iLeft, iTop)
{
	strWindow = window.open(strPath, 'popup', 'scrollbars,resizable,width=' + iWidth + ',height=' + iHeight + ',screenX=' + iLeft + ',screenY=' + iTop + ',left=' + iLeft + ',top=' + iTop)
	
}

// Keeps track of current control calling the event handler below. Allows us to access the same 
// control when it comes time to paste the resource into the placeholder
var currentEditor;

//applies event handlers for custom telerik buttons
function loadCustomEvents(clientID) 
{
	
	if (window.RadEditorCommandList)
	{
		//searches for a resource using the Resource Locator
		RadEditorCommandList['SearchResource'] = function(commandName, editor, oTool)
		{

		currentEditor = editor;
		
			//link to the resource locator
			var iHeight = 700;
			var iWidth = 900;
			var iLeft = ((screen.width - iWidth) / 2);
			var iTop = ((screen.height - iHeight) / 2);
			popupscrollpositioned('/LSECWS/Console/Applications/ResourceLocator.aspx?launchmode=telerik', iWidth, iHeight, iLeft, iTop);
			
			return false;

		}
	}
}

function pasteResource(clientID, itemPath, displayName, type)
{
    var editor = currentEditor;

    if (type == "image")
    {
    	editor.PasteHtml('<img src="'+itemPath+'" alt="'+displayName+'"></a>');
    }
    else
    {
    	editor.PasteHtml('<a href="'+itemPath+'">'+displayName+'</a>');
    }

}

//-->
