var Curr_Fdate,Curr_mon,Curr_year,mojo
var rowchg,dayincremtr,daycount
var qs,windlow,countr,rangecountr,hi_range,lo_range
var countr2,tabchg


daterange = new Array()
date_href = new Array()
date_href1 = new Array()

Events = new Array()

function create_Event(ev1,ev2,ev3,ev4,ev5,ev6,ev7,ev8,ev9,ev10,ev11,ev12,ev13,ev14,ev15)
{
   this.month=ev1;
   this.date_start=ev2;
   this.date_end=ev3;
   this.date_year=ev4;
   this.title=ev5;
   this.s_link=ev6;
   this.purpose=ev7;
   this.city=ev8;
   this.state=ev9;
   this.nation=ev10;
   this.contact=ev11;
   this.contact_num=ev12;
   this.contact_email=ev13;
   this.active=ev14;
   this.id=ev15;
}


function mojo(month,days,adder,baseyear)
{
    this.month=month;
    this.days=days;
    this.adder=adder;
    this.baseyear=baseyear;
}


var Curr_Fdate1,Curr_year1,lyear,leapyear,curr_mod,yearadd,addr
var monthaddr,jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec
Curr_Fdate1= new Date();
Curr_year1=Curr_Fdate1.getUTCFullYear();

addr=0
febcnt=28



Curr_Fdate= new Date();
Curr_mon=Curr_Fdate.getMonth();

windlow=String(window.location)
qs=windlow.split("=");

if (qs.length == 1) // 3- qs.length
{
Curr_year=Curr_Fdate.getUTCFullYear();
//alert("Null: " + qs.length);
}
else
{
Curr_year=qs[qs.length - 1];
//alert(Curr_year);
}

if (qs[2]==1)
{
Curr_mon=qs[1]-1;

if("1: " + Curr_mon<0)
{
Curr_mon=11;
Curr_year=Curr_year-1;

}
}


if (qs[2]==2)
{
Curr_mon=parseInt(qs[1])+1;

if(Curr_mon>11)
{
Curr_mon=0;
Curr_year=parseInt(Curr_year)+1;

}

}





curr_mod=(Curr_year) % 4

monthaddr=Curr_year-2008



yearadd=monthaddr
if (curr_mod==0)
{
febcnt=29;
addr=1;
jan=1+yearadd
feb=4+yearadd
mar=4+addr+yearadd
apr=0+addr+yearadd
may=2+addr+yearadd
jun=5+addr+yearadd
jul=0+addr+yearadd
aug=3+addr+yearadd
sep=6+addr+yearadd
oct=1+addr+yearadd
nov=4+addr+yearadd
dec=6+addr+yearadd
}
else
{
addr=1;
jan=1+addr+yearadd
feb=4+addr+yearadd
mar=4+addr+yearadd
apr=0+addr+yearadd
may=2+addr+yearadd
jun=5+addr+yearadd
jul=0+addr+yearadd
aug=3+addr+yearadd
sep=6+addr+yearadd
oct=1+addr+yearadd
nov=4+addr+yearadd
dec=6+addr+yearadd
}








months = new Array()
months[0]=new mojo("January",31,jan,Curr_year1);
months[1]=new mojo("February",febcnt,feb,Curr_year1);
months[2]=new mojo("March",31,mar,Curr_year1);
months[3]=new mojo("April",30,apr,Curr_year1);
months[4]=new mojo("May",31,may,Curr_year1);
months[5]=new mojo("June",30,jun,Curr_year1);
months[6]=new mojo("July",31,jul,Curr_year1);
months[7]=new mojo("August",31,aug,Curr_year1);
months[8]=new mojo("September",30,sep,Curr_year1);
months[9]=new mojo("October",31,oct,Curr_year1);
months[10]=new mojo("November",30,nov,Curr_year1);
months[11]=new mojo("December",31,dec,Curr_year1);




function Parsexml()

