<!--
function addJavascript(jsname) {
   var th = document.getElementsByTagName('body')[0];
   var s = document.createElement('script');

   s.setAttribute('type','text/javascript');
   s.setAttribute('src',jsname);
   th.appendChild(s);
}//enfunc

function LoadScript(){
  var source = Array.apply(null, arguments);
  var script = document.createElement('script');

  script.setAttribute('src', source.shift());
  script.setAttribute('type', 'text/javascript');
  document.getElementsByTagName('head')[0].appendChild(script);

  if(source.length)arguments.callee.apply(null, source);
}//function to load script

function urlencode( str ) {
    var histogram = {}, unicodeStr='', hexEscStr='';
    var ret = (str+'').toString();

    var replacer = function(search, replace, str) {
        var tmp_arr = [];
        tmp_arr = str.split(search);
        return tmp_arr.join(replace);
    };

    // The histogram is identical to the one in urldecode.
    histogram["'"]   = '%27';
    histogram['(']   = '%28';
    histogram[')']   = '%29';
    histogram['*']   = '%2A';
    histogram['~']   = '%7E';
    histogram['!']   = '%21';
    histogram['%20'] = '+';
    histogram['\u00DC'] = '%DC';
    histogram['\u00FC'] = '%FC';
    histogram['\u00C4'] = '%D4';
    histogram['\u00E4'] = '%E4';
    histogram['\u00D6'] = '%D6';
    histogram['\u00F6'] = '%F6';
    histogram['\u00DF'] = '%DF';
    histogram['\u20AC'] = '%80';
    histogram['\u0081'] = '%81';
    histogram['\u201A'] = '%82';
    histogram['\u0192'] = '%83';
    histogram['\u201E'] = '%84';
    histogram['\u2026'] = '%85';
    histogram['\u2020'] = '%86';
    histogram['\u2021'] = '%87';
    histogram['\u02C6'] = '%88';
    histogram['\u2030'] = '%89';
    histogram['\u0160'] = '%8A';
    histogram['\u2039'] = '%8B';
    histogram['\u0152'] = '%8C';
    histogram['\u008D'] = '%8D';
    histogram['\u017D'] = '%8E';
    histogram['\u008F'] = '%8F';
    histogram['\u0090'] = '%90';
    histogram['\u2018'] = '%91';
    histogram['\u2019'] = '%92';
    histogram['\u201C'] = '%93';
    histogram['\u201D'] = '%94';
    histogram['\u2022'] = '%95';
    histogram['\u2013'] = '%96';
    histogram['\u2014'] = '%97';
    histogram['\u02DC'] = '%98';
    histogram['\u2122'] = '%99';
    histogram['\u0161'] = '%9A';
    histogram['\u203A'] = '%9B';
    histogram['\u0153'] = '%9C';
    histogram['\u009D'] = '%9D';
    histogram['\u017E'] = '%9E';
    histogram['\u0178'] = '%9F';

    // Begin with encodeURIComponent, which most resembles PHP's encoding functions
    ret = encodeURIComponent(ret);

    for (unicodeStr in histogram) {
        hexEscStr = histogram[unicodeStr];
        ret = replacer(unicodeStr, hexEscStr, ret); // Custom replace. No regexing
    }

    // Uppercase for full PHP compatibility
    return ret.replace(/(\%([a-z0-9]{2}))/g, function(full, m1, m2) {
        return "%"+m2.toUpperCase();
    });
}//end function url encode
function printing() {
   document.getElementById('prt_id').style.visibility = 'visible';
   document.getElementById('prt_id').style.display = '';
   document.getElementById('body').style.visibility = 'hidden';
   window.print();
   document.getElementById('body').style.visibility = '';
   //document.getElementById('prt_id').style.visibility = 'hidden';
   //document.getElementById('prt_id').style.display = 'none';
}

//----------------------------------End edit----------------------------------------//
  
