
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - loop.js - */
// http://transport.nilu.no/portal_javascripts/loop.js?original=1
var animator_counter=1;
function Animator(){this.id=animator_counter++;this.image_root="image";this.n_frames=10;this.image_width=100;this.image_height=100;this.mode=1;this.active=false;this.direction=1;this.delay=400;this.current=null;this.next=null;this.loop_start=this.current;this.max_loop=50;this.consec_loop=0;this.delay_first=500;this.delay_last=500;this.fcst_begin=0;this.fcst_increment=1;this.timeID=null;this.omitImages=false;this.imageOmit;this.FrameURL=FrameURL;this.Load=Load;this.Write=Write;this.Write2=Write2;this.form_name="";this.form="";this.img_name="";this.img="";this.Display=Display;this.Play=Play;this.PlayNext=PlayNext;this.Stop=Stop;this.StopStart=StopStart;this.Swapper=Swapper;this.ImageOmit=ImageOmit;this.Initialize=Initialize;this.Initialize2=Initialize2}
registerPloneFunction(Animator);
function Load(){this.images=new Array(this.n_frames);if(this.omitImages){this.imageOmit=new Array(this.n_frames)}
for(var i=0;i<this.n_frames;i++){this.images[i]=new Image();this.images[i].src=this.FrameURL(i);if(this.omitImages){this.imageOmit[i]=false}}}
function FrameURL(num){if(this.image_ext){return this.image_root+this.files[num]+this.image_ext}
else{return this.image_root+this.files[num]}}
function Write(){this.form_name='form_animator_'+this.id
this.img_name='img_animator_'+this.id}
function Write2(){this.form=document.forms[this.form_name];this.img=document.images[this.img_name];this.form.animator=this;this.form.select_mode.onchange=new Function("this.form.animator.mode=this.selectedIndex;")
this.form.button_bwrd.onclick=new Function("this.form.animator.direction=0; this.form.animator.Play();")
this.form.button_stop.onclick=new Function("this.form.animator.Stop();")
this.form.button_fwrd.onclick=new Function("this.form.animator.direction=1; this.form.animator.Play();")
this.form.button_first.onclick=new Function("this.form.animator.Stop(); this.form.animator.Display(1);")
this.form.button_prev.onclick=new Function("this.form.animator.Stop(); this.form.animator.Display(this.form.animator.current-1);")
this.form.button_next.onclick=new Function("this.form.animator.Stop(); this.form.animator.Display(this.form.animator.current+1);")
this.form.button_last.onclick=new Function("this.form.animator.Stop(); this.form.animator.Display(this.form.animator.n_frames);")
if(this.omitImages){for(i=1;i<=this.n_frames;i++){this.form.elements[12+i].onclick=new Function("this.form.animator.ImageOmit(this.form.elements["+(12+i)+"].checked,"+i+");")}}
this.form.input_delay.onfocus=new Function("this.form.animator.Stop(); this.select();")
this.form.input_delay.onchange=new Function("this.form.animator.delay=parseInt(this.value);")
this.form.input_delay_first.onfocus=new Function("this.form.animator.Stop(); this.select();")
this.form.input_delay_first.onchange=new Function("this.form.animator.delay_first=parseInt(this.value);")
this.form.input_delay_last.onfocus=new Function("this.form.animator.Stop(); this.select();")
this.form.input_delay_last.onchange=new Function("this.form.animator.delay_last=parseInt(this.value);")
this.form.input_current.onfocus=new Function("this.form.animator.Stop(); this.select();")
this.form.input_current.onchange=new Function("this.form.animator.Display(parseInt(this.value));")
this.form.input_n_frames.onchange=new Function("this.value=this.form.animator.n_frames;")
this.img.onclick=new Function("document.forms['"+this.form.name+"'].animator.StopStart();")
this.form.select_mode.selectedIndex=this.mode;this.form.input_n_frames.value=this.n_frames;this.form.input_delay.value=this.delay;this.form.input_delay_first.value=this.delay_first;this.form.input_delay_last.value=this.delay_last}
function Display(num){num=Number(num);if(num<1){num=this.n_frames}
if(num>this.n_frames){num=1}
this.current=num;this.img.src=this.images[this.current-1].src;this.form.input_current.value=this.current}
function Play(){this.Stop();this.next=this.current;this.loop_start=this.current;this.consec_loop=0;this.active=true;this.PlayNext()}
function PlayNext(){if(this.active){if(this.current==this.loop_start){this.consec_loop+=1}
if(this.consec_loop==this.max_loop){alert("The loop has run for 50 consecutive loops.\nPlease hit the play button if you wish to continue.");this.Stop()}
else if(this.omitImages){while(this.imageOmit[this.next]==true){this.next=this.next+(-1+2*this.direction)}
this.current=this.next;this.next=this.current+(-1+2*this.direction)
this.Display(this.current);delay_time=this.delay;if(this.current==1) delay_time=delay_time+this.delay_first;if(this.current==this.n_frames) delay_time=delay_time+this.delay_last;command="document.forms['"+this.form.name+"'].animator.PlayNext()";switch(this.mode){case 0:if((this.next>=1)&&(this.next<=this.n_frames)){this.timeID=window.setTimeout(command,delay_time)}
else this.Stop();break;case 1:switch(this.direction){case 0:if(this.next<1) this.next=this.n_frames;break;case 1:if(this.next>this.n_frames) this.next=1;break}
this.timeID=window.setTimeout(command,delay_time);break;case 2:if(this.next<1){this.direction=1;this.next=2}
if(this.next>this.n_frames){this.direction=0;this.next=this.n_frames-1}
this.timeID=window.setTimeout(command,delay_time);break}}
else{this.current=this.next;this.next=this.current+(-1+2*this.direction)
this.Display(this.current);delay_time=this.delay;if(this.current==1) delay_time=delay_time+this.delay_first;if(this.current==this.n_frames) delay_time=delay_time+this.delay_last;command="document.forms['"+this.form.name+"'].animator.PlayNext()";switch(this.mode){case 0:if((this.next>=1)&&(this.next<=this.n_frames)){this.timeID=window.setTimeout(command,delay_time)}
else this.Stop();break;case 1:switch(this.direction){case 0:if(this.next<1) this.next=this.n_frames;break;case 1:if(this.next>this.n_frames) this.next=1;break}
this.timeID=window.setTimeout(command,delay_time);break;case 2:if(this.next<1){this.direction=1;this.next=2}
if(this.next>this.n_frames){this.direction=0;this.next=this.n_frames-1}
this.timeID=window.setTimeout(command,delay_time);break}}}}
function Stop(){if(this.active){window.clearTimeout(this.timeID)}
this.active=false;this.consec_loop=0}
function StopStart(){this.consec_loop=0;if(this.active) this.Stop();else this.Play()}
function Swapper(num){this.Stop();this.Display(num)}
function ImageOmit(Status,i){if(Status==true)
this.imageOmit[i]=true;else
this.imageOmit[i]=false}
function Initialize(){this.Load();this.Write()}
function Initialize2(){this.Write2();this.Display(1)}


/* - images.js - */
// http://transport.nilu.no/portal_javascripts/images.js?original=1
function imgUp(imgName){if(document.images){document[imgName].src="image_btn.gif"}}
registerPloneFunction(imgUp);
function imgDown(imgName){if(document.images){document[imgName].src="image_btn_dn.gif"}}
registerPloneFunction(imgDown);