{
try //Internet Explorer
  {
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  }
catch(e)
  {
  try //Firefox, Mozilla, Opera, etc.
    {
    xmlDoc=document.implementation.createDocument("","",null);
    }
  catch(e)
    {
    alert(e.message);
    return;
    }
  }
xmlDoc.async=false;
xmlDoc.load("xml/Calendar.xml");

x=xmlDoc.getElementsByTagName("month");

countr=0;


for (a=0;a<x.length;a++)
{
if (xmlDoc.getElementsByTagName("month")[a].childNodes[0].nodeValue == months[Curr_mon].month && xmlDoc.getElementsByTagName("date_year")[a].childNodes[0].nodeValue == Curr_year && xmlDoc.getElementsByTagName("active")[a].childNodes[0].nodeValue.toUpperCase() == "YES")
{
e1=xmlDoc.getElementsByTagName("month")[a].childNodes[0].nodeValue;
e2=xmlDoc.getElementsByTagName("date_start")[a].childNodes[0].nodeValue;
e3=xmlDoc.getElementsByTagName("date_end")[a].childNodes[0].nodeValue;
e4=xmlDoc.getElementsByTagName("date_year")[a].childNodes[0].nodeValue;
e5=xmlDoc.getElementsByTagName("title")[a].childNodes[0].nodeValue;
e6=xmlDoc.getElementsByTagName("s_link")[a].childNodes[0].nodeValue;
e7=xmlDoc.getElementsByTagName("purpose")[a].childNodes[0].nodeValue;
e8=xmlDoc.getElementsByTagName("city")[a].childNodes[0].nodeValue;
e9=xmlDoc.getElementsByTagName("state")[a].childNodes[0].nodeValue;
e10=xmlDoc.getElementsByTagName("nation")[a].childNodes[0].nodeValue;
e11=xmlDoc.getElementsByTagName("contact")[a].childNodes[0].nodeValue;
e12=xmlDoc.getElementsByTagName("contact_num")[a].childNodes[0].nodeValue;
e13=xmlDoc.getElementsByTagName("contact_email")[a].childNodes[0].nodeValue;
e14=xmlDoc.getElementsByTagName("active")[a].childNodes[0].nodeValue;
e15=xmlDoc.getElementsByTagName("id")[a].childNodes[0].nodeValue;


Events[countr] = new create_Event(e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15)


countr=countr+1

}
else
{

}
}

}

// Conference Sponsors //
document.write("<td style='width:260px;'  valign='top' class='tdpad'>")
document.write("<p class='IASHBigHdr'>IASH<span class='style1'></span> Resources</p>")
document.write("<p><ul class='bodytext'>")
document.write("<li><a href='http://iash.net/faq.html' class='moreinfo'>Frequently Asked Questions</a></li>")
document.write("<li><a href='http://iash.net/fuel_spec.html' class='moreinfo'>Fuel Specifications</a> </li>")
document.write("<li><a href='http://iash.net/testtechstan.html' class='moreinfo'>Test Technology and Standards</a> </li>")
document.write("<li><a href='http://iash.omnibooksonline.com' target='_blank' class='moreinfo'>IASH Library</a></li>")
document.write("<li><a href='http://iash.net/news.html' class='moreinfo'>IASH Newsletter</a></li>")
document.write("<li><a href='http://iash.net/indy_links.html' class='moreinfo'>Industry Links</a></li>")
document.write("<li><a href='http://iash.net/relevant_meetings.html' class='moreinfo'>Related Conferences & Events</a></li>")
document.write("</ul>")
document.write("</p>")
document.write("<p class='IASHBigHdr'>Conferences & Related Events</p><p>")

//End Sponsors


//Calendar
Parsexml();

countr2=0;

for (f=0;f<Events.length;f++)
{

range=Events[f].date_end-Events[f].date_start

for (e=0;e<=range;e++)
{
daterange[countr2]=parseInt(Events[f].date_start)+e

date_href[countr2]=Events[f].month+"$$"+Events[f].id
countr2=countr2+1
}


}



