// CodeThatCalendar PRO
// Version: 1.0.1
// IT IS ILLEGAL TO USE UNREGISTERED VERSION OF THE SCRIPT. WE PERFORM
// MONITORING OF THE SITES THAT USE SCRIPT USING GOOGLE AND SPECIAL WORDS
// INCLUDED INTO THE SCRIPT. WE WILL INITIATE LEGAL ACTIONS AGAINST THE
// PARTIES THAT VIOLATE LICENSE AGREEMENT. PLEASE REGISTER THE SCRIPT.
// Copyright (c) 2003 by CodeThat.Com
// http://www.codethat.com/

function UA(){var a=navigator.userAgent.toLowerCase(),b=parseInt(navigator.appVersion);var g=navigator.appName=="Netscape";this.DOM=document.getElementById?true:false;this.opera=a.indexOf('opera')!=-1;this.opera5=a.indexOf("opera 5")>0||a.indexOf("opera/5")>=0;this.opera6=a.indexOf("opera 6")>0||a.indexOf("opera/6")>=0;this.opera7=a.indexOf("opera 7")>0||a.indexOf("opera/7")>=0;this.oldOpera=this.opera5||this.opera6;this.ie3down=a.indexOf('msie')!=-1&&b<4&&!this.opera;this.ie4up=!this.ie3down&&document.all&&document.all.item&&!this.opera;this.ie5up=this.DOM&&this.ie4up;this.ie6=this.ie5up&&a.indexOf('msie 6.')>0;this.ie=this.ie4up||this.ie5up;this.nn4=g&&!this.DOM&&!this.opera;this.moz=this.nn6up=this.DOM&&g&&!this.opera;this.hj=a.indexOf('hotjava')!=-1;this.aol=a.indexOf('aol')!=-1;this.aol4up=this.aol&&this.ie4up;this.supp=this.supported=this.oldOpera||this.opera7||this.ie||this.moz||this.nn4||this.DOM;};var ua=new UA();function CodeThatSetMY(m,y,f){switch(f){case 0:{++m;if(m==12){m=0;y++;}break;}case 1:{--m;if(m==-1){m=11;y--;}break;}case 2:{++y;break;}case 3:{--y;break;}case 4:{break;}}var h=window.opener||window;if(h&&h.codethatcalendar){h.codethatcalendar.date.setYear(y);h.codethatcalendar.date.setMonth(m);}location.reload();};function CodeThatFind(d,f){if(d.getElementById&&d.getElementById(f)!=null){
return d.getElementById(f);}else if(ua.ie4up){
return d.all[f];}else{if(d.forms.item)for(var j=0;d.forms.item(j)!=null;++j){if(d.forms.item(j).namedItem&&d.forms.item(j).namedItem(f))
return d.forms.item(j).namedItem(f);if(d.forms.item(j).elements&&d.forms.item(j).elements[f])
return d.forms.item(j).elements[f];}for(var k in d.forms)if(d.forms[k].elements&&d.forms[k].elements[f])
return d.forms[k].elements[f];}
return null;};function CodeThatAlign(n){
return n<10?("0"+n):(""+n);;};function CodeThatDateFormat(f,d,m,y){var o=f;d=d<10?("0"+d):d;o=o.replace("dd",d);m++;m=m<10?("0"+m):m;o=o.replace("MM",m);o=o.replace("yyyy",y);if(CodeThatFind(document,'time')){var q=CodeThatFind(document,'time').value;var r=parseInt(q.substring(0,2)-0);if(r<0||r>23){r=r%24;r+=(r<0?24:0);}o=o.replace("HH",CodeThatAlign(r));var u=parseInt(q.substring(3,5)-0);if(u<0||u>59){u=u%60;u+=(u<0?60:0);}o=o.replace("mm",CodeThatAlign(u));var x=parseInt(q.substring(6,8)-0);if(x<0||x>59){x=x%60;x+=(x<0?60:0);}o=o.replace("ss",CodeThatAlign(x));}
return o;};function CodeThatSetDay(c,f,d,m,y,i){var z;if(window.opener&&!i)z=window.opener.document;else z=document;var a1=CodeThatFind(z,c);if(a1)a1.value=CodeThatDateFormat(f,d,m,y);if(window.opener&&!i)window.close();};function CodeThatCalendar(def){this.def=def;this.links={};this.styles={};};{var b1=CodeThatCalendar.prototype;b1.getCss=function(key,d){if(this.getStyle())
return "class='"+this.getStyle()+"'";if(!d)d=this.def;if(d[key]){
return "class='"+d[key]+"'";}
return "";};b1.create=function(d,ctl){var c1=false;if(ctl){this.ctl=ctl;window.codethatcalendar=this;c1=true;}this.i=c1;if(!this.date)this.date=window.date||new Date();var d1=this.def;d.write("<table cellspacing=0 cellpadding=0 width="+d1.width+" border="+(d1.border_width||0)+" bordercolor='"+(d1.border_color||'#000000')+"'>");d.write("<tr>");if(c1)this.createButtons(d,c1);else{if(d1.headerstyle.type=="buttons")this.createButtons(d,c1);else if(d1.headerstyle.type=="comboboxes")this.createCombos(d);}d.write("</tr>");var e1=0;d.write("<tr>");this.createWeekdays(d);d.write("</tr>");this.createMonth(d);if(d1.showtime){this.createTime(d);}d.write("</table>");};b1.createTime=function(d){d.write("<tr><td colspan=7 align=center>"+(ua.nn4?"<form>":"")+"<input "+(ua.nn4?"name":"id")+"='time' type=textarea value='"+CodeThatAlign(this.date.getHours())+":"+CodeThatAlign(this.date.getMinutes())+":"+CodeThatAlign(this.date.getSeconds())+"'>"+(ua.nn4?"</form>":"")+"</td></tr>");};b1.createMonth=function(d){var f1=this.date.getDate();var g1=this.date.getMonth();var h1=this.date.getYear();var i1=this.date.getDay();var j1=this.def;var k1=1;this.date.setDate(k1);var l1=false;var m1=(this.date.getDay()-j1.firstday);m1+=(m1<0?7:0);k1-=m1;var n1,o1=false,p1,q1;for(var r1=0;r1<6;++r1){d.write("<tr>");for(var s1=0;s1<7;++s1){p1=s1+j1.firstday;p1-=(p1<7?0:7);p1=p1==0||p1==6;this.date.setDate(k1);if(this.date.getDate()==1)o1=!o1;if(s1==0){if(r1!=0){l1=f1-this.date.getDate();if(l1<7&&l1>=0)l1=true;else l1=false;}else l1=(m1+f1)<8;}if(s1==7&&l1)l1=false;q1=this.date.getDate()==f1&&o1;n1=q1?"cd_css":(l1?"tw_css":(o1?(p1?"we_css":"wd_css"):(p1?"weom_css":"wdom_css")));d.write("<td align=center width=14% "+this.getCss(n1)+"><A "+this.getCss(n1)+this.getRef()+">");d.write(this.date.getDate());d.write("</A></td>");k1=this.date.getDate()+1;}d.write("</tr>");this.date.setDate(k1);if(this.date.getDate()<8&&r1>3)break;}this.date.setDate(f1);this.date.setMonth(g1);this.date.setYear(h1);};b1.setLink=function(s,l){this.links[s]=l;};b1.setStyle=function(s,l){this.styles[s]=l;};b1.getStyle=function(){var t1;if(this.i){var u1=CodeThatDateFormat(this.def.dtype,this.date.getDate(),this.date.getMonth(),this.date.getFullYear());if(this.styles[u1])t1=this.styles[u1];}
return t1;};b1.getRef=function(){var v1;if(this.i){var w1=CodeThatDateFormat(this.def.dtype,this.date.getDate(),this.date.getMonth(),this.date.getFullYear());if(this.links[w1])v1=" href='"+this.links[w1]+"'";}v1=v1||(" href='javascript:CodeThatSetDay(\""+this.ctl+"\",\""+this.def.dtype+"\","+this.date.getDate()+","+this.date.getMonth()+","+this.date.getFullYear()+","+this.i+")'");
return v1;};b1.createWeekdays=function(d){var x1=this.def;var y1;for(var z1=0;z1<7;++z1){y1=z1+x1.firstday;y1-=(y1<7?0:7);d.write("<td align=center "+this.getCss("dn_css")+">"+x1.daynames[y1]+"</td>");}};b1.createButtons=function(d,i){var a2=9,b2=this.def.headerstyle;for(var c2 in b2)--a2;if(b2.imgprevy&&!i)d.write("<td width=14% align=left><a href='javascript:CodeThatSetMY("+this.date.getMonth()+","+this.date.getFullYear()+",3)'><IMG border=0 src='"+b2.imgprevy+"'</IMG></A>");if(b2.imgprevm&&!i)d.write("<td width=14% align=left><a href='javascript:CodeThatSetMY("+this.date.getMonth()+","+this.date.getFullYear()+",1)'><IMG border=0 src='"+b2.imgprevm+"'</IMG></A>");d.write("<td colspan="+a2+" align=center "+this.getCss("css",b2)+">"+this.def.monthnames[this.date.getMonth()]+"&nbsp;"+this.date.getFullYear()+"</td>");if(b2.imgnextm&&!i)d.write("<td width=14% align=right><a href='javascript:CodeThatSetMY("+this.date.getMonth()+","+this.date.getFullYear()+",0)'><IMG border=0 src='"+b2.imgnextm+"'</IMG></A></td>");if(b2.imgnexty&&!i)d.write("<td width=14% align=right><a href='javascript:CodeThatSetMY("+this.date.getMonth()+","+this.date.getFullYear()+",2)'><IMG border=0 src='"+b2.imgnexty+"'</IMG></A></td>");};b1.createCombos=function(d,l){var d2=this.def.headerstyle;d.write("<td colspan=7 "+this.getCss("css",d2)+">");if(ua.nn4)d.write("<form>");d.write("<select align=left "+this.getCss("css",d2)+" "+(ua.nn4?"name":"id")+"='month' onchange='CodeThatSetMY(CodeThatFind(document,\"month\").selectedIndex,"+d2.yearrange[0]+"+CodeThatFind(document,\"year\").selectedIndex,4);'>");var e2=0;for(;e2<12;++e2)d.write("<option "+(e2==this.date.getMonth()?"selected='selected'":"")+" value='"+e2+"'>"+this.def.monthnames[e2]+"</option>");d.write("</select>");d.write("<select align=right "+this.getCss("css",d2)+" "+(ua.nn4?"name":"id")+"='year' onchange='CodeThatSetMY(CodeThatFind(document,\"month\").selectedIndex,"+d2.yearrange[0]+"+CodeThatFind(document,\"year\").selectedIndex,4);'>");for(e2=d2.yearrange[0];e2<=d2.yearrange[1];++e2)d.write("<option "+(e2==this.date.getFullYear()?"selected='selected'":"")+" value='"+e2+"'>"+e2+"</option>");d.write("</select>");if(ua.nn4)d.write("</form>");d.write("</td>");};b1.parseValue=function(s,d){var f2=this.def.dtype;d=d||this.date;var g2;if(f2.indexOf("dd")!=-1){g2=parseInt(s.substr(f2.indexOf("dd"),2)-0);if(!isNaN(g2)&&g2!=undefined)d.setDate(g2);}if(f2.indexOf("MM")!=-1){g2=parseInt(s.substr(f2.indexOf("MM"),2)-1);if(!isNaN(g2)&&g2!=undefined)d.setMonth(g2);}if(f2.indexOf("yyyy")!=-1){g2=parseInt(s.substr(f2.indexOf("yyyy"),4)-0);if(!isNaN(g2)&&g2!=undefined)d.setYear(g2);}if(f2.indexOf("HH")!=-1){g2=parseInt(s.substr(f2.indexOf("HH"),2)-0);if(!isNaN(g2)&&g2!=undefined)d.setHours(g2);}if(f2.indexOf("mm")!=-1){g2=parseInt(s.substr(f2.indexOf("mm"),2)-0);if(!isNaN(g2)&&g2!=undefined)d.setMinutes(g2);}if(f2.indexOf("ss")!=-1){g2=parseInt(s.substr(f2.indexOf("ss"),2)-0);if(!isNaN(g2)&&g2!=undefined)d.setSeconds(g2);}};b1.popup=function(ctl){window.codethatcalendar=this;this.ctl=ctl;var h2=CodeThatFind(document,ctl);this.date=new Date();if(h2.value!="")this.parseValue(h2.value);var i2=window.open("http://www.do-print.com/scripts/calendar/calendar.asp","",'width='+this.def.windoww+',height='+this.def.windowh+',status=no,resizable=no,top=200,left=200,dependent=yes,alwaysRaised=yes');i2.opener=window;i2.focus();};}