// Webs Unlimited's JMoves Expression Web Designer JavaScript Generator version 5.0
// Copyright Webs Unlimited 1998 - 2006 All rights reserved
// This code is the property of Webs Unlimited, Inc.http://www.websunlimited.com
// It may not be used without explicit licensing
function MakeArray(n) {this.length = n;for (var i = 1; i <= n; i++) {this[i] = null;}return this;}
function IsIn(value,search) {if(search.indexOf(value) != -1) {return 1;} else {return 0;}}
function getCookieVal (offset) {var endstr = document.cookie.indexOf (";", offset);if (endstr == -1)endstr = document.cookie.length;return unescape(document.cookie.substring(offset, endstr));}
function GetCookie (name) {var argv = GetCookie.arguments;var argc = GetCookie.arguments.length;var defaultvalue = (argc > 1) ? argv[1] : null;var arg = name + "=";var alen = arg.length;var cookievalue;var clen = document.cookie.length;var i = 0;while (i < clen) {var j = i + alen;if (document.cookie.substring(i, j) == arg){cookievalue = getCookieVal(j);if(cookievalue == 'null') return defaultvalue;return getCookieVal (j);}i = document.cookie.indexOf(" ", i) + 1;if (i == 0) break;}return defaultvalue;}
function SetCookie (name, value) {var argv = SetCookie.arguments;var argc = SetCookie.arguments.length;var expires = (argc > 2) ? argv[2] : null;var path = (argc > 3) ? argv[3] : null;var domain = (argc > 4) ? argv[4] : null;var secure = (argc > 5) ? argv[5] : false;document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain)) +((secure == true) ? "; secure" : "");}
function DeleteCookie (name) {var argv = DeleteCookie.arguments;var argc = DeleteCookie.arguments.length;expires = new Date;expires.setTime(expires.getTime() - 48 * 60 * 60 * 1000);var path = (argc > 1) ? argv[1] : '/';var domain = (argc > 2) ? argv[2] : null;var secure = (argc > 3) ? argv[3] : false;document.cookie = name + "=;" +((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain)) +((secure == true) ? "; secure" : "");}
function CookiesEnabled(URL) {if(navigator.cookieEnabled) {window.location = URL;}}
function CookieExpiration(key,expiration) {var expdate = new Date;expdate.setTime (expdate.getTime() + eval(expiration));if((sValue = GetCookie('ddd')) != null )SetCookie(key,sValue,expdate,'/');}
function CookieCount(key,value,expiration) {var expdate = new Date;expdate.setTime (expdate.getTime() + eval(expiration));var currentvalue = parseInt(GetCookie(key));if(!isNaN(currentvalue)) value += currentvalue;SetCookie(key,value,expdate,'/');}
function CookieRedirect(key,URL,test) {var sDefault = 'NotFound';var sValue = GetCookie(key,sDefault);if (test == '!=' ) {if(sValue !=  sDefault)window.location = URL;} else {if(sValue == sDefault)window.location = URL;}}
function CookieMsg(key,sPrompt,novalue,type) {var sValue = GetCookie(key,novalue);pos = sPrompt.indexOf('%V');if(pos != -1) {sMessage = sPrompt.substring(0,pos);sMessage += sValue;sMessage += sPrompt.substring(pos+2,sPrompt.length);} else sMessage = sPrompt;switch(type) {case 0:document.CookieMsgValue = prompt(sMessage ,novalue);break;case 1:alert(sMessage);break;case 2:document.CookieMsgValue = confirm(sMessage);break;}}
function DateFormatCookie(format,twoplace) { var operators = 'HIMSpdDmMyY%';var value = '';var today = new Date;var datevalue = '';weekday = today.getDay();month = today.getMonth();year=today.getYear();if(year > 1900) year -= 1900;date = today.getDate();var days = new MakeArray(7);days[0] = 'Sunday';days[1] = 'Monday';days[2] = 'Tuesday';days[3] = 'Wednesday';days[4] = 'Thursday';days[5] = 'Friday';days[6] = 'Saturday';var months = new MakeArray(12);months[0] = 'January';months[1] = 'February';months[2] = 'March';months[3] = 'April';months[4] = 'May';months[5] = 'June';months[6] = 'July';months[7] = 'August';months[8] = 'September';months[9] = 'October';months[10] = 'November';months[11] = 'December';hours = today.getHours();minutes = today.getMinutes();seconds =today.getSeconds();var pos = 0;while (pos < format.length) {if( format.substring(pos,pos+1) != '%'){datevalue += format.substring(pos,pos+1);pos++;continue;} else {if (!IsIn(format.substring(pos,pos+1), operators)){datevalue += format.substring(pos,pos+1);pos++;continue;} else {if ( format.substring(pos,pos+1) == '%'){pos++;if (format.substring(pos,pos+1) == '%'){datevalue += '%';pos++;continue;} else {if (format.substring(pos,pos+1) == 'd'){if(twoplace) if(date < 10) datevalue += '0';datevalue += date;pos++;continue;} else {if (format.substring(pos,pos+1) == 'A'){datevalue += days[weekday];pos++;continue;} else {if (format.substring(pos,pos+1) == 'a'){datevalue += days[weekday].substring(0,3);pos++;continue;} else {if (format.substring(pos,pos+1) == 'm'){if(twoplace) if(month+1 < 10) datevalue += '0';datevalue += month+1;pos++;continue;} else {if (format.substring(pos,pos+1) == 'B'){datevalue += months[month];pos++;continue;} else {if (format.substring(pos,pos+1) == 'b'){datevalue += months[month].substring(0,3);pos++;continue;} else {if (format.substring(pos,pos+1) == 'y'){if(year < 100) {datevalue += year;} else {year -= 100;if(twoplace) if(year < 10) datevalue += '0';datevalue += year;}pos++;continue;} else {if (format.substring(pos,pos+1) == 'Y'){datevalue += 1900 + year;pos++;continue;} else {if (format.substring(pos,pos+1) == 'H'){if(twoplace) if(hours < 10) datevalue += '0';datevalue += hours;pos++;continue;} else {if (format.substring(pos,pos+1) == 'M'){if(twoplace) if(minutes < 10) datevalue += '0';datevalue += minutes;pos++;continue;} else {if (format.substring(pos,pos+1) == 'I'){var newhours = hours;if(hours > 12) newhours = hours - 12;datevalue += newhours;pos++;continue;} else {if (format.substring(pos,pos+1) == 'S'){if(twoplace) if(seconds < 10) datevalue += '0';datevalue += seconds;pos++;continue;} else {if (format.substring(pos,pos+1) == 'p'){if (hours < 12)datevalue += 'am';elsedatevalue += 'pm';pos++;continue;}pos++;}} } } } } } } } } } } } } } } } return datevalue}