/*************************************************/
function getPageWidth() {
  return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
} 
/*******************************************************/  
function getPageHeight() {
  return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}
/*******************************************************
function getPageSize() {
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
/*******************************************************/
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curtop,curleft];
}
/*******************************************************/
var IE = document.all?true:false;
function getMouseXY(e) {
  if (IE) { 
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {
    tempX = e.pageX;
    tempY = e.pageY;
  }  
  
  if (tempX < 0){tempX = 0;}
  if (tempY < 0){tempY = 0;}
}
/*******************************************************/
function getElementsByClass(name) {
  var found = 0;
  var elems = new Array();
  var alltags = document.getElementsByTagName("*");
  if (alltags) {
    for (i=0; i < alltags.length; i++) {
      if (alltags[i].className==name) {
        elems[found++]=alltags[i];
      }
    }
  }
  return(elems);
}
/*******************************************************/
function getElementsByRel(name) {
  var found = 0;
  var elems = new Array();
  var alltags = document.getElementsByTagName("*");
  if (alltags) {
    for (i=0; i < alltags.length; i++) {
      if (alltags[i].rel==name) {
        elems[found++]=alltags[i];
      }
    }
  }
  return(elems);
}
/******************************************************* 
function getImagePreview (which,path) {
	var URL = 'inc/getpictureupdate.php';			
	var values = 'image='+path+$F(which);	
	var insert = new Ajax.Request(
			URL,
			{	method: 'get',
				parameters: values,
				onComplete: function (originalRequest)  {			
				  $('previewimage'+which).innerHTML = originalRequest.responseText;
		    }
			}
		);
}
*/