/* - fp_cal.js - */
// http://transport.nilu.no/portal_javascripts/fp_cal.js?original=1
if(typeof(iMonth)=="undefined")
iMonth=new Date().getMonth();if(typeof(iYear)=="undefined")
iYear=new Date().getFullYear();if(typeof(iDay)=="undefined")
iDay=new Date().getDate();if(typeof(itype)=="undefined")
itype="loose"
if(typeof(imaxDays)=="undefined")
imaxDays=330
if(typeof(stDay)=="undefined")
startDay=iDay;if(typeof(stMonth)=="undefined")
startMonth=iMonth;if(typeof(stYear)=="undefined")
startYear=iYear;if(typeof(addZero)=="undefined")
addZero=true;if(typeof(offX)=="undefined")
offX=10
if(typeof(offY)=="undefined")
offY=-10
if(typeof(formatInputs)=="undefined")
formatInputs=1
if(typeof(formatSplitter)=="undefined")
formatSplitter="/"
if(typeof(monthFormat)=="undefined")
monthFormat="mm";if(typeof(yearFormat)=="undefined")
yearFormat="yyyy";if(typeof(folowMouse)=="undefined")
folowMouse=true;if(typeof(formatType)=="undefined")
formatType="dd"+formatSplitter+monthFormat+formatSplitter+yearFormat;if(typeof(callNotice)=="undefined")
callNotice="fallsilent()";if(window.addEventListener)
window.addEventListener("load",createBase,false)
else if(window.attachEvent)
window.attachEvent("onload",createBase)
else if(document.getElementById)
window.onload=createBase
document.onmousemove=getMouseXY;var IE=document.all?true:false
if(!IE) document.captureEvents(Event.MOUSEMOVE)
var tempX=0
var tempY=0
function getMouseXY(e){if(IE){tempX=event.clientX+document.body.scrollLeft
tempY=event.clientY+document.body.scrollTop} else{tempX=e.pageX
tempY=e.pageY}
if(tempX<0){tempX=0}
if(tempY<0){tempY=0}
return true}
function getScrollXY(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset} else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft} else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft}
return [scrOfX,scrOfY]}
var d=document;
function cel(obj){return d.createElement(obj)}
function sa(obj,atname,atprop){return obj.setAttribute(atname,atprop)}
function appendc(obj,elem){return obj.appendChild(elem)}
function cNode(obj,txt){return obj.appendChild(d.createTextNode(txt))}
function getID(elem){return d.getElementById(elem)}
var DayCol=new Array("M","T","W","T","F","S","S");var MonthCol=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function getDaysInMonth(mnt,yr){var DaysInMonth=new Array(31,28,31,30,31,30,31,31,30,31,30,31);if(mnt==1)
DaysInMonth[1]=((yr%400==0)||((yr%4==0)&&(yr%100!=0)))?29:28;return DaysInMonth[mnt]}
var cw={currMonth:iMonth,currYear:iYear,currDay:iDay,selMonth:iMonth,selYear:iYear,selDay:iDay,config:itype,maxDays:imaxDays,stMonth:startMonth,stYear:startYear,stDay:startDay,endMonth:11,endYear:iYear,endDay:31,addZ:addZero,setMarks: function(){if(this.config=='strict'){this.stDay=iDay;this.stMonth=iMonth;this.stYear=iYear;this.getEnd()}},getConfMonths: function(){if(this.config=='strict')
cw.setMarks();mthCol=cel("ul");mthCol.id="months";k=0;for(i=0;i<12;i++){mth=cel("li");if(cw.isValidMonth(i)){mth.className="months";if(cw.isCurrentMonth(i))
mth.className="currMonth";mtha=cel("a");mtha.href="javascript:modMonth("+this.selYear+","+i+")";mtha.innerHTML=MonthCol[i];appendc(mth,mtha)}
else{mth.className="monthDisabled";mth.innerHTML=MonthCol[i]}
appendc(mthCol,mth)}
cw.setBrowseYears();return mthCol },getConfDays: function(){dayCol=cel("ul");dayCol.id="days";for(i=0;i<7;i++){dayCell=cel("li");dayCell.className="headDay";dayCell.innerHTML=DayCol[i];appendc(dayCol,dayCell)}
var iFirstDay=new Date(this.selYear,this.selMonth,1).getDay();iFirstDay--if(iFirstDay<0){iFirstDay=6}
for(i=0;i<iFirstDay;i++){dayCell=cel('li');dayCell.className="dayBlank";dayCell.innerHTML="&nbsp;";appendc(dayCol,dayCell)}
for(i=1;i<=getDaysInMonth(this.selMonth,this.selYear);i++){dayCell=cel('li');if(cw.isValidDate(i)){dayCell.className="dayNormal";if(cw.isWeekend(i))
dayCell.className="dayWeekend";if(cw.isCurrentDay(i))
dayCell.className="dayCurrent";dayLink=cel('a');dayLink.href="javascript: newDay("+i+");fillBackDate("+i+","+this.selMonth+","+this.selYear+")";dayLink.innerHTML=i;appendc(dayCell,dayLink)}
else{dayCell.className="dayDisabled";dayCell.innerHTML=i}
appendc(dayCol,dayCell)}
return dayCol},getEnd: function(){imaxD=imaxDays-(getDaysInMonth(this.stMonth,this.stYear)-this.stDay);tmpM=this.stMonth;tmpY=this.stYear;tmpD=this.stDay;i=0;while(imaxD>=getDaysInMonth(tmpM,tmpY)){tmpM++if(tmpM>11){tmpM=0
tmpY++}
tmpD=imaxD-=getDaysInMonth(tmpM,tmpY)}
tmpM++if(tmpM>11){tmpM=0;tmpY++}
this.endMonth=tmpM;this.endDay=tmpD;this.endYear=tmpY},isValidDate: function(tDay){if(this.config=="loose")
return true;if(this.selYear==this.stYear){if(this.selMonth<this.stMonth)
return false;if(this.selMonth==this.stMonth&&tDay<this.stDay)
return false}
if(this.selYear==this.endYear){if(this.selMonth>this.endMonth)
return false;if(this.selMonth==this.endMonth&&tDay>this.endDay)
return false}
if(this.selYear==this.endYear&&this.selYear==this.stYear){if(this.selMonth>this.endMonth||this.selMonth<this.stMonth)
return false}
if(this.selYear>this.endYear)
return false;return true},isWeekend: function(tDay){sun=new Date(this.selYear,this.selMonth,tDay).getDay();if(sun==6||sun==0)
return true;return false},isCurrentDay: function(tDay){if(this.selDay==tDay)
return true;return false},setBrowseYears: function(){brsY=cel('li');brsY.className="yearBrowse";if(this.selYear<=this.stYear&&this.config=="strict"){backB=cel('span')}
else{backB=cel('a');backB.href="javascript: modYear(-1)"}
backB.innerHTML="&laquo";yText=cel("b");yText.innerHTML=cw.selYear;if(this.selYear>=this.endYear&&this.config=="strict")
fwdB=cel('span');else{fwdB=cel('a');fwdB.href="javascript: modYear(1)"}
fwdB.innerHTML="&raquo;";appendc(brsY,backB);appendc(brsY,yText);appendc(brsY,fwdB);appendc(mthCol,brsY)},isValidMonth: function(m){if(this.config=="loose")
return true;else{if(this.selYear<this.stYear)
return false;if(this.selYear==this.stYear&&m<this.stMonth)
return false;if(this.selYear>this.endYear)
return false;if(this.selYear==this.endYear&&m>this.endMonth)
return false}
return true},isCurrentMonth: function(i){if(i==this.selMonth)
return true
return false}}
cw.setMarks();
function createBase(){var el=cel('div');el.id="calendar";el.style.display="none";if(typeof(elToAppend)=="undefined")
tDocument=document.getElementsByTagName('body').item(0);else{var tt=elToAppend;tDocument=document.getElementById(tt)}
appendc(tDocument,el)}
function createCalendarElements(){var el='calendar';var calCon=cel('div');calCon.id="elements";while(document.getElementById(el).firstChild)
document.getElementById(el).removeChild(document.getElementById(el).firstChild);appendc(document.getElementById(el),calCon);mthCol=cw.getConfMonths();appendc(calCon,mthCol);dayStruct=cw.getConfDays();appendc(calCon,dayStruct);closeBtn=cel('div');closeBtn.id="closeBtn";closeBtna=cel('a');closeBtna.href="javascript: closeCalendar()";closeBtna.innerHTML="close";appendc(closeBtn,closeBtna);appendc(document.getElementById(el),closeBtn)}
function modMonth(newY,newM){cw.selYear=newY;cw.selMonth=newM;createCalendarElements()}
function newDay(newD){cw.selDay=newD;createCalendarElements()}
function modYear(way){cw.selYear=parseInt(cw.selYear)+parseInt(way);createCalendarElements()}
var datas;var elem1;var elem2;var elem3;var mA=0;var yA=0;var mm=new Array('mm','mmm');var yy=new Array('yy','yyyy');
function fPopCalendar(param1,param2,param3){tmpString=new String();if(formatInputs==1){elem1=param1;tmpString=document.getElementById(elem1).value}
if(formatInputs==2){elem1=param1;elem2=param2;tmpString=document.getElementById(elem1).value+formatSplitter+document.getElementById(elem2).value}
if(formatInputs==3){elem1=param1;elem2=param2;elem3=param3;tmpString=document.getElementById(elem1).value+formatSplitter+document.getElementById(elem2).value+formatSplitter+document.getElementById(elem3).value}
datas=tmpString.split(formatSplitter);tmpo=formatType.split(formatSplitter);dC="";tC="";if(datas.length==tmpo.length){for(i=0;i<datas.length;i++){if(datas[i].length<2)
datas[i]="0"+datas[i];dC+=datas[i];tC+=tmpo[i]}
if(dC.length==tC.length)
orderData()}
else
datas=new Array(cw.selDay,cw.selMonth,cw.selYear);createCalendarElements();offsets=getScrollXY();document.getElementById('calendar').style.display="block";if(folowMouse){var browser=navigator.appName;if(browser=="Microsoft Internet Explorer"){document.getElementById('calendar').style.left=parseInt(tempX)+parseInt(offX)+parseInt(offsets[0])+'px';document.getElementById('calendar').style.top=parseInt(tempY)+parseInt(offY)+parseInt(offsets[1])+'px'}
else{document.getElementById('calendar').style.left=parseInt(tempX)+parseInt(offX)+'px';document.getElementById('calendar').style.top=parseInt(tempY)+parseInt(offY)+'px'}}
order=new String(formatType).split(formatSplitter);for(i=0;i<mm.length;i++){for(j=0;j<order.length;j++){if(mm[i]==order[j])
mA=i;if(yy[i]==order[j])
yA=i}}}
function orderData(){order=new String(formatType).split(formatSplitter);for(i=0;i<order.length;i++){for(j=0;j<mm.length;j++){if(mm[j]==order[i]){cw.selMonth=datas[i];if(cw.selMonth.slice(0,1)==0)
cw.selMonth=parseInt(cw.selMonth.slice(1,cw.selMonth.length))-1;else if(cw.selMonth.length<3)
cw.selMonth=parseInt(cw.selMonth)-1;if(j==1){for(k=0;k<MonthCol.length;k++){if(MonthCol[k].toLowerCase()==cw.selMonth.toLowerCase()){cw.selMonth=k;break}}}}
if(yy[j]==order[i]){cw.selYear=datas[i];if(cw.selYear.slice(0,1)==0)
cw.selYear=parseInt(cw.selYear.slice(1,cw.selYear.length));if(j==0)
cw.selYear=2000+parseInt(cw.selYear)}}
if(order[i].toLowerCase()=='dd'){cw.selDay=datas[i];if(cw.selDay.slice(0,1)==0)
cw.selDay=parseInt(cw.selDay.slice(1,cw.selDay.length))}}}
function fillBackDate(tDay,tMonth,tYear){if(mA==1)
tMonth=MonthCol[tMonth];if(mA==0){tMonth++;if(tMonth<10&&cw.addZ==true)
tMonth="0"+tMonth}
if(yA==0)
tYear=new String(tYear).slice(2,4);if(tDay<10&&cw.addZ==true){tDay="0"+tDay}
if(formatInputs==1){document.getElementById(elem1).value=tDay+formatSplitter+tMonth+formatSplitter+tYear}
if(formatInputs==2){document.getElementById(elem1).value=tDay;document.getElementById(elem2).value=tMonth+formatSplitter+tYear}
if(formatInputs==3){document.getElementById(elem1).value=tDay;document.getElementById(elem2).value=tMonth;document.getElementById(elem3).value=tYear}
setTimeout(callNotice,0);closeCalendar()}
function closeCalendar(){var el='calendar';document.getElementById(el).style.display="none"}
function fallsilent(){loopDates()}


