function createPopupWindow(html,name,width,height) {
	var n=open
	( 
	html, name, 
	'width='+width+',height='+height
	+',left='+(screen.width -width )/2
	+',top=' +(screen.height-height)/2
	+',status=0,menubar=0,toolbar=0,scrollbars=0,resizable=0'
	);
	n.focus();
}
	
function showLargeImage(sImage,sTemplate,sWidth,sHeight){
	var w,h;
	if(sWidth!='')	
		w=parseInt(sWidth);
	else
		w=650;
	if(sHeight!='')
		h=parseInt(sHeight);
	else
		h=650;
	createPopupWindow('/library/templates/'+sTemplate+'/includes/includeEnlargedImage.asp?image='+escape(sImage),'enlargedImage',w,h);
}

function getMouseX() {
	var tempX;
    tempX = event.clientX + document.body.scrollLeft;
	return tempX;
}

function getMouseY() {
	var tempY
    tempY = event.clientY + document.body.scrollTop;
	return tempY;
}

function showContactPicture(img){
	var o=document.getElementById("tooltip");
	o.innerHTML="<img src=\"" + img + "\" alt=\"\" border=\"0\" style=\"border:2px solid grey\">"
	o.style.display="block";
}

function hideContactPicture(){
	var o=document.getElementById("tooltip");
	o.innerHTML="";
	o.style.display="none";
}

function moveTooltip(e){
	var o=document.getElementById("tooltip");
	o.style.left=getMouseX();
	o.style.top=getMouseY();
}
function getTopMenuObject(iMenuNumber){
	var id='aw_topMenu_'+iMenuNumber;
	return document.all ? document.all(id) : 
		document.getElementById ? document.getElementById(id) :	
			document.layers ? document.layers[id] :	null;
}

// function to check whether a radio-button is selected
function check_if_checked(frm, elt) {
  var ret = false; // whether a radio-button is checked
  var i=0;

  if(typeof(frm) == "object") {
    // frm was passed by reference
    while(!ret && i < frm.elements[elt].length) {
      ret = frm.elements[elt][i].checked;
      i++;
    }
  } else {
    // assume frm is a string
    while(!ret && i < document.forms[frm].elements[elt].length) {
      ret = document.forms[frm].elements[elt][i].checked;
      i++;
    }
  }
  return ret;
}

function getRealLeft(el) {
	xPos = el.offsetLeft;
	tempEl = el.offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

function getRealTop(el) {
	yPos = el.offsetTop;
	tempEl = el.offsetParent;
	while (tempEl != null) {
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}
	return yPos;
}

function stretch(myid){
	
	var stretcher=document.getElementById(myid);
	var stretcherHeight = stretcher.offsetHeight;
	// get browser size
	var windowHeight = document.documentElement.clientHeight;
	if(stretcherHeight<(windowHeight-200))
		stretcherHeight=(windowHeight-200);
	stretcher.style.height=stretcherHeight +"px";
}


