
function openwindow(u) {
  popup=window.open(u,"Member", 'toolbar=1, location=1, directories=0, status=1, menubar=1, scrollbars=1, resizable=1,width=800 ,height=480');
}

function cursor(){
  document.fmContactUs.Realname.focus();
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// Display To Days Date in the following format: Thursday, July 07, 2005
///////////////////////////////////////////////////////////////////////////////////////////////////
function TodaysDate() {
  var mydate=new Date()
  var theYear=mydate.getFullYear()
  var day=mydate.getDay()
  var month=mydate.getMonth()
  var daym=mydate.getDate()
  if (daym<10) {daym="0"+daym}
  var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
  var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
  document.write(dayarray[day]+",&nbsp;"+montharray[month]+"&nbsp;"+daym+",&nbsp;"+theYear)
}


///////////////////////////////////////////////////////////////////////////////////////////////////
// Row Highlighting
///////////////////////////////////////////////////////////////////////////////////////////////////
function rowOverEffect(object) {
  if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// Designed By Status window display
///////////////////////////////////////////////////////////////////////////////////////////////////
function DesignedBy()
  { 
    window.status= "This Web Site was Developed by Telecom Cost - Web Design www.telecomcost.net";
  }
// DesignedBy();




///////////////////////////////////////////////////////////////////////////////////////////////////
// Contact Us Verification
///////////////////////////////////////////////////////////////////////////////////////////////////
function fnReset()  {
  document.fmContactUs.email.className = "INPUTBOX"
  document.fmContactUs.Realname.className = "INPUTBOX"
  document.fmContactUs.PhoneNo.className = "INPUTBOX"
//      document.fmContactUs.ReferedByOther.className = "INPUTBOX"

  document.fmContactUs.reset()
}

function fnSubmit() {
  AlertMsg = ""
  FocusSet = false;
  emailRE= /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
  phoneRE= /^[\+\(\)\.\-\s\d]*$/

  document.fmContactUs.email.className = "INPUTBOX"
  document.fmContactUs.Realname.className = "INPUTBOX"
  document.fmContactUs.PhoneNo.className = "INPUTBOX"
//      document.fmContactUs.ReferedByOther.className = "INPUTBOX"

  // Check required fields
  if (document.fmContactUs.email.value == "" && document.fmContactUs.Realname.value == "" && document.fmContactUs.PhoneNo.value == "")  {
    AlertMsg = "\n\  --> Please Enter An Email Address\n\  -->   Or\n\  --> A Contact Name And Phone Number";
    document.fmContactUs.email.className = "INPUTBOXERR"
    document.fmContactUs.email.focus()
    FocusSet = true;
  } else {      
    // If no email check for contact name
    if (document.fmContactUs.email.value == "" && document.fmContactUs.Realname.value == "") {
      AlertMsg = AlertMsg + "\n\  --> Please Enter A Contact Name or Email";
      document.fmContactUs.email.className = "INPUTBOXWARN"
      document.fmContactUs.Realname.className = "INPUTBOXERR"
      document.fmContactUs.Realname.focus()
      FocusSet = true;
    }
    
    // If no email check for contact phone number
    if (document.fmContactUs.email.value == "" && document.fmContactUs.PhoneNo.value == "")  {
      AlertMsg = AlertMsg + "\n\  --> Please Enter A Phone Number or Email";
      document.fmContactUs.email.className = "INPUTBOXWARN"
      document.fmContactUs.PhoneNo.className = "INPUTBOXERR"
      document.fmContactUs.PhoneNo.focus()
      FocusSet = true;
    }
  }

  // Check for a correctly formatted email
  if (emailRE.test(document.fmContactUs.email.value) == false && document.fmContactUs.email.value != "") {
    AlertMsg = AlertMsg + "\n\  --> ! Invalid eMail address entered";
    document.fmContactUs.email.className = "INPUTBOXERR";
    document.fmContactUs.email.focus()
    FocusSet = true;
  }

  
  // Check for a correctly formatted phone number
  if (phoneRE.test(document.fmContactUs.PhoneNo.value) == false && document.fmContactUs.PhoneNo.value != "") {
    AlertMsg = AlertMsg + "\n\  --> ! Invalid phone number entered";
    document.fmContactUs.PhoneNo.className = "INPUTBOXERR"
    if (!FocusSet) {
      document.fmContactUs.PhoneNo.focus()
      FocusSet = true;
    }
  }
/*
  // If referedby set to "other" set check the other is specified
  S = document.fmContactUs.ReferedBy
  if (S.options[S.selectedIndex].value == "Other" && document.fmContactUs.ReferedByOther.value == "") {
    AlertMsg = AlertMsg + "\n\  --> Please Specify Other";
    document.fmContactUs.ReferedByOther.className = "INPUTBOXERR"
    if (!FocusSet) {
      document.fmContactUs.ReferedByOther.focus()
      FocusSet = true;
    }
  }
*/
 
  if (AlertMsg != "") {
    AlertMsg = "Can you re-check your form please \n" + AlertMsg;
    alert(AlertMsg);
  } else {
    if (document.fmContactUs.email.value == "") document.fmContactUs.email.value = "webform@ddm.ie";
    if (document.fmContactUs.subject.value == "") document.fmContactUs.subject.value = "ddm Comment Form";
    document.fmContactUs.submit();
  }
}