/* - fp_loop.js - */
// http://transport.nilu.no/portal_javascripts/fp_loop.js?original=1
var animator_counter=1;
function Animator(){this.id=1;this.image_root="image";this.n_frames=10;this.image_width=100;this.image_height=100;this.mode=1;this.active=false;this.direction=1;this.delay=400;this.current=null;this.next=null;this.loop_start=this.current;this.max_loop=50;this.consec_loop=0;this.delay_first=500;this.delay_last=500;this.fcst_begin=0;this.fcst_increment=1;this.timeID=null;this.omitImages=false;this.imageOmit;this.FrameURL=FrameURL;this.LoadLoop=LoadLoop;this.Write=Write;this.Write2=Write2;this.form_name="";this.form="";this.img_name="";this.img="";this.Display=Display;this.Play=Play;this.PlayNext=PlayNext;this.Stop=Stop;this.StopStart=StopStart;this.Swapper=Swapper;this.Initialize=Initialize;this.Initialize2=Initialize2}
function LoadLoop(){this.images=new Array(this.n_frames);if(this.omitImages){this.imageOmit=new Array(this.n_frames)}
for(var i=0;i<this.n_frames;i++){this.images[i]=new Image();this.images[i].src=this.FrameURL(i);if(this.omitImages){this.imageOmit[i]=false}}}
function FrameURL(num){return this.image_root+this.files[num]}
function Write(){this.form_name='form_animator_'+this.id
this.img_name='img_animator_'+this.id}
function Write2(){this.form=document.forms[this.form_name];this.img=document.images[this.img_name];this.form.animator=this;this.form.select_mode.onchange=new Function("this.form.animator.mode=this.selectedIndex;")
this.form.button_bwrd.onclick=new Function("this.form.animator.direction=0; this.form.animator.Play();")
this.form.button_stop.onclick=new Function("this.form.animator.Stop();")
this.form.button_fwrd.onclick=new Function("this.form.animator.direction=1; this.form.animator.Play();")
this.form.button_first.onclick=new Function("this.form.animator.Stop(); this.form.animator.Display(1);")
this.form.button_prev.onclick=new Function("this.form.animator.Stop(); this.form.animator.Display(this.form.animator.current-1);")
this.form.button_next.onclick=new Function("this.form.animator.Stop(); this.form.animator.Display(this.form.animator.current+1);")
this.form.button_last.onclick=new Function("this.form.animator.Stop(); this.form.animator.Display(this.form.animator.n_frames);")
if(this.omitImages){for(i=1;i<=this.n_frames;i++){this.form.elements[12+i].onclick=new Function("this.form.animator.ImageOmit(this.form.elements["+(12+i)+"].checked,"+i+");")}}
this.form.input_delay.onfocus=new Function("this.form.animator.Stop(); this.select();")
this.form.input_delay.onchange=new Function("this.form.animator.delay=parseInt(this.value);")
this.form.input_delay_first.onfocus=new Function("this.form.animator.Stop(); this.select();")
this.form.input_delay_first.onchange=new Function("this.form.animator.delay_first=parseInt(this.value);")
this.form.input_delay_last.onfocus=new Function("this.form.animator.Stop(); this.select();")
this.form.input_delay_last.onchange=new Function("this.form.animator.delay_last=parseInt(this.value);")
this.form.input_current.onfocus=new Function("this.form.animator.Stop(); this.select();")
this.form.input_current.onchange=new Function("this.form.animator.Display(parseInt(this.value));")
this.form.input_n_frames.onchange=new Function("this.value=this.form.animator.n_frames;")
this.img.onclick=new Function("document.forms['"+this.form.name+"'].animator.StopStart();")
this.form.select_mode.selectedIndex=this.mode;this.form.input_n_frames.value=this.n_frames;this.form.input_delay.value=this.delay;this.form.input_delay_first.value=this.delay_first;this.form.input_delay_last.value=this.delay_last}
function Display(num){num=Number(num);if(num<1){num=this.n_frames}
if(num>this.n_frames){num=1}
this.current=num;this.img.src=this.images[this.current-1].src;this.form.input_current.value=this.current}
function Play(){this.Stop();this.next=this.current;this.loop_start=this.current;this.consec_loop=0;this.active=true;this.PlayNext()}
function PlayNext(){if(this.active){if(this.current==this.loop_start){this.consec_loop+=1}
if(this.consec_loop==this.max_loop){alert("The loop has run for 50 consecutive loops.\nPlease hit the play button if you wish to continue.");this.Stop()}
else if(this.omitImages){while(this.imageOmit[this.next]==true){this.next=this.next+(-1+2*this.direction)}
this.current=this.next;this.next=this.current+(-1+2*this.direction)
this.Display(this.current);delay_time=this.delay;if(this.current==1) delay_time=delay_time+this.delay_first;if(this.current==this.n_frames) delay_time=delay_time+this.delay_last;command="document.forms['"+this.form.name+"'].animator.PlayNext()";switch(this.mode){case 0:if((this.next>=1)&&(this.next<=this.n_frames)){this.timeID=window.setTimeout(command,delay_time)}
else this.Stop();break;case 1:switch(this.direction){case 0:if(this.next<1) this.next=this.n_frames;break;case 1:if(this.next>this.n_frames) this.next=1;break}
this.timeID=window.setTimeout(command,delay_time);break;case 2:if(this.next<1){this.direction=1;this.next=2}
if(this.next>this.n_frames){this.direction=0;this.next=this.n_frames-1}
this.timeID=window.setTimeout(command,delay_time);break}}
else{this.current=this.next;this.next=this.current+(-1+2*this.direction)
this.Display(this.current);delay_time=this.delay;if(this.current==1) delay_time=delay_time+this.delay_first;if(this.current==this.n_frames) delay_time=delay_time+this.delay_last;command="document.forms['"+this.form.name+"'].animator.PlayNext()";switch(this.mode){case 0:if((this.next>=1)&&(this.next<=this.n_frames)){this.timeID=window.setTimeout(command,delay_time)}
else this.Stop();break;case 1:switch(this.direction){case 0:if(this.next<1) this.next=this.n_frames;break;case 1:if(this.next>this.n_frames) this.next=1;break}
this.timeID=window.setTimeout(command,delay_time);break;case 2:if(this.next<1){this.direction=1;this.next=2}
if(this.next>this.n_frames){this.direction=0;this.next=this.n_frames-1}
this.timeID=window.setTimeout(command,delay_time);break}}}}
function Stop(){if(this.active){window.clearTimeout(this.timeID)}
this.active=false;this.consec_loop=0}
function StopStart(){this.consec_loop=0;if(this.active) this.Stop();else this.Play()}
function Swapper(num){this.Stop();this.Display(num)}
function ImageOmit(Status,i){if(Status==true)
this.imageOmit[i]=true;else
this.imageOmit[i]=false}
function Initialize(){this.LoadLoop();this.Write()}
function Initialize2(){this.Write2();this.Display(1)}


