Team:Warsaw/Calendar-Main/EmptyDays

Empty entries locator  





/* <![CDATA[ */

Array.prototype.indexOf = function( v, b, s ) { for( var i = +b || 0, l = this.length; i < l; i++ ) { if( this[i]===v || s ) if ( this[i]==v ) { return i; } } return -1; }; var months=['January','February','March','April','May','June','July','August','September','October','November','December'];

var adresbase='http://2008.igem.org/Team:Warsaw/Calendar-Main/';

function longmonth(mon) { var long=['May','July','August','October']; if (long.indexOf(mon,0,false)>=0) return true; return false; }

function nextday(date) { date=date.replace(' ','_'); date=date.replace(' ','_'); var date_array=date.split('_'); var d=parseInt(date_array[0]); var m=date_array[1]; //var y="2008"; var y=parseInt(date_array[2]); var next_day;

if (d+1<31) { next_day=(d+1)+'_'+m+'_'+y; } else { var next_month=months[(parseInt(months.indexOf(m,0,false))+1)]; next_day='1'+'_'+next_month+'_'+y; } if (longmonth(m)) if((d+1)==31) { next_day=(d+1)+'_'+m+'_'+y; }

return next_day; }

function prevday(date) { date=date.replace(' ','_'); date=date.replace(' ','_'); var date_array=date.split('_'); var d=parseInt(date_array[0]); var m=date_array[1]; var y="2008"; var prev_day="";

if (d-1>0) { prev_day=(d-1)+'_'+m+'_'+y; } else { var prev_month=months[(parseInt(months.indexOf(m,0,false))-1)]; if (longmonth(prev_month)) { prev_day='31'+'_'+prev_month+'_'+y; } else { prev_day='30'+'_'+prev_month+'_'+y; } }

return prev_day; }

var eday="empty"; eday=eday.replace("y","yday");

function next_empty(day,end_day) {

var nday=nextday(day);

document.getElementById("progress").innerHTML="Processing: "+day;

if (window.XMLHttpRequest) { // Mozilla, Safari, Opera ... var req = new XMLHttpRequest; } else if (window.ActiveXObject) { // IE  var req = new ActiveXObject("Microsoft.XMLHTTP"); } var ans; if (window.overrideMimeType) req.overrideMimeType('text/xml'); req.onreadystatechange = function { //początek wewnętrznej funkcji if (req.readyState == 4) { if (req.status == 200) { ans=req.responseText; if(ans.search(eday)>0) document.getElementById("results").innerHTML=document.getElementById("results").innerHTML+''+nday+""; if (day==end_day) { document.getElementById("progress").innerHTML="Done"; return true; }               else { next_empty(nday,end_day); } } }

}; //koniec wewnętrznej funkcji

req.open('GET', adresbase+nday, true); req.send(null); }

function find_empty { var start_day=parseInt(document.params.start_day.value); var start_month=document.params.start_month.value; var start_year=parseInt(document.params.start_year.value); var end_day=parseInt(document.params.end_day.value); var end_month=document.params.end_month.value; var end_year=parseInt(document.params.end_year.value);

if (start_day>0) if (start_day<32) var start_date=start_day+'_'+start_month+'_'+start_year; else { document.getElementById("progress").innerHTML="Start day error" return; } if (end_day>0) if (end_day<32) var end_date=end_day+'_'+end_month+'_'+end_year; else { document.getElementById("progress").innerHTML="End day error" return; }

if (start_month==end_month) if(end_day */