function confirmDelete(the_thing, redirect){
	var txt = "This will delete the " + the_thing + ".\nAre you sure you want to do that?";
	if (confirm(txt)){
		location.replace(redirect);
	}
}

/**
 *
 * @access public
 * @return void
 **/
function deletePatient(id)
{
    var txt = "This will delete the patient and all associated files.\nAre you sure you want to do that?";
    if (IsNumeric(id))
    {
        if (confirm(txt))
        {
            //alert('http://www.ctchelpskids.com/employee/patient_delete/id:' + id);
            location.replace('http://www.ctchelpskids.com/employee/patient_delete/id:' + id);
        }
    }
    return false;
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;

}


var slideShow = {
	init : function() {
		var obj = document.getElementById('banner');
		if (!obj) return;
		var cookie = this.getcookie('slideshow');
		if (!cookie)
        {
		    this.current = 0;
		}
		else
		{
    		this.current = cookie;
		}
		obj.style.backgroundImage = 'url(http://www.ctchelpskids.com/pics/' + this.current + ".jpg)";
		this.setcookie('slideshow', this.current, 1);
	},
	next : function() {
		var obj = document.getElementById('banner');
		if (!obj) return;
		this.current = this.current + 1;
		if (this.current == 20)
        {
		    this.current = 0;
		}
		obj.style.backgroundImage = 'url(http://www.ctchelpskids.com/pics/' + this.current + ".jpg)";
		this.setcookie('slideshow', this.current, 1);
	},
	prev : function() {
		var obj = document.getElementById('banner');
		if (!obj) return;
		this.current = this.current - 1;
		if (this.current < 0)
        {
		    this.current = 19;
		}
		obj.style.backgroundImage = 'url(http://www.ctchelpskids.com/pics/' + this.current + ".jpg)";
		this.setcookie('slideshow', this.current, 1);
	},
	getcookie : function(name) {
		var str = '';
		var tArr = document.cookie.split(';');
		for (var i = 0; i < tArr.length; i++) {
			if (tArr[i].indexOf(name + '=') > -1) {
				str = tArr[i].substring((tArr[i].indexOf('=') + 1), tArr[i].length);
			}
		}
		if (str == '') {
			str = '0';
		}
		return parseInt(str);
	},
	setcookie : function(name, value, days) {
		var expire = new Date();
   		expire.setTime(expire.getTime() + (days * 24 * 3600 * 1000));
		document.cookie = name + '=' + value + '; path=/; expires=' + expire;
	}
}