﻿// JScript File

function OpenWindowFullScreen(iNavigateURL)
{
	var newWindow = window.open(iNavigateURL,'','toolbar=no,status=yes,scrollbars=1,menubar=yes,location=no,resizable=1');
	newWindow.focus();
	newWindow.moveTo( 0, 0 );
	newWindow.resizeTo( screen.availWidth, screen.availHeight );
	//newWindow.resizeTo( screen.width, screen.height );
}

function GeneratePrintVersion(iTitle, iCSSPath, iIsPrintOnLoad, iPanelContent)
{
	var theContent = document.getElementById(iPanelContent).innerHTML;
	var theNewWindow = window.open('','','toolbar=yes,status=yes,scrollbars=1,menubar=yes,location=no,resizable=1');
	
	theNewWindow.document.open(); 
	theNewWindow.document.write('<html>');
	theNewWindow.document.write('<head>');
	
	//Set title
	if(iTitle!='')
	{
		theNewWindow.document.write('<title>'+iTitle+'</title>');
	}
	
	//Set CSS
	if(iCSSPath!='')
	{
		theNewWindow.document.write('<link href="'+iCSSPath+'" rel="Stylesheet" type="text/css" />');
	}
	
	theNewWindow.document.write('</head>');
	
	//Set print on load
	if(iIsPrintOnLoad==true)
	{
		theNewWindow.document.write('<body onLoad="self.print()"><center>');	
	}
	else
	{
		theNewWindow.document.write('<body>');
	}
		
	theNewWindow.document.write('<center>');
	theNewWindow.document.write(theContent);
	theNewWindow.document.write('</center>');
	theNewWindow.document.write('</body>');
	theNewWindow.document.write('</html>');

	theNewWindow.focus();
}

// work around for ajax control toolkit
function showModalPopupViaClient(behaviourID) {
    var modalPopupBehavior = $find(behaviourID);
    modalPopupBehavior.show();
}

function hideModalPopupViaClient(behaviourID) {        
    var modalPopupBehavior = $find(behaviourID);
    modalPopupBehavior.hide();
}

function setBodyHeightToContentHeight() {
    document.body.style.height = Math.max(document.documentElement.clientHeight, document.body.scrollHeight) + "px";
}

function bookmarksite(title,url)
{
    if (window.sidebar || window.sidebar && window.sidebar.addPanel) // firefox or NS6
        window.sidebar.addPanel(title, url, "");
    else if(window.opera && window.print)
    { // opera
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    }
    else if(document.all)// ie
        window.external.AddFavorite(url, title);
}