/* - fp_viewer.js - */
// http://transport.nilu.no/portal_javascripts/fp_viewer.js?original=1
function Cookie(document,name,hours,path,domain,secure){this.$document=document;this.$name=name;if(hours)
this.$expiration=new Date((new Date()).getTime()+hours*3600000);else this.$expiration=null;if(path) this.$path=path;else this.$path=null;if(domain) this.$domain=domain;else this.$domain=null;if(secure) this.$secure=true;else this.$secure=false}
function _Cookie_store(){var cookieval="";for(var prop in this){if((prop.charAt(0)=='$')||((typeof this[prop])=='function'))
continue;if(cookieval!="") cookieval+='&';cookieval+=prop+':'+escape(this[prop])}
var cookie=this.$name+'='+cookieval;if(this.$expiration)
cookie+='; expires='+this.$expiration.toGMTString();if(this.$path) cookie+='; path='+this.$path;if(this.$domain) cookie+='; domain='+this.$domain;if(this.$secure) cookie+='; secure';this.$document.cookie=cookie}
function _Cookie_load(){var allcookies=this.$document.cookie;if(allcookies=="") return false;var start=allcookies.indexOf(this.$name+'=');if(start==-1) return false;start+=this.$name.length+1;var end=allcookies.indexOf(';',start);if(end==-1) end=allcookies.length;var cookieval=allcookies.substring(start,end);var a=cookieval.split('&');for(var i=0;i<a.length;i++)
a[i]=a[i].split(':');for(var i=0;i<a.length;i++)
this[a[i][0]]=unescape(a[i][1]);return true}
function _Cookie_remove(){var cookie;cookie=this.$name+'=';if(this.$path) cookie+='; path='+this.$path;if(this.$domain) cookie+='; domain='+this.$domain;cookie+='; expires=Fri, 02-Jan-1970 00:00:00 GMT';this.$document.cookie=cookie}
new Cookie();Cookie.prototype.store=_Cookie_store;Cookie.prototype.load=_Cookie_load;Cookie.prototype.remove=_Cookie_remove;var dataparam=new Cookie(document,"FLEXPART_field",0);dataparam.field=0;dataparam.res=0;dataparam.date=200603;dataparam.station=0;dataparam.store();var STATION=new Array();STATION[0]="ASP";STATION[1]="BEO";STATION[2]="BIR";STATION[3]="CBW";STATION[4]="FKL";STATION[5]="HW";STATION[6]="JFJ";STATION[7]="JRC";STATION[8]="KPO";STATION[9]="MHD";STATION[10]="MPZ";STATION[11]="MSY";STATION[12]="MTC";STATION[13]="OBK";STATION[14]="PAL";STATION[15]="PDD";STATION[16]="PLA";STATION[17]="SMR";STATION[18]="VHL";STATION[19]="ZEP";STATION[20]="SUM";var base_dir=new Array();base_dir[0]=String("http://zardoz.nilu.no/~burkhart/EUCAARI/");var plot_type=new Array();plot_type[0]="retroplume";plot_type[1]="column";plot_type[2]="footprint";plot_type[3]="co";plot_type[4]="no2";plot_type[5]="so2";plot_type[6]="fire_co";var plot_res=new Array();plot_res[0]="global";plot_res[1]="regional";var newPath=new Array();var DATASET="ECMWF"
var noon_days=new Array();noon_days[0]=1 ;noon_days[1]=4 ;noon_days[2]=12 ;noon_days[3]=20 ;noon_days[4]=28 ;noon_days[5]=36 ;noon_days[6]=44 ;noon_days[7]=52 ;noon_days[8]=60 ;noon_days[9]=68 ;noon_days[10]=76 ;noon_days[11]=84 ;noon_days[12]=92 ;noon_days[13]=100;noon_days[14]=108;noon_days[15]=116;noon_days[16]=124;noon_days[17]=132;noon_days[18]=140;noon_days[19]=148;noon_days[20]=156;noon_days[21]=164;noon_days[22]=172;noon_days[23]=180;noon_days[24]=188;noon_days[25]=196;noon_days[26]=204;noon_days[27]=212;noon_days[28]=220;noon_days[29]=228;noon_days[30]=236;noon_days[31]=244;
function load_viewer(){loop=new Animator();loop.image_root=String(base_dir[0]+"/"+STATION[dataparam.station]+"/"+STATION[dataparam.station]+"_"+dataparam.date+"/"+DATASET+"/"+plot_res[dataparam.res]+"_"+plot_type[dataparam.field]+"/"+STATION[dataparam.station]+"_"+dataparam.date+".global_"+plot_type[dataparam.field]);loop.files=new Array("_1.gif","_2.gif","_3.gif","_4.gif","_5.gif","_6.gif","_7.gif","_8.gif","_9.gif","_10.gif","_11.gif","_12.gif","_13.gif","_14.gif","_15.gif","_16.gif","_17.gif","_18.gif","_19.gif","_20.gif","_21.gif","_22.gif","_23.gif","_24.gif");loop.Initialize();loop.Play()}
function change_field(field){tab=document.getElementById(plot_type[dataparam.field]);tab.className="xbox_unset";dataparam.field=field;dataparam.store();tab=document.getElementById(plot_type[dataparam.field]);tab.className="xbox_set";loopDates()}
function change_res(res){dataparam.res=res;dataparam.store();loopDates()}
var dl;
function change_station(dl){dataparam.station=dl.stat_sel.options[dl.stat_sel.selectedIndex].value;dataparam.store();loopDates()}
function resetLoop(){loop.image_root=String(base_dir[0]);loop.n_frames=25;loop.image_width=568;loop.image_height=568;loop.files=newPath;loop.Initialize();loop.Play()}
var np;
function loopNames(np){tmp=document.getElementById(elem1).value;tmpp=tmp.split(formatSplitter);YY=parseInt(tmpp[2],10);MM=parseInt(tmpp[1],10);DD=parseInt(tmpp[0],10);filenum=noon_days[DD];da=DD;mo=MM;yr=YY;f2=filenum;cnt=0;shft=0;for(var nd=-14;nd<14;nd++){if(cnt==0) f2=f2+nd;else f2=f2+1;if(f2<1){mo=mo-1;if(mo<1){mo=12;yr=yr-1}
shft=248;if(mo==2){shft=244}
f2=f2+shft}
else if(f2>248||(mo==2&&f2>244)){mo=mo+1;shft=-248;if(mo==3){shft=-244}
f2=f2+shft;if(mo>12){mo=1;yr=yr+1}}
if(dataparam.station==19||dataparam.station==20){plot_res[2]="polar"}
else plot_res[2]="local";this.newPath[cnt]=(STATION[dataparam.station]+"/"+STATION[dataparam.station]+"_"+yr+""+(mo<10?"0"+mo:mo)+"/"+DATASET+"/"+plot_res[dataparam.res]+"_"+plot_type[dataparam.field]+"/"+STATION[dataparam.station]+"_"+yr+""+(mo<10?"0"+mo:mo)+"."+plot_res[dataparam.res]+"_"+plot_type[dataparam.field]+"_"+f2+".gif");document.getElementById(np).value=this.newPath[cnt];cnt=cnt+1}}
function loopDates(){tmp=document.getElementById(elem1).value;tmpp=tmp.split(formatSplitter);newDate=String(tmpp[2]+tmpp[1]);loopNames('new_path');resetLoop()}
var pd;
function oneDayBack(pd){tmp=document.getElementById(elem1).value;tmpp=tmp.split(formatSplitter);cd=new Date((tmpp[1]+"/"+tmpp[0]+"/"+tmpp[2]));nt=Date.parse(cd)-(1000*60*60*24);cd.setTime(nt);yr=cd.getFullYear();mo=cd.getMonth()+1;da=cd.getDate();document.getElementById(elem1).value=((da<10?"0"+da:da)+"/"+(mo<10?"0"+mo:mo)+"/"+yr);loopDates()}
var pd;
function oneDayForward(pd){tmp=document.getElementById(elem1).value;tmpp=tmp.split(formatSplitter);cd=new Date((tmpp[1]+"/"+tmpp[0]+"/"+tmpp[2]));nt=Date.parse(cd)+(1000*60*60*24);cd.setTime(nt);yr=cd.getFullYear();mo=cd.getMonth()+1;da=cd.getDate();document.getElementById(elem1).value=((da<10?"0"+da:da)+"/"+(mo<10?"0"+mo:mo)+"/"+yr);loopDates()}

