﻿/* 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+$/,"");
}

function showPopUp(strCSSPath, strTitle, strText) {
    var win = window.open('', 'win', 'top=100,left=300,width=400,height=200,toolbar=no,menubar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no')
    win.document.body.innerHTML = '';
    win.document.write("<html><head><title>"+strTitle+"</title><link rel=\"stylesheet\" type=\"text/css\" href=\""+strCSSPath+"\" /></head><body style=\"padding:10px;\">");
    win.document.write("<h1>"+strTitle+"</h1>");
    win.document.write("<p>" + strText + "</p></body></html>");
    win.focus()
    return false;
}

function writeEmail() {
    var strEmail = ('cont' + 'act@' + 'matthe' + 'wadelman.com');
    document.write('<a href="mailto:' + strEmail + '?Subject=Website Inquiry">'+strEmail+'</a>');
}
