/*  scrolling message */

var scroll1 = new scrollObject("scroller", 900, 25, "up", 3000, 1.4,window.document.getElementById("scroller"));
scroll1.block[0] = "Welcome in www.ZaZaZoOy.com A New Way To Communicate ";
scroll1.block[1] = "This site is under construction";
scroll1.block[2] = "Visit us regulary and alot of surprises will be waiting for you";
scroll1.block[3] = "Copyright &#169; 2008 www.ZaZaZoOy.com, All rights Reserved. ";





 function scrollObject(main, width, height, direct, pause, speed) {


  var self = this;
  this.main = main;
  this.width = width;
  this.height = height;
  this.direct = direct;
  this.pause = pause;
  this.block = new Array();
  this.offset = (direct == "up" || direct == "down") ? height : width;
  this.speed = Math.max(1.001, Math.min(this.offset, speed));
  this.blockprev = 0;
  this.blockcurr = 1;
  this.motion = false;
  this.mouse = false;
  this.scroll = function() {
    if (!document.getElementById) return false;
    this.main = document.getElementById(this.main);

   while (this.main.firstChild) this.main.removeChild(this.main.firstChild);
    for (var x = 0; x < this.block.length; x++) {
      var table = document.createElement('table');
          table.style.position = "absolute";
          table.style.width = "100%";
          table.style.height = this.height + "px";
          table.style.overflow = "hidden";
          table.cellPadding = table.cellSpacing = table.border = "0";
          table.style.left = table.style.top = "0px";


      if (x) {
          switch (this.direct) {
            case "up": table.style.top = this.height + "px"; break;
            case "down": table.style.top = -this.height + "px"; break;
            case "left": table.style.left = this.width + "px"; break;
            case "right": table.style.left = -this.width + "px"; break;
          }
        }
        var tbody = document.createElement('tbody');
          var tr = document.createElement('tr');
            var td = document.createElement('td');
                td.innerHTML = this.block[x];
              tr.appendChild(td);
            tbody.appendChild(tr);
          table.appendChild(tbody);
      this.main.appendChild(this.block[x] = table);
    }
    this.main.style.position = "relative";

    this.main.style.width = "100%";
    this.main.style.height = this.height + "px";
    this.main.style.overflow = "hidden";
    if (this.block.length > 1) {
      this.main.onmouseover = function() { self.mouse = true; }
      this.main.onmouseout = function() { self.mouse = false; }
      setInterval(function() { self.scrollLoop(); }, this.pause);
    }
  }
  this.scrollLoop = function() {
    if (!this.motion && this.mouse) return false;
    if (!(this.offset = Math.floor(this.offset / this.speed))) {
      var blocknext = (this.blockcurr + 1 >= this.block.length) ? 0 : this.blockcurr + 1;
    } else this.motion = true;
    switch (this.direct) {
      case "up":
        this.block[this.blockcurr].style.top = this.offset + "px";
        this.block[this.blockprev].style.top = (this.offset - this.height) + "px";
        if (!this.offset) this.block[blocknext].style.top = this.height + "px";
        break;
      case "down":
        this.block[this.blockcurr].style.top = -this.offset + "px";
        this.block[this.blockprev].style.top = (this.height - this.offset) + "px";
        if (!this.offset) this.block[blocknext].style.top = -this.height + "px";
        break;
      case "left":
        this.block[this.blockcurr].style.left = this.offset + "px";
        this.block[this.blockprev].style.left = (this.offset - this.width) + "px";
        if (!this.offset) this.block[blocknext].style.left = this.width + "px";
        break;
      case "right":
        this.block[this.blockcurr].style.left = -this.offset + "px";
        this.block[this.blockprev].style.left = (this.width - this.offset) + "px";
        if (!this.offset) this.block[blocknext].style.left = -this.width + "px";
        break;
    }
    if (!this.offset) {
      this.motion = false;
      this.blockprev = this.blockcurr;
      this.blockcurr = blocknext;
      this.offset = (this.direct == "up" || this.direct == "down") ? this.height : this.width;
    } else setTimeout(function() { self.scrollLoop(); }, 30);
  }
}



/* scrolling message */




/* end loading img */
/*  show/hide Div  */
function toggle(did) {
			el = document.getElementById(did);
			el.style.display = (el.style.display == "") ? "none" : "";
}
/* end show/hide Div */

/* check form */
function validateFormOnSubmit(theForm) {
var reason = "";

  reason += validateUsername(theForm.login);
  reason += validatePassword(theForm.pass);
  reason += validatePassword(theForm.rpass);
  reason += validateEmail(theForm.email);
  reason += checkpassandrepass(theForm.pass,theForm.rpass);

  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }
theForm.submit();
}

function checkpassandrepass(fld1, fld2) {

	var error="Your Password And Repassword doesn't Match.\n";
	if(fld1.value!=fld2.value) {fld1.style.background = '#FFB4E5';fld2.style.background = 'FFB4E5';return error;}


}

function validateUsername(fld) {
    var error = "";
    var illegalChars = /\W/; // allow letters, numbers, and underscores

    if (fld.value == "") {
        fld.style.background = '#FFB4E5';
        error = "You didn't enter a username.\n";
    } else if ((fld.value.length < 3) || (fld.value.length > 15)) {
        fld.style.background = 'Yellow';
        error = "The username is the wrong length.\n";
    } else if (illegalChars.test(fld.value)) {
        fld.style.background = '#FFB4E5';
        error = "The username contains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function validatePassword(fld) {
    var error = "";
    var illegalChars = /[\W_]/; // allow only letters and numbers

    if (fld.value == "") {
        fld.style.background = '#FFB4E5';
        error = "You didn't enter a password.\n";
    } else if ((fld.value.length < 7) || (fld.value.length > 15)) {
        error = "The password is the wrong length. \n";
        fld.style.background = '#FFB4E5';
    } else if (illegalChars.test(fld.value)) {
        error = "The password contains illegal characters.\n";
        fld.style.background = '#FFB4E5';
    } else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))) {
        error = "The password must contain at least one numeral.\n";
        fld.style.background = '#FFB4E5';
    } else {
        fld.style.background = 'White';
    }
   return error;
}

function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;

    if (fld.value == "") {
        fld.style.background = '#FFB4E5';
        error = "You didn't enter an email address.\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = '#FFB4E5';
        error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = '#FFB4E5';
        error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}
//end of check form


function maximise(fld) {

			e1 = document.getElementById(fld);

			e1.style.position="absolute";
			e1.style.top="100px";
			e1.style.left="100px";
		   e1.style.width="100%";
		   e1.style.height="100%";


}

