
//
// +---------------------------------------------------------------------+
// | WORLDWORDSANDIMAGES.COM                                             |
// +---------------------------------------------------------------------+
// | quirksmode.js                                                       |
// | beet menu js quirksmode functions                                   |
// |                                                                     |
// | Dtek Digital Media, dtek.net                                        |
// | 2004.11.16                                                          |
// |                                                                     |
// +---------------------------------------------------------------------+
//

//javascript lifted (and tweaked) from quirksmode.org.  thanks ppk!

/* 
---------------------------------------------------------------------
beet is a simple set of scripts for creating DHTML menus.

Copyright (C) 2004 Daniel Kahn Gillmor

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program (in the file "COPYING"); if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.

or look for the GPL online at http://www.fsf.org/copyleft/gpl.html
---------------------------------------------------------------------
*/

// this is a set of simple javascript functions that are generically
// useful to make things work cross-browser.

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
		if (obj.offsetLeft)
			curleft += obj.offsetLeft;
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
//	var printstring = '';
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
//			printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
		if (obj.offsetTop)
			curtop += obj.offsetTop;
	}
	else if (obj.y)
		curtop += obj.y;
//	window.status = printstring;
	return curtop;
}


function createObj(tagname) {
	this.obj = document.createElement(tagname);
	this.style = this.obj.style;
}

function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}


function getViewPortWidth() {
	if (self.innerWidth) { 
		// all except Explorer
		return self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		// Explorer 6 Strict Mode
		return document.documentElement.clientWidth;
	} else if (document.body) {
		// other Explorers
		return document.body.clientWidth;
	}
}
function getViewPortHeight() {
	if (self.innerHeight) {
		// all except Explorer
		return self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		// Explorer 6 Strict Mode
		return document.documentElement.clientHeight;
	} else if (document.body) {
		// other Explorers
		return document.body.clientHeight;
	}
}

function getViewPortHScroll() {
	if (self.pageYOffset) {
		// all except Explorer
		return self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		// Explorer 6 Strict
		return document.documentElement.scrollLeft;
	} else if (document.body) {
		// all other Explorers
		return document.body.scrollLeft;
	}
}
function getViewPortVScroll() {
	if (self.pageYOffset) {
		// all except Explorer
		return self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		// Explorer 6 Strict
		return document.documentElement.scrollTop;
	} else if (document.body) {
		// all other Explorers
		return document.body.scrollTop;
	}
}