/* - OL_Button.js - */
// http://transport.nilu.no/portal_javascripts/OL_Button.js?original=1
OpenLayers.Control.Button=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_BUTTON,trigger: function(){},CLASS_NAME:"OpenLayers.Control.Button"});

/* - OL_Rect.js - */
// http://transport.nilu.no/portal_javascripts/OL_Rect.js?original=1
OpenLayers.Handler.Rect=OpenLayers.Class(OpenLayers.Handler,{Rect:null,pointNo:0,initialize: function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.pointNo=0;this.startp=new OpenLayers.Geometry.Point();this.endp=new OpenLayers.Geometry.Point();this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,{displayInLayerSwitcher:false});this.map.addLayer(this.layer);this.map.events.register('move',this, function(){if(this.Rect!=null)
this.drawFeature()});this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});this.style['strokeColor']="#ff0000";this.style['strokeWeight']=8},activate: function(){this.map.div.style.cursor="crosshair";OpenLayers.Handler.prototype.activate.apply(this,arguments)},deactivate: function(){this.map.div.style.cursor="";OpenLayers.Handler.prototype.deactivate.apply(this,arguments)},createFeature: function(){this.points=new Array;var d=0.0000001;this.points[0]=new OpenLayers.Geometry.Point(this.startp.x,this.startp.y);this.points[1]=new OpenLayers.Geometry.Point(this.startp.x+d,this.startp.y);this.points[2]=new OpenLayers.Geometry.Point(this.startp.x+d,this.startp.y+d);this.points[3]=new OpenLayers.Geometry.Point(this.startp.x,this.startp.y+d);this.Ring=new OpenLayers.Geometry.LinearRing(this.points);this.Rect=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(this.Ring))},destroyFeature: function(){if(this.Rect!=null)
this.layer.drawFeature(this.Rect,this.style);if(this.layer!=null)
this.layer.renderer.clear();if(this.Rect!=null){this.Rect.destroy();this.Rect=null;this.Ring.destroy();this.Ring=null;this.points=null}
this.pointNo=0},modifyFeature: function(){this.points[1].x=this.endp.x;this.points[2].x=this.endp.x;this.points[2].y=this.endp.y;this.points[3].y=this.endp.y},drawFeature: function(){this.layer.drawFeature(this.Rect,this.style)},mousedown: function(evt){return(false)},mousemove: function(evt){if(this.pointNo>0)
this.moveRect(evt.xy);return(false)},mouseup: function(evt){if(this.pointNo==0)
this.startRect(evt.xy);else
this.endRect(evt.xy);this.pointNo++;if(this.pointNo==2)
this.pointNo=0;return(false)},setRect: function(points){if(this.Rect!=null)
this.destroyFeature();this.startp.x=points[0].x;this.startp.y=points[0].y;this.createFeature();this.endp.x=points[1].x;this.endp.y=points[1].y;this.modifyFeature();this.drawFeature();return},startRect: function(xy){if(this.Rect!=null)
this.destroyFeature();var lonlat=this.control.map.getLonLatFromPixel(xy);this.startp.x=lonlat.lon;this.startp.y=lonlat.lat;this.createFeature();this.drawFeature();return false},moveRect: function(xy){var lonlat=this.map.getLonLatFromPixel(xy);this.endp.x=lonlat.lon;this.endp.y=lonlat.lat;this.modifyFeature();this.drawFeature();return true},endRect: function(end){var result;result=new Array(2);result[0]=new Object;result[0].lat=this.startp.y;result[0].lon=this.startp.x;result[1]=new Object;result[1].lat=this.endp.y;result[1].lon=this.endp.x;this.callback("done",[result])},CLASS_NAME:"OpenLayers.Handler.Rect"});

