﻿// Move an element directly on top of another element (and optionally
// make it the same size)
function Cover(bottom, top, ignoreSize) {
    var location = Sys.UI.DomElement.getLocation(bottom);
    top.style.position = 'absolute';
    top.style.top = location.y + 'px';
    top.style.left = location.x + 'px';
    if (!ignoreSize) {
        top.style.height = bottom.offsetHeight + 'px';
        top.style.width = bottom.offsetWidth + 'px';
    }
}

/* Renders an email address from FCK function call */
function mt(name,domain,subject,body) {
  var mailto = 'mailto:' + name + '@' + domain;
  if(subject!='') {
    mailto += '?subject=' + subject;
    if(body!='') {
        mailto += '&body=' + body;
    }
  } else {
    if(body!='') {
        mailto += '?body=' + body;
    }
  }
  location.href = mailto;
}

function IsElementSelected(id) {
    var el = document.getElementById(id);
    var sel = false;
    var inputs = el.getElementsByTagName('input');
    for(i=0;i<inputs.length;i++){
        if(inputs[i].checked){
            sel = true;
        }
    }
    return sel;
}

function Trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function LTrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}

function RTrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

/****************************************
	Added to fix the exposed e-mail		
	address in text issue
	
	Dependencies:	function mt(name,domain,subject,body) (found in this file)
	[JPH - 3/31/2010]
****************************************/
function EmailLink(name,domain,subject,body)
{
	return '<a href="javascript:mt(\'' + name + '\',\'' + domain + '\',\'' + subject + '\',\'' + body + '\');">' + name + '@' + domain + '</a>';
}