MyTimeout =20; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds

//-- This function displays a New page in
//-- a new window named adWindow.
function adWindow(URL, MyWidth, MyHeight) {
//function adWindow(URL) {
   winStats='toolbar=no,location=no,directories=no,menubar=no,'
   winStats+='scrollbars=no'
   if (navigator.appName.indexOf("Microsoft")>=0) {
      //winStats+=',left=50,top=200,width=600,height=545)'
      winStats+=',left=50,top=100,width=MyWidth, height=600t'
    }else{
      winStats+=',screenX=50,screenY=100,width=MyWidth,height=600'
      //winStats+=',screenX=50,screenY=100,width=" + (WIDTH+5) + ",height=" + (HEIGHT+5)'
      //winStats+=',screenX=50,screenY=200,width=600,height=545'
    }
//   adWindow=window.open(URL,"",winStats)
   preview = window.open(URL, "preview", winStats);
//   preview.document.open();
//   preview.document.close();
  
}


// Test form for Valid Entries

function runTest(form, button)  {
    Ret = false;
    if (button.name == "1") Ret = testBox1(form);
    if (button.name == "2") Ret = testBox2(form);
    if (button.name == "3") Ret = testBox3(form);
    if (button.name == "4") Ret = testBox4(form);
    if (Ret)
    alert ("Successful input!");
    }

function testBox1(form) {
    Ctrl = form.email;
    if (Ctrl.value == "" || Ctrl.value.indexOf ('@', 0) == -1) {
        validatePrompt (Ctrl, "Enter a valid email address")
        return (false); }
    else
        return (true);
}

function testBox2(form) {
    Ctrl = form.name;
    if (Ctrl.value.length < 5) {
        validatePrompt (Ctrl, "Please enter Your Contact Name")
        return (false);
        }
    else
        return (true);
    }

function testBox3(form) {
    Ctrl = form.address;
    if (Ctrl.value.length < 3) {
        validatePrompt (Ctrl, "Please enter Your Address")
        return (false);
        }
    else
        return (true);
    }

function testBox4(form) {
    Ctrl = form.phonenumber;
    if (Ctrl.value == "") {
        validatePrompt (Ctrl, "Please enter your Phone Number")
        return (false);
        }
    else
        return (true);
        }

function runSubmit (form, button)  {
    if (!testBox1(form)) return;
    if (!testBox2(form)) return;
    if (!testBox3(form)) return;
    if (!testBox4(form)) return;
    alert ("Thank you for your enquiry, we will contact you shortly!");
    //document.test.submit();
    // un-comment to submit form
    return;
}

function validatePrompt (Ctrl, PromptStr) {
    alert (PromptStr)
    Ctrl.focus();
    return;
}

function loadDoc() {
    // initial focus; use if needed
    //document.test.email.focus ();
    return;
}


// No Rigt Click

  var message="HEY, Do it the Hard Way!";
  function click(e) {
    if (document.all) {
      if (event.button == 2) {
        alert(message);
        return false;
      }
    }
    if (document.layers) {
      if (e.which == 3) {
        alert(message);
        return false;
      }
    }
  }
  if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
  }
  document.onmousedown=click;
  
  
  // Scrolling Text 
  
  //-- JavaScript code written by Alan Simpson - www.coolnerds.com 
  //This first function pads the message with blanks, and inserts the HTML
  //required to display the form in your page. Not executed until called.
  //Do not change any of this code. 
  function banner(msg,ctrlwidth) {
     // Pad message and bring to width of textbox.
     for (i=0;i<=ctrlwidth;i++){msg=" "+msg}
     // Set up the form and form field.
     document.write ('<form name="banner"><center>')
     document.write ('<input name="scrollBox" value="'+msg+'" size='+ctrlwidth+'>')
     document.write ('</center></form>')
     rollmsg() //Get the banner rolling
  }
  
  //This function makes the message scroll through the text box.
  function rollmsg() {
     nowMsg=document.banner.scrollBox.value
     nowMsg=nowMsg.substring(1,nowMsg.length)+nowMsg.substring(0,1)
     document.banner.scrollBox.value=nowMsg
     myTimer=setTimeout("rollmsg()",75) 
  }
 
