/** 
* Copyright © (C) IAC "CiM" 2003. All rights reserved. 
* http://www.cimdesign.com 
* mailto:info@cimdesign.com 
* phone: +38 044 5319078 
* This is a standard copyright header for all source code 
* appearing at cimdesign.com 
**/ 


function isEmail(str)
{
	var supported = 0;
	if (window.RegExp)
	{
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr))
			supported = 1;
  }

  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
//  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  var r2 = new RegExp("^[A-Z0-9._%-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|cat|jobs|travel|mobi|post|tel)$");

  return (!r1.test(str) && r2.test(str));
}
//
///////////////////////////////////
//
function isInteger(checkString)
{
    newString = "";
    count = 0;
    for (i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i+1);
        if ((ch >= "0" && ch <= "9") || (ch == "-")) {
            newString += ch;
        }
    }
    if (checkString != newString)
		return false;
	 else
	   return true;
}
//
//////////////////////////////////
//
function isFloat(checkString)
{
    newString = "";
    count = 0;
    for (i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i+1);
        if ((ch >= "0" && ch <= "9") || (ch == ".")) {
            newString += ch;
        }
    }
    if (checkString != newString)
		return false;
	 else
	   return true;
}
//
//////////////////////////////////
//
function errorAlert(element, message){
	element.focus();
	element.style.backgroundColor='#ffefef';
	alert(message);
	return false;
}
/////////////////////////////////
//