function openWin(winURL,winWidth,winHeight,winName) { 
     var leftPos  =  (screen.width-winWidth)/2;
     var topPos   =  (screen.height-winHeight)/2;
     window.open(winURL,winName,'width='+winWidth+',height='+winHeight+',left='+leftPos+',top='+topPos+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0') ; 
}// open a new window

function pop_win(winURL,winName,winWidth,winHeight,sb,rs) { 
   var leftPos =  (screen.width-winWidth)/2;
   var topPos  =  (screen.height-winHeight)/2;
     window.open(winURL,winName,'width='+winWidth+',height='+winHeight+',left='+leftPos+',top='+topPos+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars='+sb+',resizable='+rs) ; 
}// pop up window
  
function isValidEmail(email) {
var error = 0;
     AtPos = email.indexOf("@")
     StopPos = email.lastIndexOf(".")
     if (email == "") {
             error = 1;
     }
     if (AtPos == -1 || StopPos == -1) {
             error = 1;
     }
     if (StopPos < AtPos) {
             error = 1;
     }
     if (StopPos - AtPos == 1) {
             error = 1;
     }
     if (error == 1) {return false;} else {return true;}
} // email chking function called

function checkEmail(email) {
var str = "";
     if (document.getElementById(email).value=='') return str;
     if (!isValidEmail(document.getElementById(email).value)) {
        str = str + 'Invalid email address supplied for '+ email+'<br/> \r\n';
     }
     return str;
}// chk if it is a valid email and calls the funstion to chk if it is an email

function check_number(field,name) {
   var msg  = '';
   var str  = field.value.replace(' ','');
   var find = str.search('[^0-9\,\.\t\s\d]');
   if (field.value.length > 0 && find >=0){
      msg = "please enter a numeric value for the flield "+name+"\r\n";
   }//endif   
   return msg;
}//endfunc
//empty field check
function required(formobj,array_name, array_name_desc) {
   // Enter name of mandatory fields
   var fieldRequired = array_name;
   // Enter field description to appear in the dialog box
   var fieldDescription = array_name_desc;
   // dialog message
   var alertMsg = "Please complete the following fields:<br/> \r\n";
   
   var l_Msg = alertMsg.length;
   
   for (var i = 0; i < fieldRequired.length; i++){
      //alert(fieldRequired[i]);
      //var obj = formobj.elements[fieldRequired[i]];
      var obj = document.getElementById(fieldRequired[i]);
      if (obj){
         switch(obj.type){
         case "select-one":
            if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
               alertMsg += " - " + fieldDescription[i] + "<br/>  \r\n";
            }//endif
            break;
         case "select-multiple":
            if (obj.selectedIndex == -1){
               alertMsg += " - " + fieldDescription[i] + "<br/> \r\n";
            }//endif
            break;
         case "text":
         case "textarea":
            if (obj.value == "" || obj.value == null){
               alertMsg += " - " + fieldDescription[i] + "<br/> \r\n";
            }//endif
            break;
         default:
         }//endSwitch
         if (obj.type == undefined){
            var blnchecked = false;
            for (var j = 0; j < obj.length; j++){
               if (obj[j].checked){
                  blnchecked = true;
               }//endif
            }//endofor
            if (!blnchecked){
               alertMsg += " - " + fieldDescription[i] + "\<br/> \r\n ";
            }//endif
         }//endif
      }//endif obj
   }//endfor

   if (alertMsg.length == l_Msg){
      return '';
   }else{      
      return alertMsg;
   }
}//end function

function default_value(field,deflt) {
 
 var f_name = typeof(f_name)=='string'?document.getElementById(f_name):f_name;
 if (!isset(deflt)) deflt = f_name.defaultValue;
   if (deflt==f_name.value) {
      f_name.value='';
      f_name.focus();
      //f_name.className='myfont';
      f_name.style.color = '#666666';
   }
}
//min char
function checkLength(name,leng, defl) {
   var field = document.getElementById(name);
   var msg = '';
   if (field.value.length < leng || field.value == defl ) {
      msg = 'Please enter at least '+leng+' character for the field '+name+'<br/>  \r\n';
   }//end if
   return msg;
}//end function

// Checks for password corectness
function checkPw(name, valueChk) {
   var pw1 = document.getElementById(name).value;   
   var msg = '';

   if (isset(valueChk)) pw2 = valueChk;
   else var pw2 = document.getElementById('passConfirm').value;
   if (pw1 != pw2) {
      msg   = "Please re-enter your "+name+". \r\n";
   }
   return msg;
}//end function

// Submit count, check that only one is submited
var submitcount=0;
function submitChk(){
   if (submitcount == 0)      {
         submitcount++;
         return '';
      } else {
         return "This form has already been submitted.  Thanks!<br/> \r\n";
         
      }
}//end function

function submitForm(elementId, browser, frm) {

   if(browser=='IE') document.forms[elementId].submit();
   else document.getElementById(elementId).submit();

}
   function limit_count(set, count){
      var text = set.value;
      if (text.length >= count){
         set.value = set.value.substr(0,count);
         $('debug').update("<img src='http://budget.dev.co.za/images/thinking.gif' />You have reach the character limit for the category name");
         setTimeout(function(){$('debug').update()}, 2000);
      }//endif
   }//end funct
//---------------------------------AUTOMATIC GO TO JUMP MENU ---------------------------------------//

function isset() {    
    var a=arguments;var l=a.length;var i=0;
    
    if (l==0) { 
        throw new Error('Empty isset'); 
    }//end if
    
    while (i!=l) {
        if (typeof(a[i])=='undefined' || a[i]===null) { 
            return false; 
        } else { 
            i++; 
        }//endif
    }
    return true;
}//end function

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {
   var x = Math.round(num * Math.pow(10,dec));
   if (x >= 0) n1=n2='';
   var y = (''+Math.abs(x)).split('');
   var z = y.length - dec;if (z<0) z--; 
   for(var i = z; i < 0; i++) y.unshift('0'); 
   if (z<0) z = 1; 
   y.splice(z, 0, pnt); 
   if(y[0] == pnt) y.unshift('0'); 
   while (z > 3) {z-=3;y.splice(z,0,thou);}
   var r = curr1+n1+y.join('')+n2+curr2;
   return r;
   //formatNumber(mynum,2,' ','.','','','-','');   formatNumber(trsf,2,',','.','R ','','-','CR')
}

function creatField(id, type, js){
   field = document.createElement('input');
   field.value = '';
   field.id    = id;
   field.type  = type;
   field.name  = id;
   field.onblur= 'this.select()';
   field.onfocus= js;
   //field.size  = '';
   document.getElementById('insert_image').appendChild(image);
}

function getHtmlPosition(obj, all,type){
    var topValue= 0,leftValue= 0;
    if (all==true){
       while(obj){
         leftValue+= obj.offsetLeft;
         topValue+= obj.offsetTop;
         obj= obj.offsetParent;
       }
    } else {
       leftValue= obj.offsetLeft;
       topValue = obj.offsetTop;
    }
    if (type=='x') return parseInt(leftValue);
    else return parseInt(topValue);
}

function getElementY(element){

	var targetTop = 0;

	if (element.offsetParent) {
		while (element.offsetParent) {
			targetTop += element.offsetTop;
			element = element.offsetParent;
		}
	} else if (element.y) {
		targetTop += element.y;
	}
	return targetTop;
}

function add_body_load(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
} //end func add multiple function to loadon body load
//==========================================get mouse position=========================================//
function startPosition(set){

   if(set){
      if (!$(set).all) $(set).captureEvents(Event.MOUSEMOVE)
      $(set).onmousemove = getPosition2;
   }else{
      if (!document.all) document.captureEvents(Event.MOUSEMOVE)
      document.onmousemove = getPosition;
   }
   

}
var X = 0;
var Y = 0;

function getPosition(args) {
  // Gets IE browser position


  if (document.all)   {
    X = event.clientX + document.body.scrollLeft
    Y = event.clientY + document.body.scrollTop
  }
  // Gets position for other browsers
  else
  {
    X = args.pageX
    Y = args.pageY
  } 
}
//disable background
function divDisplay(divName, setPosition, option, x, y) {
   var div = $(divName);
   if(!isset(x)) x=0;if(!isset(y)) y=0;
   if(div.style.display== '' && div.offsetWidth != undefined && div.offsetHeight != undefined) {

        div.style.display = (div.offsetWidth!=0 && div.offsetHeight!=0)?'block':'none';
    }
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block';
    if (option) div.style.display = option;
    
    if (setPosition==true){
       div.style.left = X+x+'px';
       div.style.top  = Y+y+'px';
    }
    if (setPosition=='custom'){
       div.style.left = x+'px';
       div.style.top  = y+'px';
    }
//div.style.display='block';
}
function popUp(divName) {
    var div = $(divName);

    // if the style.display value is blank we try to check it out here

    if(div.style.display== '' && div.offsetWidth != undefined && div.offsetHeight != undefined) {

        div.style.display = (div.offsetWidth!=0 && elem.offsetHeight!=0)?'block':'none';

    }
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block';

    X = X + 15;
    div.style.left = X+'px';
    div.style.top = Y+'px'; 
}
function callPopOut(h,w,t,l){
   //document.body.style.overflow = 'hidden';
   divDisplay('div_background');
   divDisplay('div_pop');

   $('div_background').style.height = document.body.clientHeight;
   $('div_background').style.width  = document.body.clientWidth;

   if (!h) h = '680px';
   if (!w) w = '550px';
   if (!t) t = '2%';
   if (!l) l = (parseFloat(document.body.clientWidth) / 2) - (400 / 2)+'px';

   $('div_pop').style.height  = h;
   $('div_pop').style.width   = w;
   $('div_pop').style.top     = t;
   $('div_pop').style.left    = l;
}//endfunction

function getElementsByClassName2(className, tag){
   var classNameArray = [];alert('one');

        tag = document.getElementsByTagName(tag);
        L   = tag.length;
        while(L){
            temp = tag[--L];
            if(temp.className.indexOf(className)!=-1) classNameArray.push(temp);
        }

    return classNameArray;
}//endfunction

function preloadImages() { //v3.0
   var doc=document;
   if(doc.images){

      if(!doc.preload_image_object) doc.preload_image_object=new Array();

      var i,j=doc.preload_image_object.length,url=preloadImages.arguments;
      
      for(i=0; i<url.length; i++){
         if (url[i].indexOf("#")!=0){
            doc.preload_image_object[j]=new Image;
            doc.preload_image_object[j++].src=url[i];//alert(url[i]);
         }
      }
   }
}

//=====================================AJAX===========================================================//

function menu(page,path) {
   if (!path) path      = 'modules/';
   if (path==2) path      = 'program/';
   requestAjax('content_div',path+page+'.php');
}//endfunc

function auto_update(required, form, path, option, params) {
   var err        = 0;   
   if (!isset(option))option='transaction';   
   if (form!=''){
      var inputForm  = $(form);
      var trans      = $(option);
   }//endif
   
   for (x=0; x<required.length; x++) {
      if(!isset($F(required[x]) ) || $F(required[x])=='' ) err++;
   }//end for
   if (err==0) {
      if(form!=''){
         postAjax(path, '', form);
         //$('debug').setStyle({display: 'block'});
         //requestAjax('debug', path, '', form);
      }
      else postAjax(path, params);      
      
      if(form!='') {
         if(trans.value=='insert') {
            trans.value = 'update';
         }//endif
      }//endif
   }//endif
}//endfunction

function auto_update2(form, path, required, params) {
   var err        = 0;

   for (x=0; x<required.length; x++) {
      if(!isset($F(required[x]) ) || $F(required[x])=='' ) err++;
   }//end for
   //alert('path='+path+' form='+form+' err='+err+' params'+params);
   if (err==0) {
      if(form!=''){
         postAjax(path, '', form);
         //$('debug').setStyle({display: 'block'});
         //requestAjax('debug', path, '', form);
      }
      else {
         postAjax(path, params);
         //$('debug').setStyle({display: 'block'});
         //requestAjax('debug', path, params);
      }
      
   }//endif
}//endfunction

function detectBrowser(){
   var browser = '';
   browser = navigator.appVersion;
   if (browser.indexOf('MSIE 8') != -1) return 'IE8';
   if (browser.indexOf('MSIE') != -1) return 'IE';
}

//=====================================AJAX===========================================================//
//=============================script for date function===============================================//
   var currentDate = new Date();
   var today   = currentDate.getDay();
   var thisyr  = currentDate.getFullYear();
   
   function jsDelAll(dayID) {

      var dayObj = document.getElementById(dayID);
      var ngLen = dayObj.options.length;

      for (x = ngLen; x >= 0; x--) {
          dayObj.options[x] = null;
      }//next x

      dayObj.options.lenth = 0;
   }//end function

   function createDays(max, dayID) {

      var dayObj = document.getElementById(dayID);

      jsDelAll(dayID);

      for (x = 1; x <= max; x++) {

          dayObj.options[x - 1] = new Option(x, x);

      }//next x
   }//end function

   function updateDays(monID, dayID) {

      var monObj = document.getElementById('month_'+monID);
      var selMon = monObj.value;

      
      if (selMon == 1 || selMon == 3 || selMon == 5 || selMon == 7 || selMon == 8 || selMon == 10 || selMon == 12) {
         createDays(31, dayID);
      } else if (selMon == 4 || selMon == 6 || selMon == 9 || selMon == 11) {
         createDays(30, dayID);
      } else if (selMon == 2) {
         if (thisyr == 2004 || thisyr == 2008 || thisyr == 2012) {
            createDays(29, dayID);
         } else {
            createDays(28, dayID);
         }//end if
      }//end if
      setHiddenDate(monID);
   }//end function

   function setHiddenDate(selName,time){ 
      var year       = document.getElementById('year_'+selName).value;
      var month      = document.getElementById('month_'+selName).value;
      var day        = document.getElementById('day_'+selName).value;
      var dateChosen = year+'-'+month+'-'+day
      try {
         var hour    = document.getElementById('hour_'+selName).value;
         var minute  = document.getElementById('minute_'+selName).value;
         dateChosen  = dateChosen+' '+hour+':'+minute;
      } catch (err){alert(err);}
      document.getElementById(selName).value = dateChosen;

   }//end function sethideendate

get_time = function(name, set) {
	father	= name.parentNode;
	child		= father.childNodes;
	var field,x,h,m,t;

	for(x=0; x<child.length;x++){
		field = child[x];
		if(field.id == set+'_hours')	h = field.value;
		if(field.id == set+'_min')		m = field.value;
		if(field.id == set)				t = field;
	};
	t.value = h +':'+m;
}//end function
//==============================================================================//
   function disableEnterKey(k) {
        var key;
        if(window.event)
             key = window.event.keyCode; //IE
        else
             key = k.which; //firefox

        return (key != 13);
   }

   function validColour(hexcolor) {
      var strPattern = /^#?([0-9a-f]{1,2}){3}$/i;
      if (strPattern.test(hexcolor)) return true;
      else return false
   }

function closeWin() {
   if(navigator.appName=="Microsoft Internet Explorer") {
      window.parent.window.opener=null;
      window.parent.window.close();
   } else if(navigator.appName=="Netscape") {
      top.window.opener = top;
      top.window.open('','_parent','');
      top.window.close();
   }
}

//================================reference function=============================//

function get_form(sel){
	var parent = sel.parentNode;
	while (parent.tagName != 'FORM') {
		parent = parent.parentNode;
	}//endif
	return parent;
}//endif

var pass = false;
enable_fields = function (sel){
	var form = get_form(sel);
      var browse = detectBrowser();
	var value= sel.value;
	var pass2=true;
	
	if(value.length<3){ 
         if (browse!='IE' && browse!='IE8') {
            form.getElements().each(function(set){
               if(set.type!='hidden' && set.disabled == false) {
                  if( set.value && set.value!='Auto-complete field' && pass2) pass=true;
                  if( pass2 && (!set.value || set.value=='Auto-complete field' ) ) {pass=false;pass2=false};
                  //alert('id='+set.id+' value='+set.value+' tag='+set.tagName+' disabled='+set.disabled+' pass='+pass+' type='+set.type);
               }
            });
         } else {
            for( var i = 0; i < form.elements.length; i++ ) {
               set = form.elements[i];
               if(set.type!='hidden' && set.disabled == false) {                  
                  if(set.value && set.value!='Auto-complete field' && pass2) pass=true;
                  if(pass2 && (!set.value || set.value=='Auto-complete field' ) ) {pass=false;pass2=false};
                  //alert('id='+set.id+' value='+set.value+' tag='+set.tagName+' disabled='+set.disabled+' pass='+pass+' type='+set.type);
               }
            }//endif
         }//endif
         if(pass) {
            if (browse!='IE' && browse!='IE8') form.enable();
            else {
               for( var i = 0; i < form.elements.length; i++ ) {
                  set = form.elements[i];
                  set.disabled = false
               }//endif
            }//endif
         }//endif
	}//endif
      //if(value.length==4)alert('and='+pass);
}//endfunc

enable_fields2 = function (sel){
	var form = get_form(sel);
      var browse = detectBrowser();
	var value= sel.value;
	var pass2=true;

      if (browse!='IE' && browse!='IE8') {
            form.getElements().each(function(set){
               if(set.type!='hidden' && set.disabled == false && set.value && set.value!='Auto-complete field' && pass2) pass=true;
               if(set.type!='hidden' && set.disabled == false && pass2 && (!set.value || set.value=='Auto-complete field' ) ) {pass=false;pass2=false};
               //alert('id='+set.id+' value='+set.value+' tag='+set.tagName+' disabled='+set.disabled+' pass='+pass+' type='+set.type)
            });
      } else {
         for( var i = 0; i < form.elements.length; i++ ) {
               set = form.elements[i];
               if(set.type!='hidden' && set.disabled == false && set.value && set.value!='Auto-complete field' && pass2) pass=true;
               if(set.type!='hidden' && set.disabled == false && pass2 && (!set.value || set.value=='Auto-complete field' ) ) {pass=false;pass2=false};
               //alert('id='+set.id+' value='+set.value+' tag='+set.tagName+' disabled='+set.disabled+' pass='+pass+' type='+set.type)
         }
      }
      //if(value.length==4)alert('and='+pass);
}//endfunc


function publishToFB(url) {
   var attachment = {
     'name':'Logical Toys',
     'href': url,
     'caption':'{*actor*} is viewing Logical Toys!',
     'media':[{
       'type':'image',
       'src':'http://toylogic.dev.co.za/images/logo.jpg',
       'href':url
     }]};

   var action_links = [{'text':'Match Friends','href':'http://apps.facebook.com/toylogic'}];

 FB_RequireFeatures(["Connect"], function() {
   FB.init('ffb8019420346adeaccbf86d74db9569', 'http://toylogic.dev.co.za/html/xd_receiver.html');
   FB.ensureInit(function() {
     FB.Connect.streamPublish('',attachment, action_links);
   });
 });
}

Date.prototype.format = function(format) {
	var returnStr = '';
	var replace = Date.replaceChars;
	for (var i = 0; i < format.length; i++) {
		var curChar = format.charAt(i);
		if (replace[curChar]) {
			returnStr += replace[curChar].call(this);
		} else {
			returnStr += curChar;
		}
	}
	return returnStr;
};
Date.replaceChars = {
	shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
	longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
	shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
	longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],

	// Day
	d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
	D: function() { return Date.replaceChars.shortDays[this.getDay()]; },
	j: function() { return this.getDate(); },
	l: function() { return Date.replaceChars.longDays[this.getDay()]; },
	N: function() { return this.getDay() + 1; },
	S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
	w: function() { return this.getDay(); },
	z: function() { return "Not Yet Supported"; },
	// Week
	W: function() { return "Not Yet Supported"; },
	// Month
	F: function() { return Date.replaceChars.longMonths[this.getMonth()]; },
	m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); },
	M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; },
	n: function() { return this.getMonth() + 1; },
	t: function() { return "Not Yet Supported"; },
	// Year
	L: function() { return (((this.getFullYear()%4==0)&&(this.getFullYear()%100 != 0)) || (this.getFullYear()%400==0)) ? '1' : '0'; },
	o: function() { return "Not Supported"; },
	Y: function() { return this.getFullYear(); },
	y: function() { return ('' + this.getFullYear()).substr(2); },
	// Time
	a: function() { return this.getHours() < 12 ? 'am' : 'pm'; },
	A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; },
	B: function() { return "Not Yet Supported"; },
	g: function() { return this.getHours() % 12 || 12; },
	G: function() { return this.getHours(); },
	h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); },
	H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
	i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
	s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
	// Timezone
	e: function() { return "Not Yet Supported"; },
	I: function() { return "Not Supported"; },
	O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; },
	P: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':' + (Math.abs(this.getTimezoneOffset() % 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() % 60)); },
	T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;},
	Z: function() { return -this.getTimezoneOffset() * 60; },
	// Full Date/Time
	c: function() { return this.format("Y-m-d") + "T" + this.format("H:i:sP"); },
	r: function() { return this.toString(); },
	U: function() { return this.getTime() / 1000; }
};
