
function popUp(url, w, h) {
	x=(window.screen.width/2)-(w/2);
	y=(window.screen.height/2)-(h/2);
	window.open(url, '_blank','scrollbars=yes,width='+w+',height='+h+',top='+y+',left='+x+', toolbar=no,location=no,status=no,menubar=no,resizable=no');
}


function emailvalidation(entered)
{
	with(entered)
	{
		if (isEmpty(value)) {
            alert("Please insert an email");
		    return false;
		}

	    var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; // valid
		if (!reg1.test(value) && reg2.test(value))
		{ 				// if syntax is valid
			return true;
		}
		alert("\"" + value + "\" is not a valid email address");
		return false;
	}
}

function isEmpty(s)
{
   return ((s == null) || (s.length == 0))
}

function isDigit (c)
{
   return ((c >= "0") && (c <= "9"))
}


function isInteger (s)
{
	var i;

    if (isEmpty(s))
       return true;  //empty = true

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}


function noemptyvalidation(entered, alertbox)
{
  with (entered)
  {
    if (isEmpty(value))
    {
      if (alertbox!="")
      {
        alert(alertbox);
      }
      return false;
    }
    else
    {
      return true;
    }
  }
}



function visi(nr)
{
	if (document.layers)
	{
		vista = (document.layers[nr].visibility == 'hide') ? 'show' : 'hide'
		document.layers[nr].visibility = vista;
	}
	else if (document.all)
	{
		vista = (document.all[nr].style.visibility == 'hidden') ? 'visible'	: 'hidden';
		document.all[nr].style.visibility = vista;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(nr).style.visibility == 'hidden') ? 'visible' : 'hidden';
		document.getElementById(nr).style.visibility = vista;

	}
}

