function validateEmail(sEmail)
{
	var sInvalidEmailExp = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/

	if (!isValid(sInvalidEmailExp,sEmail))
	{
		return false
	}
	return true;
}

function disableObjectAndSubmit(obj)
{
    if (eval(obj))
    {
        obj.disabled = true;
        if (eval(obj.form))
            obj.form.submit();
    }
}


function checkDates(value1,value2)
{
    var date1 = new Date(value1);
    var date2 = new Date(value2);

    return date1 - date2;
}

function checkSSN(field,content)
{ 
    
	 if (content.length == field.maxLength)
	  {
		var  next = field.tabIndex;
		
		if (next < document.forms[0].ssn.length)
		{
		  document.forms[0].ssn[next].focus();
		}
		
	 }
	  
}


function validateSSN(ssnValue)
{
    var i = 0;
	var invalidSSNFlag = false;

	while(i<ssnValue.length)
	{
		var digit = ssnValue.charAt(i);
		if(!(digit == '0' || digit == '1' || digit == '2' || digit == '3' || digit == '4' || digit == '5' || digit == '6' || digit == '7' || digit == '8' || digit == '9' ))
		{
			invalidSSNFlag = true;
			break;
		}
		i++;
	}

	return invalidSSNFlag;
}

//added by rishabhj
function getCookie(Name)
{
 var search = Name + "="
 if (document.cookie.length > 0)
 { // if there are any cookies
   offset = document.cookie.indexOf(search)
   if (offset != -1) { // if cookie exists
     offset += search.length
     // set index of beginning of value
     end = document.cookie.indexOf(";", offset)
     // set index of end of cookie value
     if (end == -1)
       end = document.cookie.length
     return unescape(document.cookie.substring(offset, end))
   }
 }
}

//added by rishabhj
function setCookie(name, value, daysExpire) {
 if(daysExpire) {
   var expires = new Date();
   expires.setTime(expires.getTime() + 1000*60*60*24*daysExpire);
 }
 document.cookie = name + "=" + escape(value) + (daysExpire == null ? "" : (";expires=" + expires.toGMTString())) + ";path=/";
}

//added by rishabhj
function openFaqWindow(url) {
	window.open(url,'FAQs','width=800,height=600,resizable=yes,scrollbars=yes')
}

function openTutorialWindow(url) {

	window.open(url,'','scrollbars=yes,resizable=yes,left=10,width=800,height=640,top=5');
}

function MM_openBrWindow(theURL,winName,features)
{ //v2.0
  window.open(theURL,winName,features);
}
