﻿function printSelection(objname,printerurl){

  var content=lib.getObject(objname).innerHTML
  var pwin=showDialog(printerurl,0,0);

  while(pwin.document.getElementById('ContentContainer')==null){}
  
  pwin.document.getElementById('ContentContainer').innerHTML=content;
  pwin.print();
 
  setTimeout(function(){pwin.close();},1000);

}

function showImage(url,w,h)
{
	showDialog('ViewedImage.ashx?path=' + url,w,h);
}

function showDialog(url, width, height)
{
	return showWindow(url, false, false, false, false, false, false, true, true, width, height, 0, 0);
}

function showWindow(url, isStatus, isResizeable, isScrollbars, isToolbar, isLocation, isFullscreen, isTitlebar, isCentered, width, height, top, left)
{
	if (isCentered)
	{
		top = (screen.height - height) / 2;
		left = (screen.width - width) / 2;
	}

	return open(url, '_blank', 'status=' + (isStatus ? 'yes' : 'no') + ','
	+ 'resizable=' + (isResizeable ? 'yes' : 'no') + ','
	+ 'scrollbars=' + (isScrollbars ? 'yes' : 'no') + ','
	+ 'toolbar=' + (isToolbar ? 'yes' : 'no') + ','
	+ 'location=' + (isLocation ? 'yes' : 'no') + ','
	+ 'fullscreen=' + (isFullscreen ? 'yes' : 'no') + ','
	+ 'titlebar=' + (isTitlebar ? 'yes' : 'no') + ','
	+ 'height=' + height + ',' + 'width=' + width + ','
	+ 'top=' + top + ',' + 'left=' + left);
}

function setHomePage(ctrl)
{
	ctrl.style.behavior='url(#default#homepage)';
	ctrl.setHomePage(location.host);
}

function DisplayBrowserTitle(sTitle)
{
	
	document.title = document.title + " - " + sTitle;
}

function getWinWidth() {
    isNav = (document.all) ? false : true;
    isIE = (document.all) ? true : false;
    if (isNav && !isIE)
        return (window.innerWidth);
    else if (isIE && !isNav)
        return (document.body.clientWidth);
    else
        return (100);
}
