// JavaScript Document

// Thank you PPK at quirksmode.com

var _window_percent = 48;
var _pxToStrip = 115;
var _cell_height = 250;
var winHandle = null;

// some time later:

function focus_paypal() {
if (winHandle && winHandle.closed) {
    // do nothing
}
else {
    winHandle = window.open('','paypal')
	winHandle.focus();
}
}

var _toggledItems = new Array();
function toggleItem(_item) {
	alert(_item.style.display);
}

function setOpacity(testObj, value) {
	testObj.style.opacity = value;
	testObj.style.filter = 'alpha(opacity=' + value*100 + ')';
}

function getElementsByTagNames(list,obj) {
	if (!obj) var obj = document;
	var tagNames = list.split(',');
	var resultArray = new Array();
	for (var i=0;i<tagNames.length;i++) {
		var tags = obj.getElementsByTagName(tagNames[i]);
		for (var j=0;j<tags.length;j++) {
			resultArray.push(tags[j]);
		}
	}
	var testNode = resultArray[0];
	if (!testNode) return [];
	if (testNode.sourceIndex) {
		resultArray.sort(function (a,b) {
				return a.sourceIndex - b.sourceIndex;
		});
	}
	else if (testNode.compareDocumentPosition) {
		resultArray.sort(function (a,b) {
				return 3 - (a.compareDocumentPosition(b) & 6);
		});
	}
	return resultArray;
}

function popitup(url,width,height,text) {
	newwindow = window.open(url,'name','height='+height+',width='+width+',scrollbars=yes,resizable=yes');
	if (text) {
		newwindow.document.write(text);
		newwindow.document.close();
	}
	if (window.focus) {newwindow.focus()}
	return false;
}

function getSize() {
      var x,y;
      if (self.innerHeight) // all except Explorer
      {
      	x = self.innerWidth;
      	y = self.innerHeight;
      }
      else if (document.documentElement && document.documentElement.clientHeight)
      	// Explorer 6 Strict Mode
      {
      	x = document.documentElement.clientWidth;
      	y = document.documentElement.clientHeight;
      }
      else if (document.body) // other Explorers
      {
      	x = document.body.clientWidth;
      	y = document.body.clientHeight;
      }
	  return { x : x, y : y};
}

	function setHeight(_elements,_window_percent,_class)
		{
			var a = getSize();
			newHeight = parseInt(((a.y-_pxToStrip)*(_window_percent/100))-14);
			_cell_height = newHeight
			var _dmesg = '';
			for (_i=0; _i < _elements.length; _i++)
			{
		    if (_elements[_i].className == _class){
					 _dmesg += 'Before: '+_elements[_i].style.height+',';
					 _elements[_i].style.height = newHeight+'px';
					 _dmesg += ' After: '+_elements[_i].style.height+'\n';
				}
			}
//			alert('"'+newHeight+'"\n'+_dmesg);
		return 1;
	}
	
function checkSize() {
		var a = getSize();
		if ((a.x <= 750) || (a.y <= 450))
		{
			blogToggle(0);
		}
		else
		{
			blogToggle(1);
		}
		var url = document.URL;
		var ThisPage=url.substring(url.lastIndexOf("\/")+1,url.lastIndexOf("\."));
		if ((ThisPage == "index.php")||(ThisPage == '.org/')) {
			setHeight(document.getElementById('displayTable').getElementsByTagName('div'),_window_percent,'navPanel')
		}
//		alert('.org/');
		return 1;
}



