/***********************************************************************
 *  Filename: mod25_misc.js                                            *
 *  Date Created: 11MAY06                                              *
 *  Date Last Modified: 16AUG06                                        *
 *  Package: mod25                                                     *
 *  Type: Misc. Functions                                              *
 *  Copyright 2006 Mod25 Solutions, LLC All Rights Reserved            *
 *  Notes: This is a collection of functions that can't be grouped     *
 *	otherwise because they don't have enough for seperate files.       *
 **********************************************************************/


/***********************************************************************
 * Requirements:                                                       *
 *      None                                                           *
 **********************************************************************/

// Used to get an element style.  Commonly this function is used to get the style of an element
//	that has been set by a linked style sheet and has not been modified already by the script.
//	***Note*** This function was borrowed from "Javascript & DHTML Cookbook"
// Arguments: elemID - Object reference of the element; IEStyleProp - IE style property name ie. 'marginLeft';
//	CSSStyleProp - CSS style property name ie. 'margin-left'
function getElementStyle(elem, IEStyleProp, CSSStyleProp) {
	// Check if we are using the IE style css
    if (elem.currentStyle) {
		// Get the element style
        return elem.currentStyle[IEStyleProp];
	// Check if we are using the W3C style css
    } else if (window.getComputedStyle) {
		// Get the style object
        var compStyle = window.getComputedStyle(elem, "");
		// Get the element style
        return compStyle.getPropertyValue(CSSStyleProp);
    }
	
    return;
}

// Used to get the inner width of the window
function getWindowWidth() {
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		return window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		return document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		return document.body.clientWidth;
	}
}

// Used to get the inner height of the window
function getWindowHeight() {
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		return window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		return document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		return document.body.clientHeight;
	}
}

// Get the actual position of an element on the window
function getAbsoluteX(obj) {
	// Location of the object on the window
	var xpos;
	
	// Parent object
	var parent;
	
	// Get the original location
	xpos = obj.offsetLeft;
	
	// Get the parent object
	parent = obj.offsetParent;
	
	while (parent.nodeName != 'BODY' && parent.nodeName != 'HTML') {
		// Add the location of the objects location
		xpos += parent.offsetLeft;
		
		// Get the parent
		parent = parent.offsetParent;
	}
	
	return xpos;
}

// Get the actual position of an element on the window
function getAbsoluteY(obj) {
	// Location of the object on the window
	var ypos;
	
	// Parent object
	var parent;
	
	// Get the original location
	ypos = obj.offsetTop;
	
	// Get the parent object
	parent = obj.offsetParent;
	
	while (parent.nodeName != 'BODY' && parent.nodeName != 'HTML') {
		// Add the location of the objects location
		ypos += parent.offsetTop;
		
		// Get the parent
		parent = parent.offsetParent;
	}
	
	return ypos;
}