/* - OL_PolyLine.js - */
// http://transport.nilu.no/portal_javascripts/OL_PolyLine.js?original=1
OpenLayers.Handler.PolyLine=OpenLayers.Class(OpenLayers.Handler,{line:null,type:'poly',drawpoint:false,initialize: function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,{displayInLayerSwitcher:false});this.map.addLayer(this.layer);this.map.events.register('move',this, function(){if(this.line!=null)
this.drawFeature()});this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});this.style['strokeColor']="#ff0000";this.style['strokeWeight']=8},activate: function(){this.map.div.style.cursor="crosshair";OpenLayers.Handler.prototype.activate.apply(this,arguments)},deactivate: function(){this.map.div.style.cursor="";OpenLayers.Handler.prototype.deactivate.apply(this,arguments)},setType: function(type){if(type=='poly'||type=='single')
this.type=type},createFeature: function(){this.line=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString());this.point=new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point())},destroyFeature: function(){if(this.line!=null)
this.layer.drawFeature(this.line,this.style);if(this.point!=null&&this.drawpoint)
this.layer.drawFeature(this.point,this.style);if(this.layer!=null)
this.layer.renderer.clear();if(this.line!=null){this.line.destroy();this.line=null}
this.drawing=false;this.mouseDown=false;this.lastDown=null;this.lastUp=null},addPoint: function(){this.line.geometry.addComponent(this.point.geometry.clone(),this.line.geometry.components.length);this.callback("point",[this.point.geometry])},modifyFeature: function(){var index=this.line.geometry.components.length-1;this.line.geometry.components[index].x=this.point.geometry.x;this.line.geometry.components[index].y=this.point.geometry.y;this.line.geometry.components[index].clearBounds()},drawFeature: function(){this.layer.drawFeature(this.line,this.style);if(this.drawpoint)
this.layer.drawFeature(this.point,this.style)},setPolyLine: function(points){if(this.line!=null)
this.destroyFeature();this.createFeature();for(i in points){this.point.geometry.x=points[i].x;this.point.geometry.y=points[i].y;this.addPoint()}
this.drawFeature();return},mousedown: function(evt){if(this.lastDown&&this.lastDown.equals(evt.xy)){return false}
if(this.lastDown==null){if(this.line!=null)
this.destroyFeature();this.createFeature()}
this.mouseDown=true;this.lastDown=evt.xy;var lonlat=this.control.map.getLonLatFromPixel(evt.xy);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;if((this.lastUp==null)||!this.lastUp.equals(evt.xy)){this.addPoint()}
this.drawFeature();this.drawing=true;return false},mousemove: function(evt){if(this.drawing){var lonlat=this.map.getLonLatFromPixel(evt.xy);this.point.geometry.x=lonlat.lon;this.point.geometry.y=lonlat.lat;this.modifyFeature();this.drawFeature()}
return true},mouseup: function(evt){this.mouseDown=false;if(this.drawing){if(this.lastUp==null){this.addPoint()}
this.lastUp=evt.xy;if(this.type=='single'&&this.line.geometry.components.length>2){result=new Array;for(i=0;i<2;i++){result[i]=new Object;result[i].lat=this.line.geometry.components[i].y;result[i].lon=this.line.geometry.components[i].x}
this.drawing=false;this.mouseDown=false;this.lastDown=null;this.lastUp=null;this.callback("done",[result])}
return false}
return true},dblclick: function(evt){var index=this.line.geometry.components.length-1;this.line.geometry.removeComponent(this.line.geometry.components[index]);result=new Array;for(i=0;i<index;i++){result[i]=new Object;result[i].lat=this.line.geometry.components[i].y;result[i].lon=this.line.geometry.components[i].x}
this.drawing=false;this.mouseDown=false;this.lastDown=null;this.lastUp=null;this.callback("done",[result]);return false},CLASS_NAME:"OpenLayers.Handler.PolyLine"});

