//displays a help window
function showHelp()
{
	helpwindow= window.open ("http://soalib.com", "Help",
	"location=no,resizable=0,toolbar=no,scrollbars=no,menubar=no,directories=no,width=300,height=100");
	helpwindow.moveTo(0,0);
	helpwindow.locationbar.visible = false
}

// shows help in a <div id="elementId"> control.
function helpText (elementId, text) {
	var element;
	if (document.getElementById) {
		element = document.getElementById(elementId);
//		element.clientTop = findPos(elementId)+100;
	}
	element.textContent = text;
}

function findPos(id) {
	var node = document.getElementById(id);     
	var curtop = 0;
	var curtopscroll = 0;
	if (node.offsetParent) {
		do {
			curtop += node.offsetTop;
			curtopscroll += node.offsetParent ? node.offsetParent.scrollTop : 0;
		} while (node = node.offsetParent);

		//alert(curtop - curtopscroll);
	}
	return curtop - curtopscroll;
}

/* Return TRUE if user is using mobile phone browser */
function ismobile(){
	$useragent = $_SERVER['HTTP_USER_AGENT'];
//	Standard vendor-model/version user agents
	if (preg_match('/^((ACER¦Alcatel¦AUDIOVOX¦BlackBerry¦CDM¦Ericsson¦LG\b¦LGE¦Motorola¦MOT¦NEC¦Nokia¦Panasonic¦QCI¦SAGEM¦SAMSUNG¦SEC¦Sanyo¦Sendo¦SHARP¦SIE¦SonyEricsson¦Telit¦Telit_mobile_Terminals¦TSM)[- ]?([^\/\s\_]+))(\/(\S+))?/', $useragent)){
		return true;
	}else{
		return false;
	}
}
