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 getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}


function getCoords(what,where) {
   var objItem = document.getElementById(where);
   //var objItem = where;
   
   var objParent = null;
   var intX = 0;
   var intY = 0;
   do
   { // Walk up our document tree until we find the body
    // and add the distance from the parent to our counter.
    intX += objItem.offsetLeft;
    intY += objItem.offsetTop;
    objParent = objItem.offsetParent.tagName;
    objItem = objItem.offsetParent;
   }

   while(objParent != 'HTML' && objParent != 'BODY')	
      if (what == "left") {
         return intX;
      } else {      	
         return intY;
      }
}

function overRating(rate) {
	for(i=1;i<=rate;i++){
		document.getElementById('rate_' + i).style.display = 'block';
	}
}

function outofRating(rate) {
	for(i=1;i<=rate;i++){
		document.getElementById('rate_' + i).style.display = 'none';
	}
}

function productRate(productId,rate) {
	makeRequest('rating_holder', '1', 'product_rate', 'id=' + productId + ';rate=' + rate, 2);
	return false;
}

// isIntegerInRange (STRING s, INTEGER a, INTEGER b)
function isIntegerInRange (s, a, b)
{   if (isEmpty(s))
      if (isIntegerInRange.arguments.length == 1) return false;
      else return (isIntegerInRange.arguments[1] == true);

   // Catch non-integer strings to avoid creating a NaN below,
   // which isn't available on JavaScript 1.0 for Windows.
   if (!isInteger(s, false)) return false;

   // Now, explicitly change the type to integer via parseInt
   // so that the comparison code below will work both on
   // JavaScript 1.2 (which typechecks in equality comparisons)
   // and JavaScript 1.1 and before (which doesn't).
   var num = parseInt (s);
   return ((num >= a) && (num <= b));
}