/* - OL_CallbackPanel.js - */
// http://transport.nilu.no/portal_javascripts/OL_CallbackPanel.js?original=1
OpenLayers.Control.CallbackPanel=OpenLayers.Class(OpenLayers.Control,{items:null,defaultControl:null,initialize: function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.items=[]},destroy: function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var i=this.items.length-1 ;i>=0;i--){OpenLayers.Event.stopObservingElement(this.items[i].panel_div);this.items[i].panel_div=null}},activate: function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){this.redraw();return true} else{return false}},deactivate: function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){this.redraw();return true} else{return false}},draw: function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.activate();return this.div},redraw: function(){this.div.innerHTML="";if(this.active){for(var i=0;i<this.items.length;i++){var element=this.items[i].panel_div;if(this.items[i].active){element.className=this.items[i].displayClass+"ItemActive"} else{element.className=this.items[i].displayClass+"ItemInactive"}
this.div.appendChild(element)}}},activateControl: function(control){if(!this.active){return false}
if(control.type==OpenLayers.Control.TYPE_BUTTON){control.trigger();return}
if(control.type==OpenLayers.Control.TYPE_TOGGLE){if(control.active){control.deactivate()} else{control.activate()}
return}
for(var i=0;i<this.controls.length;i++){if(this.controls[i]==control){control.activate()} else{if(this.controls[i].type!=OpenLayers.Control.TYPE_TOGGLE){this.controls[i].deactivate()}}}
this.redraw()},addControls: function(controls){if(!(controls instanceof Array)){controls=[controls]}
this.controls=this.controls.concat(controls);for(var i=0;i<controls.length;i++){var element=document.createElement("div");var textNode=document.createTextNode(" ");controls[i].panel_div=element;OpenLayers.Event.observe(controls[i].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,controls[i]));OpenLayers.Event.observe(controls[i].panel_div,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop))}
if(this.map){for(var i=0;i<controls.length;i++){this.map.addControl(controls[i]);controls[i].deactivate()}
this.redraw()}},onClick: function(ctrl,evt){OpenLayers.Event.stop(evt?evt:window.event);this.activateControl(ctrl)},CLASS_NAME:"OpenLayers.Control.CallbackPanel"});

