﻿// JScript File
var _page = new Object();
	
	/*
	*****************************
	****** Helper functions *****
	*****************************
	*/
	// 1k DHTML API - standards version
	d=document;l=d.layers;op=navigator.userAgent.indexOf('Opera')!=-1;px='px';	
	function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V){if(V[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}}if(d.getElementById)return d.getElementById(e);if(d.all)return d.all[e];else return null;};
	function sE(e){l?e.visibility='show':e.style.visibility='inherit';};
	function hE(e){l?e.visibility='hide':e.style.visibility='hidden';};
	function dE(e){e.style.display='';};
	function nE(e){e.style.display='none';};
	function sZ(e,z){l?e.zIndex=z:e.style.zIndex=z;};
	function sX(e,x){l?e.left=x:op?e.style.pixelLeft=x:e.style.left=x+px;};
	function sY(e,y){l?e.top=y:op?e.style.pixelTop=y:e.style.top=y+px;};
	function sW(e,w){l?e.clip.width=w:op?e.style.pixelWidth=w:e.style.width=w+px;};
	function gW(e){if(l){return e.clip.width}else if(op){return e.style.pixelWidth}else{return e.style.width;}};
	function sH(e,h){l?e.clip.height=h:op?e.style.pixelHeight=h:e.style.height=h+px;};
	function sC(e,t,r,b,x){l?(X=e.clip,X.top=t,X.right=r,X.bottom=b,X.left=x):e.style.clip='rect('+t+px+' '+r+px+' '+b+px+' '+x+px+')';};
	function wH(e,h){if(l){Y=e.document;Y.open();Y.write(h);Y.close();}if(e.innerHTML)e.innerHTML=h;};
	// Additions
	function goW(e){return(e.clip?e.clip.width:e.offsetWidth)};
	function goH(e){return(e.clip?e.clip.height:e.offsetHeight)};
	function gsW(){return(screen.availWidth?screen.availWidth:screen.width)};
	function gsH(){return(screen.availHeight?screen.availHeight:screen.height)};


function MM_swapImgRestore() 
{ //v3.0
    var i,x,a=document.MM_sr; 
    for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() 
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) 
{ //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() 
{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

_page.PrintVersion = function()
{
	var printarea = gE("print-area");
	if (printarea == null) {
		alert("no print area defined");
		return;
	}	

	var print_body = '';
	print_body += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
	print_body += '<html>';
	print_body += '<head>';
	print_body += '<title>' + document.title + '</title>';
	print_body += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
	print_body += '<link href="' + _page.themeDir + '/Default.css" rel="stylesheet" type="text/css">';
	print_body += '</head>';
	print_body += '<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">';
	print_body += '  <table width="728" border="0" cellspacing="0" cellpadding="5" align="center">';
	print_body += '    <tr>';
	print_body += '      <td width="728" align="left" valign="top" class="MainContentFieldColor">';
	print_body += '        <img src="' + _page.themeDir + '/Images/logo_print.gif" border="0">';
	print_body += '      </td>';
	print_body += '    </tr>';
	print_body += '    <tr>';
	print_body += '      <td width="728" align="left" valign="top" class="MainContentFieldColor">';
	print_body += printarea.innerHTML;
	print_body += '      </td>';
	print_body += '    </tr>';
	print_body += '  </table>';
	print_body += '</body>';
	print_body += '</html>';

	// Create popup window
	var wHeight=500;
	var wWidth=900;
	var w=window.open('','','height='+wHeight+',width='+wWidth+',toolbar=yes,scrollbars=yes')
	// Center popup window
	var sWidth = parseInt(gsW());
	var sHeight = parseInt(gsH());
	if( sWidth>0&&sHeight>0 ){w.moveTo(Math.round((sWidth-wWidth)/2),Math.round((sHeight-wHeight)/2))};
	if( w.focus ) { w.focus(); }
	w.document.open();
	w.document.write(print_body);
}

//Centers the specified element on the page
function CenterElement(elementId)
{
    var e = gE(elementId);
    if (e!=null)
    {
        var width = parseInt(document.documentElement.clientWidth);
	    if (width==0 || (document.body.clientWidth<width && document.body.clientWidth>0))
		    width = document.body.clientWidth;

        var height = parseInt(document.documentElement.clientHeight);
	    if (height==0 || (document.body.clientHeight<height && document.body.clientHeight>0))
		    height = document.body.clientHeight;

	    var scrollTop = parseInt(document.documentElement.scrollTop);
	    if (document.body.scrollTop>scrollTop)
		    scrollTop = parseInt(document.body.scrollTop);

	    var scrollLeft = parseInt(document.documentElement.scrollLeft);
	    if (document.body.scrollLeft>scrollLeft)
		    scrollLeft = parseInt(document.body.scrollLeft);

	    e.style.top = Math.round((parseInt(height)-e.style.height)/2)+scrollTop-80;
	    e.style.left = Math.round((parseInt(width)-e.style.width)/2)+scrollLeft;
	}
}

