/* 

	+----------------------------------------------------------------+
	| Copyright (C) 2007, PaintTech America Inc.                     }
	| Designed by APD Technologies Inc.                              |
	| All Rights Reserved                                            |
	|                                                                |
	| RESTRICTED RIGHTS:                                             |
	|                                                                |
	| This  file  may have  been supplied  under a  license.  It may |
	| be used, disclosed, and/or copied only as permitted under such |
	| license agreement.  Any copy must contain the  above copyright |
	| notice and this restricted rights notice.  Use, copying, and / |
	| or  disclosure of   the file  is strictly  prohibited   unless |
	| otherwise provided in the license agreement.                   |
	+----------------------------------------------------------------+

	$Id: std.js,v 1.2 2007/06/26 00:33:38 adsouza Exp $
	Author:		Anthony D'Souza
	Descrition:	Standard javascript functions

*/

function goJump( )
{

	selection	= document.quickjump.jumpTo;
	destination	= selection.options[ selection.selectedIndex ].value;

	if ( destination == '' )
		return;

	document.location.href = destination;

}

function toUrl( dest )
{
	
	window.location	= dest;

}

function browserSize( ) 
{

	var mywidth		= 0;
	var myheight	= 0;

	if ( typeof( window.innerWidth ) == 'number' ) {
		// None-IE
		mywidth		= window.innerWidth;
		myheight	= window.innerHeight;

	} else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		mywidth		= document.documentElement.clientWidth;
		myheight	= document.documentElement.clientHeight;

	} else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		mywidth		= document.body.clientWidth;
		myheight	= document.body.clientHeight;

	}

	return [ mywidth, myheight ];


}

function getStyleClass( )
{

	for ( var s = 0; s < document.styleSheets.length; s++ ) {
		if ( document.styleSheets[ s ].rules ) {
			for ( var r = 0; r < document.styleSheets[ s ].rules.length; r++ ) {
				if ( document.styleSheets[ s ].rules[ r ].selectorText == '.' + className ) {
					return document.styleSheets[ s ].rules[ r ];

				}

			}

		} else {
			for ( var r = 0; r < document.styleSheets[ s ].cssRules.length; r++ ) {
				if ( document.styleSheets[ s ].cssRules[ r ].selectorText == '.' + className ) 
					return document.styleSheets[ s ].cssRules[ r ];


			}

		}

	}

	return null;

}

function getScrollXY( )
{

	var scrOfX	= 0;
	var scrOfY	= 0;

	if ( typeof( window.pageYOffset ) == 'number' ) {
		// Netscape compliant
		scrOfY	= window.pageYOffset;
		scrOfX	= window.pageXOffset;

	} else if ( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		// DOM compliant
		scrOfY	= document.body.scrollTop;
		scrOfX	= document.body.scrollLeft;

	} else if ( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		// IE6 standards compliant mode
		scrOfY	= document.documentElement.scrollTop;
		scrOfX	= document.documentElement.scrollLeft;

	}
	
	return [ scrOfX, scrOfY ];

}

function setFooterPos( minlimit )
{

	var posArr	= new Array( 2 );
	posArr = browserSize( );
	var width	= posArr.pop( );
	var height	= posArr.pop( );

	if ( minlimit > height ) {
		alert( "The page height is too small (" + minlimit + " > " + height + ")\n\nWidth: " + width + "\nHeight: " + height );
		getStyleClass( 'ftrdv' ).style.bottom = 0;

	}

}

function popWin( theURL, theWidth, theHeight )
{

	// pop up window
	window.open( theURL, 'popWin', 'width=' + theWidth + ',height=' + theHeight + ',scrollbars=yes,toolbar=no,status=no,resizable=1' );

}

function bookmark( url, title )
{

	if ( ( navigator.appName == "Microsoft Internet Explorer" ) && ( parseInt( navigator.appVersion ) >= 4 ) ) {
		window.external.AddFavorite( url, title );

	} else if ( navigator.appName == "Netscape" ) {
		window.sidebar.addPanel( title, url, "" );

	} else {
		alert( "Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark" );

	}

}

// vim:syntax=javascript 