/* - DynamicOptionsList.js - */
// http://transport.nilu.no/portal_javascripts/DynamicOptionsList.js?original=1
var dynamicOptionListCount=0;var dynamicOptionListObjects=new Array();
function initDynamicOptionLists(){for(var i=0;i<dynamicOptionListObjects.length;i++){var dol=dynamicOptionListObjects[i];if(dol.formName!=null){dol.form=document.forms[dol.formName]}
else if(dol.formIndex!=null){dol.form=document.forms[dol.formIndex]}
else{var name=dol.fieldNames[0][0];for(var f=0;f<document.forms.length;f++){if(typeof(document.forms[f][name])!="undefined"){dol.form=document.forms[f];break}}
if(dol.form==null){alert("ERROR: Couldn't find form element "+name+" in any form on the page! Init aborted");return}}
for(var j=0;j<dol.fieldNames.length;j++){for(var k=0;k<dol.fieldNames[j].length-1;k++){var selObj=dol.form[dol.fieldNames[j][k]];if(typeof(selObj)=="undefined"){alert("Select box named "+dol.fieldNames[j][k]+" could not be found in the form. Init aborted");return}
if(k==0){if(selObj.options!=null){for(l=0;l<selObj.options.length;l++){var sopt=selObj.options[l];var m=dol.findMatchingOptionInArray(dol.options,sopt.text,sopt.value,false);if(m!=null){var reselectForNN6=sopt.selected;var m2=new Option(sopt.text,sopt.value,sopt.defaultSelected,sopt.selected);m2.selected=sopt.selected;m2.defaultSelected=sopt.defaultSelected;m2.DOLOption=m;selObj.options[l]=m2;selObj.options[l].selected=reselectForNN6}}}}
if(selObj.onchange==null){selObj.onchange=new Function("dynamicOptionListObjects["+dol.index+"].change(this)")}}}}
resetDynamicOptionLists()}
function resetDynamicOptionLists(theform){for(var i=0;i<dynamicOptionListObjects.length;i++){var dol=dynamicOptionListObjects[i];if(typeof(theform)=="undefined"||theform==null||theform==dol.form){for(var j=0;j<dol.fieldNames.length;j++){dol.change(dol.form[dol.fieldNames[j][0]],true)}}}}
function DOLOption(text,value,defaultSelected,selected){this.text=text;this.value=value;this.defaultSelected=defaultSelected;this.selected=selected;this.options=new Array();return this}
function DynamicOptionList(){this.form=null;this.options=new Array();this.longestString=new Array();this.numberOfOptions=new Array();this.currentNode=null;this.currentField=null;this.currentNodeDepth=0;this.fieldNames=new Array();this.formIndex=null;this.formName=null;this.fieldListIndexes=new Object();this.fieldIndexes=new Object();this.selectFirstOption=true;this.numberOfOptions=new Array();this.longestString=new Array();this.values=new Object();this.forValue=DOL_forValue;this.forText=DOL_forText;this.forField=DOL_forField;this.forX=DOL_forX;this.addOptions=DOL_addOptions;this.addOptionsTextValue=DOL_addOptionsTextValue;this.setDefaultOptions=DOL_setDefaultOptions;this.setValues=DOL_setValues;this.setValue=DOL_setValues;this.setFormIndex=DOL_setFormIndex;this.setFormName=DOL_setFormName;this.printOptions=DOL_printOptions;this.addDependentFields=DOL_addDependentFields;this.change=DOL_change;this.child=DOL_child;this.selectChildOptions=DOL_selectChildOptions;this.populateChild=DOL_populateChild;this.change=DOL_change;this.addNewOptionToList=DOL_addNewOptionToList;this.findMatchingOptionInArray=DOL_findMatchingOptionInArray;if(arguments.length>0){for(var i=0;i<arguments.length;i++){this.fieldListIndexes[arguments[i].toString()]=this.fieldNames.length;this.fieldIndexes[arguments[i].toString()]=i}
this.fieldNames[this.fieldNames.length]=arguments}
this.index=window.dynamicOptionListCount++;window["dynamicOptionListObjects"][this.index]=this}
function DOL_findMatchingOptionInArray(a,text,value,exactMatchRequired){if(a==null||typeof(a)=="undefined"){return null}
var value_match=null;var text_match=null;for(var i=0;i<a.length;i++){var opt=a[i];if(opt.value==value&&opt.text==text){return opt}
if(!exactMatchRequired){if(value_match==null&&value!=null&&opt.value==value){value_match=opt}
if(text_match==null&&text!=null&&opt.text==text){text_match=opt}}}
return(value_match!=null)?value_match:text_match}
function DOL_forX(s,type){if(this.currentNode==null){this.currentNodeDepth=0}
var useNode=(this.currentNode==null)?this:this.currentNode;var o=this.findMatchingOptionInArray(useNode["options"],(type=="text")?s:null,(type=="value")?s:null,false);if(o==null){o=new DOLOption(null,null,false,false);o[type]=s;useNode.options[useNode.options.length]=o}
this.currentNode=o;this.currentNodeDepth++;return this}
function DOL_forValue(s){return this.forX(s,"value")}
function DOL_forText(s){return this.forX(s,"text")}
function DOL_forField(f){this.currentField=f;return this}
function DOL_addNewOptionToList(a,text,value,defaultSelected){var o=new DOLOption(text,value,defaultSelected,false);if(a==null){a=new Array()}
for(var i=0;i<a.length;i++){if(a[i].text==o.text&&a[i].value==o.value){if(o.selected){a[i].selected=true}
if(o.defaultSelected){a[i].defaultSelected=true}
return a}}
a[a.length]=o}
function DOL_addOptions(){if(this.currentNode==null){this.currentNode=this}
if(this.currentNode["options"]==null){this.currentNode["options"]=new Array()}
for(var i=0;i<arguments.length;i++){var text=arguments[i];this.addNewOptionToList(this.currentNode.options,text,text,false);if(typeof(this.numberOfOptions[this.currentNodeDepth])=="undefined"){this.numberOfOptions[this.currentNodeDepth]=0}
if(this.currentNode.options.length>this.numberOfOptions[this.currentNodeDepth]){this.numberOfOptions[this.currentNodeDepth]=this.currentNode.options.length}
if(typeof(this.longestString[this.currentNodeDepth])=="undefined"||(text.length>this.longestString[this.currentNodeDepth].length)){this.longestString[this.currentNodeDepth]=text}}
this.currentNode=null;this.currentNodeDepth=0}
function DOL_addOptionsTextValue(){if(this.currentNode==null){this.currentNode=this}
if(this.currentNode["options"]==null){this.currentNode["options"]=new Array()}
for(var i=0;i<arguments.length;i++){var text=arguments[i++];var value=arguments[i];this.addNewOptionToList(this.currentNode.options,text,value,false);if(typeof(this.numberOfOptions[this.currentNodeDepth])=="undefined"){this.numberOfOptions[this.currentNodeDepth]=0}
if(this.currentNode.options.length>this.numberOfOptions[this.currentNodeDepth]){this.numberOfOptions[this.currentNodeDepth]=this.currentNode.options.length}
if(typeof(this.longestString[this.currentNodeDepth])=="undefined"||(text.length>this.longestString[this.currentNodeDepth].length)){this.longestString[this.currentNodeDepth]=text}}
this.currentNode=null;this.currentNodeDepth=0}
function DOL_child(obj){var listIndex=this.fieldListIndexes[obj.name];var index=this.fieldIndexes[obj.name];if(index<(this.fieldNames[listIndex].length-1)){return this.form[this.fieldNames[listIndex][index+1]]}
return null}
function DOL_setDefaultOptions(){if(this.currentNode==null){this.currentNode=this}
for(var i=0;i<arguments.length;i++){var o=this.findMatchingOptionInArray(this.currentNode.options,null,arguments[i],false);if(o!=null){o.defaultSelected=true}}
this.currentNode=null}
function DOL_setValues(){if(this.currentField==null){alert("Can't call setValues() without using forField() first!");return}
if(typeof(this.values[this.currentField])=="undefined"){this.values[this.currentField]=new Object()}
for(var i=0;i<arguments.length;i++){this.values[this.currentField][arguments[i]]=true}
this.currentField=null}
function DOL_setFormIndex(i){this.formIndex=i}
function DOL_setFormName(n){this.formName=n}
function DOL_printOptions(name){if((navigator.appName=='Netscape')&&(parseInt(navigator.appVersion)<=4)){var index=this.fieldIndexes[name];var ret="";if(typeof(this.numberOfOptions[index])!="undefined"){for(var i=0;i<this.numberOfOptions[index];i++){ret+="<OPTION>"}}
ret+="<OPTION>";if(typeof(this.longestString[index])!="undefined"){for(var i=0;i<this.longestString[index].length;i++){ret+="_"}}
document.writeln(ret)}}
function DOL_addDependentFields(){for(var i=0;i<arguments.length;i++){this.fieldListIndexes[arguments[i].toString()]=this.fieldNames.length;this.fieldIndexes[arguments[i].toString()]=i}
this.fieldNames[this.fieldNames.length]=arguments}
function DOL_change(obj,usePreselected){if(usePreselected==null||typeof(usePreselected)=="undefined"){usePreselected=false}
var changedListIndex=this.fieldListIndexes[obj.name];var changedIndex=this.fieldIndexes[obj.name];var child=this.child(obj);if(child==null){return}
if(obj.type=="select-one"){if(child.options!=null){child.options.length=0}
if(obj.options!=null&&obj.options.length>0&&obj.selectedIndex>=0){var o=obj.options[obj.selectedIndex];this.populateChild(o.DOLOption,child,usePreselected);this.selectChildOptions(child,usePreselected)}}
else if(obj.type=="select-multiple"){var currentlySelectedOptions=new Array();if(!usePreselected){for(var i=0;i<child.options.length;i++){var co=child.options[i];if(co.selected){this.addNewOptionToList(currentlySelectedOptions,co.text,co.value,co.defaultSelected)}}}
child.options.length=0;if(obj.options!=null){var obj_o=obj.options;for(var i=0;i<obj_o.length;i++){if(obj_o[i].selected){this.populateChild(obj_o[i].DOLOption,child,usePreselected)}}
var atLeastOneSelected=false;if(!usePreselected){for(var i=0;i<child.options.length;i++){var m=this.findMatchingOptionInArray(currentlySelectedOptions,child.options[i].text,child.options[i].value,true);if(m!=null){child.options[i].selected=true;atLeastOneSelected=true}}}
if(!atLeastOneSelected){this.selectChildOptions(child,usePreselected)}}}
this.change(child,usePreselected)}
function DOL_populateChild(dolOption,childSelectObj,usePreselected){if(dolOption!=null&&dolOption.options!=null){for(var j=0;j<dolOption.options.length;j++){var srcOpt=dolOption.options[j];if(childSelectObj.options==null){childSelectObj.options=new Array()}
var duplicate=false;var preSelectedExists=false;for(var k=0;k<childSelectObj.options.length;k++){var csi=childSelectObj.options[k];if(csi.text==srcOpt.text&&csi.value==srcOpt.value){duplicate=true;break}}
if(!duplicate){var newopt=new Option(srcOpt.text,srcOpt.value,false,false);newopt.selected=false;newopt.defaultSelected=false;newopt.DOLOption=srcOpt;childSelectObj.options[childSelectObj.options.length]=newopt}}}}
function DOL_selectChildOptions(obj,usePreselected){var values=this.values[obj.name];var preselectedExists=false;if(usePreselected&&values!=null&&typeof(values)!="undefined"){for(var i=0;i<obj.options.length;i++){var v=obj.options[i].value;if(v!=null&&values[v]!=null&&typeof(values[v])!="undefined"){preselectedExists=true;break}}}
var atLeastOneSelected=false;for(var i=0;i<obj.options.length;i++){var o=obj.options[i];if(preselectedExists&&o.value!=null&&values[o.value]!=null&&typeof(values[o.value])!="undefined"){o.selected=true;atLeastOneSelected=true}
else if(!preselectedExists&&o.DOLOption!=null&&o.DOLOption.defaultSelected){o.selected=true;atLeastOneSelected=true}
else{o.selected=false}}
if(this.selectFirstOption&&!atLeastOneSelected&&obj.options.length>0){obj.options[0].selected=true}
else if(!atLeastOneSelected&&obj.type=="select-one"){obj.selectedIndex=-1}}

