// JavaScript Document
function setCookieMyWsm(name, value, expires, path, domain, secure) 
{  	
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");		
}

function getCookie(name)
{
	if (document.cookie.length>0)
  	{
  		c_start=document.cookie.indexOf(name + "=");
  		if (c_start!=-1)
    	{
		    c_start=c_start + name.length+1;
		    c_end=document.cookie.indexOf(";",c_start);
		    if (c_end==-1) c_end=document.cookie.length;
			    return unescape(document.cookie.substring(c_start,c_end));
	    }
  	}
	return "";
}

function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

function trim(str)
{
	return str.replace(/^\s+|\s+$/g,'');
}

function isEmpty(formElement, message) {
	
	formElement.value = trim(formElement.value);
	
	_isEmpty = false;
	if (formElement.value == '') {
		_isEmpty = true;
		alert(message);
		formElement.focus();
	}
	else
	{
		var objRegExp = new RegExp(/^\s+$/);
		if(formElement.value.match(objRegExp))
		{
			_isEmpty = true;
			alert(message);
			formElement.focus();
		}
	}
	
	return _isEmpty;
}
