utils = {
    isEmail: function(item)
    {
        var at="@";
        var dot=".";
        var lat=item.indexOf(at);
        var litem=item.length;
        var ldot=item.indexOf(dot);

           var regx= new RegExp ("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[-0-9a-z_^\\.]+\\.[a-z]{2,6}$", 'i');
           if (!regx.test(item)) {
                   return false;
           }
        if (item.indexOf(at)==-1) return false;
        if (item.indexOf(at)==-1 || item.indexOf(at)==0 || item.indexOf(at)==litem) return false;
        if (item.indexOf(dot)==-1 || item.indexOf(dot)==0 || item.indexOf(dot) >= litem - 2) return false;
        if (item.indexOf(at,(lat+1))!=-1) return false;
        if (item.substring(lat-1,lat)==dot || item.substring(lat+1,lat+2)==dot) return false;
        if (item.indexOf(dot,(lat+2))==-1) return false;
        if (item.indexOf(" ")!=-1)  return false;

        return true;
    }
}

function Flash () {
    this._swf = '';
    this._width = 0;
    this._height = 0;
    this._params = new Array();
}

Flash.prototype.setSWF = function (_swf, _width, _height) {
    this._swf     = _swf;
    this._width     = _width;
    this._height     = _height;
}

Flash.prototype.setParam = function (paramName, paramValue) {
    this._params[this._params.length] = paramName+'|||'+paramValue;
}

Flash.prototype.display = function () {
    var _txt = '';
    var params = '';
    _txt += '<object >\n';
    _txt += '<param width="'+this._width+'" height="'+this._height+'" name="movie" value="'+this._swf+'" />\n'
    _txt += '<param name="quality" value="high" />\n';
    for ( i=0;i<this._params.length;i++ ) {
        _param = this._params[i].split ('|||');
        _txt += '\t<param name="'+_param[0]+'" value="'+_param[1]+'" />\n';
        params += _param[0]+'="'+_param[1]+'" ';
    }

    _txt += '<embed width="'+this._width+'" height="'+this._height+'" src="'+this._swf+'" '+params+' quality="high" type="application/x-shockwave-flash"></embed>';
    _txt += '</object>';
    document.write (_txt);
}

function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}
function getCookie(name) {
    var cookie = " " + document.cookie;
    var search = " " + name + "=";
    var setStr = null;
    var offset = 0;
    var end = 0;
    if (cookie.length > 0) {
        offset = cookie.indexOf(search);
        if (offset != -1) {
            offset += search.length;
            end = cookie.indexOf(";", offset)
            if (end == -1) {
                end = cookie.length;
            }
            setStr = unescape(cookie.substring(offset, end));
        }
    }
    return(setStr);
}
function in_array(needle, haystack, strict) 
{
    var found = false, key, strict = !!strict;
 
    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }        }
 
   return found;
}

