﻿// JScript File
var globalJsUserTime;
var globalJsUserTimeMinusOne;
function DayPageFormat(dayArg)
{
    document.calendarDayForm.SelDate.value = dayArg;
    document.calendarDayForm.submit();
}

function IsEmpty(textField,msg){
	var strValue=textField.value;
	for (var i = 0; i < strValue.length; i++)
	{
	var c = strValue.charAt(i);
	if ((c != ' ') && (c != '\n') && (c != '\t'))
	return false;
	}
	alert (msg);
	textField.focus();
	textField.select();
	return true;
}

function IsNotMaxLength(textField,maxlen,msg) {
  var strValue=textField.value;
  if (strValue.length < maxlen) {
    alert (msg);
    textField.focus();
	textField.select();
    return true;
  }
  return false;
}

function IsNotSelected(textField,msg) {
  if (textField.options[0].selected) {
    alert (msg);
    textField.focus();
    return true;
  }
  return false;
}

function IsNotNumber(textField,msg) {
  var digits = "0123456789";
  for (i=0; i<=textField.value.length; i++) {
     if (digits.indexOf(textField.value.charAt(i))== -1)
      {
       alert (msg);
       textField.focus();
       textField.select(); 
       return true;
     } 
  } 
  return false;
}

function IsChecked(textField,msg) {

  if (!textField.checked) 
  {
    alert (msg);
    textField.focus();
    return true;
  }
  return false;
}


function IsEmail(textField)
{
  
    if (textField.value.indexOf('@',0)!=-1)
    {
            var count=0;
            for(i=0;i<textField.value.length;i++)
            {
              if(textField.value.charAt(i) == '@')
              count++;
            }
            if(count>1)
            {
            alert('EMail addresses can only have 1 "@"')  
            textField.focus();
            textField.select(); 
            return true;
            } 
    }          
    
    
   	if (textField.value.indexOf('@',0)==-1 || textField.value.indexOf('.',0)==-1)
        {
            alert('Invalid E-Mail address.')
            textField.focus();
            textField.select(); 
           return true;
        }
    if (textField.value.toLowerCase().indexOf('www.',0) != -1)
	    {
			alert('Email addresses do not contain "www.". Please remove this and resubmit.');
            textField.focus();
            textField.select(); 
            return true;
	    }  
	
	 if (textField.value.indexOf("'",0)!= -1 )
        {
            alert("\nPlease do not enter a ( ' ) in your userid")
            textField.focus()
            return true;
        } 
        
	 return false;   
}


function validate_search(regionid,statename)
{
    pathurl = 'http://www.Sublet.com/Spider/Lesearch.asp?Country='+regionid+'&State='+statename;
    window.open(pathurl);
    return false;
}
//select navigation dropdown and click the go button it will reditrect to particular  reminder page
//this dropdown will appear in all pages
function remindernavigator()
{
ddlNavigator = document.aspnetForm['MP1_ContentPlaceHolder1_Side_navigaton1_ddlNaviagtor'];
location.href=ddlNavigator.value;
    return false;
}

function changeCellBG(t)
{
    document.getElementById(t).style.backgroundColor = '#f6f6f6';
}
function undoCellBG(t)
{
    document.getElementById(t).style.backgroundColor = '#ffffff';
}
function changeSideBarStatus()
{
    //document.getElementById('divSideBar').style.display = document.getElementById('divSideBar').style.display == 'block'?'none':'block';
    //document.getElementById('tdSideBar').style.width = document.getElementById('tdSideBar').style.width == '166px'?'1px':'166px;'
    slideContent();
    document.getElementById('imgSideBarControllar').src =  "../images/sidebaron.gif";
    document.getElementById('hlnkSideBarControllar').href =  "javascript:undoSideBarStatus();";
}
var width = 0;
function slideContent()
{
    var obj = document.getElementById('divSideBar');
    if(width == 0)
        width = obj.offsetWidth;
    width = width - 50;
    if(width < 0)
        width = 0;
    obj.style.width = width + 'px';
    if(width > 0)
    {
        //obj.style.display = 'none';
	    setTimeout('slideContent()',10);
	    //obj.style.display = 'block';
	    }
	else
	{
	    obj.style.display = 'none';
	    }
}
function undoSideBarStatus()
{
    var obj = document.getElementById('divSideBar');
    if(width == 0)
        width = obj.offsetWidth;
    width = width + 50;
    if(width > 186)
        width = 186;
    obj.style.width = width + 'px';
    if(width < 186)
    {
        obj.style.display = 'none';
	    setTimeout('undoSideBarStatus()',10);
	    obj.style.display = 'block';
	    }
	else
	{
	    obj.style.display = 'block';
	    document.getElementById('imgSideBarControllar').src =  "../images/sidebaroff.gif";
        document.getElementById('hlnkSideBarControllar').href =  "javascript:changeSideBarStatus();";
	    }
}
//***************************** By Prog6 ****************************//
function Side_Navigaton()
{
	if(document.getElementById("Select1").value == "AddRmd")
	location.href = "http://www.marktheday.com/mark/addreminder.aspx";
	else if(document.getElementById("Select1").value == "AddApt")
	location.href = "http://www.marktheday.com/mark/addappointment.aspx";
	else if(document.getElementById("Select1").value == "AddHld")
	location.href = "http://www.marktheday.com/mark/addholiday.aspx";
}
//*********************** End **************************************//