for (f=0;f<Events.length;f++)
{
range=Events[f].date_end-Events[f].date_start
num=parseInt(Events[f].date_end);
for (f1=Events[f].date_start;f1<=num;f1++)
{
if (date_href1[f1]==undefined)
{
date_href1[f1]=Events[f].month+"$$"+Events[f].id
}
else
{
date_href1[f1]=date_href1[f1]+"="+Events[f].month+"$$"+Events[f].id
}
}

}






countr2=countr2-1
document.write("<table cellspacing='0' class='table_border' width='200' height='160' bgcolor='#E4E9EE'>");
document.write("<tr bgcolor='#666666' class='cal_font'>");
document.write("<td colspan='7' align='center' ><a href='"+this_page+"?sub="+Curr_mon+"=1="+Curr_year+"' ><img src='http://iash.net/images/LArrow.gif' border='0' ></a>&nbsp;&nbsp;<b>"+months[Curr_mon].month+"&nbsp;"+Curr_year+"</b>&nbsp;&nbsp;<a href='"+this_page+"?sub="+Curr_mon+"=2="+Curr_year+"'><img src='http://iash.net/images/RArrow.gif' border='0'  ></a>");

document.write("</td>");
document.write("</tr>")

document.write("<tr bgcolor='#95A8BD' class='cal_font'>")

document.write("<td align='center'>M")
document.write("</td>");

document.write("<td align='center'>T");
document.write("</td>")

document.write("<td align='center'>W")
document.write("</td>")

document.write("<td align='center'>T")
document.write("</td>")

document.write("<td align='center'>F")
document.write("</td>")

document.write("<td align='center'>S")
document.write("</td>")

document.write("<td align='center'>S")
document.write("</td>")

document.write("</tr>")

rowchg=1
dayincremtr=1
dayincremtr=dayincremtr-months[Curr_mon].adder
document.write("<tr bgcolor='#E4E9EE' class='cal_font_a'>")
for (i=dayincremtr;i<=months[Curr_mon].days;i++)
{
daycount=i
rowchg=rowchg+1

if (daycount<1)
{
daycount=""
}

for (g=0;g<=countr2;g++)

{
if (daycount==daterange[g])
{
tabchg = "yes"
dabu=date_href[g]
}

}

if (tabchg=='yes')
{
document.write("<td bgcolor='#C0D99E' align='center'><a href='http://iash.net/meetings.html?eve="+daycount+"="+date_href1[daycount]+"="+Curr_year+"' class='moreinfo'>"+daycount+"</a>")
}
else
{
document.write("<td align='center'>"+daycount)
}

document.write("</td>");
if (rowchg==8){
document.write("</tr>")
document.write("<tr bgcolor='#E4E9EE' class='cal_font_a'>")
rowchg=1;
}
tabchg='no'
}
document.write("</tr>")

document.write("</table>")
//End Calendar

document.write("<p class='IASHBigHdr'>IASH<span class='style1'></span> Resources</p>")
document.write("<p><ul class='bodytext'>")
document.write("<li><a href='http://iash.net/faq.html' class='moreinfo'>Frequently Asked Questions</a></li>")
document.write("<li><a href='http://iash.net/fuel_spec.html' class='moreinfo'>Fuel Specifications</a> </li>")
document.write("<li><a href='http://iash.net/testtechstan.html' class='moreinfo'>Test Technology and Standards</a> </li>")
document.write("<li><a href='http://iash.omnibooksonline.com' target='_blank' class='moreinfo'>IASH Library</a></li>")
document.write("<li><a href='http://iash.net/news.html' class='moreinfo'>IASH Newsletter</a></li>")
document.write("<li><a href='http://iash.net/indy_links.html' class='moreinfo'>Industry Links</a></li>")
document.write("<li><a href='http://iash.net/relevant_meetings.html' class='moreinfo'>Related Conferences & Events</a></li>")
document.write("</ul>")
document.write("</p>")
document.write("</td></tr></table></td></tr>")

