function disableEnterKey(e)
{
     var key;     
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox     

     return (key != 13);
}

function mailpage(What,Where)
{
	What = What.replace(/&/gi, "%26");
	//What = What.replace(/\++/, "%2B+");
	Where = encodeURIComponent(Where)
	//Where = Where.replace(/\++/, "%2B+");
	mail_str = "mailto:?subject=Check out the " + What;
	mail_str += "&body=I thought you might be interested in the " + What;
	mail_str += ". You can view it at, <" + Where + ">";
	location.href = mail_str;
}

function closeMoreInfoFloat() {
	new Effect.Fade($('MoreInfo'), {duration: 0});
	new Effect.Fade($('MoreInfoFloat'), { duration: 0.0, from: 0.4, to: 0.0, queue: 'end' });
}

function doMoreInfo2() {
	if ($('MoreInfo') == null) {
		return;
	}
	var arrayPageSize = getPageDim();
	$('MoreInfoFloat').setStyle({ position: 'absolute', width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
	new Effect.Appear($('MoreInfoFloat'), { duration: 0, from: 0.4, to: 0.4, queue: 'front' });
}

function doMoreInfo() {
	if ($('MoreInfo') == null) {
		return;
	}

	var arrayPageSize = getPageDim();
	$('MoreInfoFloat').setStyle({ position: 'absolute', width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
	new Effect.Appear($('MoreInfoFloat'), { duration: 0, from: 0.4, to: 0.4, queue: 'front' });
	
	$('MoreInfo').setStyle({ width: 300, zIndex: 999, backgroundColor: '#ffffff', position: 'absolute', top: 0, left: (($('MoreInfoFloat').getWidth() - $('MoreInfo').getWidth()) / 2 ) + "px" });
	new Effect.Appear($('MoreInfo'), {duration: 0, queue: 'end'});
	$('bottomNavCloseMoreInfo').observe('click',closeMoreInfoFloat);
}			

function getPageDim() {
	 var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		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
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			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 = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}
	
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function moveArrow(x, y, obj) {
	x = x + "px";
	y = y + "px";
	obj.style.left = x;
	obj.style.top = y;
	obj.style.display = "block";
}

