﻿// JScript File

function scrollToCoordinates(x, y) {
    var scroll = (window.scrollTo) ? 1 : 0;
    if (!scroll) return;
    window.scrollTo(x,y);
}

function saveScrollCoordinates(frm) { 
    var db = (document.body) ? 1 : 0;
    if (!db) return;
    frm.__scrollx.value = (document.body) ? document.body.scrollLeft : pageXOffset;
    frm.__scrolly.value = getScrollTop();
} 

function getScrollTop() {
    var s = 0;
    if (document.documentElement && document.documentElement.scrollTop) {
        s = document.documentElement.scrollTop;
    } else if (document.body && document.body.scrollTop) {
        s = document.body.scrollTop;
    } else if (window.pageYOffset) {
        s = window.pageYOffset;
    }
    return s;
}


function setActiveNavTab(grp) {
    var pggrp = ''; var oNav = getObj('navlist');
    for (i=0; i<oNav.childNodes.length; i++) {
        node = oNav.childNodes[i];
        if (node.nodeName=='LI') {
            pggrp = node.getAttribute('pggrp');
            if (pggrp == grp) {
                if (node.className.indexOf(' active')<0) {
                    if (node.className != 'active') {
                        node.className+=' active';
                    }
                }
            } else {
                if (node.className != 'active') {
                    node.className=node.className.replace(' active', '');
                } else {
                    node.className = '';
                }
            }
        }
    }
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}


function getObj(name) {
  if (document.getElementById) {
    return document.getElementById(name);
  } else if (document.all) {
    return document.all[name];
  } else if (document.layers) {
	return getObjNN4(document,name);
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
			foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

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[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}
function sE(e){l?e.visibility='show':e.style.visibility='visible';}
function hE(e){l?e.visibility='hide':e.style.visibility='hidden';}
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 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;}

