<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
	<ModulePrefs title="Expedia Fare Calendar" 
	    title_url="http://www.expedia.com/Default.asp?olacid=gw.farecalendar"
	    description= "Looking for great deals on airfare? Find great low fares for your flight with the Expedia Fare Calendar. Enter your origin and destination to see the best flight deals recently found by Expedia travelers for each day of the month. Then click through to Expedia.com to book your flight and save." 
	    directory_title="Expedia Fare Calendar"
	    author=""
	    author_email=""
	    screenshot="http://search.expediaguides.com/tripplanner/images/ExpediaFlexFareCal.png"
	    thumbnail="http://search.expediaguides.com/tripplanner/images/ExpediaFlexFareCal-thum.png"
	    author_affiliation="Expedia.com"
	    author_location="Bellevue, WA"
	    category="tools" category2="lifestyle"
	    scaling="true"
	    scrolling="false"
	    singleton="false"
	    render_inline="optional"
	    height="325" >
	<Require feature="setprefs" />
	<Require feature="dynamic-height"/>
	
	</ModulePrefs>
  
	<UserPref name="color" display_name="Color" default_value="Yellow" datatype="enum" >
		<EnumValue display_value="Yellow" value="yellow" />
		<EnumValue display_value="Blue" value="blue" />
		<EnumValue display_value="Green" value="green" />
		<EnumValue display_value="Tan" value="tan" />
		<EnumValue display_value="Gray" value="silver" />
	</UserPref> 

	<UserPref name="DepatureAirport" display_name="Leaving From:" required="true" datatype="enum">
		<EnumValue value="ATL" display_value="Atlanta, GA (ATL)"/>
		<EnumValue value="AUS" display_value="Austin, TX (AUS)"/>
		<EnumValue value="BWI" display_value="Baltimore, MD (BWI)"/>
		<EnumValue value="BOS" display_value="Boston, MA (BOS)"/>
		<EnumValue value="CLT" display_value="Charlotte, NC (CLT)"/>
		<EnumValue value="MDW" display_value="Chicago, IL (MDW)"/>
		<EnumValue value="ORD" display_value="Chicago, IL (ORD)"/>
		<EnumValue value="CVG" display_value="Cincinnati, OH (CVG)"/>
		<EnumValue value="CLE" display_value="Cleveland, OH (CLE)"/>
		<EnumValue value="CMH" display_value="Columbus, OH (CMH)"/>
		<EnumValue value="DFW" display_value="Dallas, TX (DFW)"/>
		<EnumValue value="DAY" display_value="Dayton, OH (DAY)"/>
		<EnumValue value="DEN" display_value="Denver, CO (DEN)"/>
		<EnumValue value="DTW" display_value="Detroit, MI (DTW)"/>
		<EnumValue value="FLL" display_value="Fort Lauderdale, FL (FLL)"/>
		<EnumValue value="BDL" display_value="Hartford, CT (BDL)"/>
		<EnumValue value="IAH" display_value="Houston, TX (IAH)"/>
		<EnumValue value="IND" display_value="Indianapolis, IN (IND)"/>
		<EnumValue value="MCI" display_value="Kansas City, MO (MCI)"/>
		<EnumValue value="LAS" display_value="Las Vegas, NV (LAS)"/>
		<EnumValue value="LAX" display_value="Los Angeles, CA (LAX)"/>
		<EnumValue value="MHT" display_value="Manchester, NH (MHT)"/>
		<EnumValue value="MIA" display_value="Miami, FL (MIA)"/>
		<EnumValue value="MKE" display_value="Milwaukee, WI (MKE)"/>
		<EnumValue value="MSP" display_value="Minneapolis, MN (MSP)"/>
		<EnumValue value="BNA" display_value="Nashville, TN (BNA)"/>
		<EnumValue value="MSY" display_value="New Orleans, LA (MSY)"/>
		<EnumValue value="JFK" display_value="New York, NY (JFK)"/>
		<EnumValue value="LGA" display_value="New York, NY (LGA)"/>
		<EnumValue value="EWR" display_value="Newark, NJ (EWR)"/>
		<EnumValue value="OAK" display_value="Oakland, CA (OAK)"/>
		<EnumValue value="OMA" display_value="Omaha, NE (OMA)"/>
		<EnumValue value="SNA" display_value="Orange County, CA (SNA)"/>
		<EnumValue value="MCO" display_value="Orlando, FL (MCO)"/>
		<EnumValue value="PHL" display_value="Philadelphia, PA (PHL)"/>
		<EnumValue value="PHX" display_value="Phoenix, AZ (PHX)"/>
		<EnumValue value="PIT" display_value="Pittsburgh, PA (PIT)"/>
		<EnumValue value="PDX" display_value="Portland, OR (PDX)"/>
		<EnumValue value="PVD" display_value="Providence, RI (PVD)"/>
		<EnumValue value="RDU" display_value="Raleigh, NC (RDU)"/>
		<EnumValue value="SMF" display_value="Sacramento, CA (SMF)"/>
		<EnumValue value="SLC" display_value="Salt Lake City, UT (SLC)"/>
		<EnumValue value="SAN" display_value="San Diego, CA (SAN)"/>
		<EnumValue value="SFO" display_value="San Francisco, CA (SFO)"/>
		<EnumValue value="SJC" display_value="San Jose, CA (SJC)"/>
		<EnumValue value="SEA" display_value="Seattle, WA (SEA)"/>
		<EnumValue value="STL" display_value="St. Louis, MO (STL)"/>
		<EnumValue value="TPA" display_value="Tampa, FL (TPA)"/>
		<EnumValue value="DCA" display_value="Washington, DC (DCA)"/>
		<EnumValue value="IAD" display_value="Washington, DC (IAD)"/>
	</UserPref>
  
	<UserPref name="ArrivalAirport" display_name="Going To:" required="true" datatype="enum">
		<EnumValue value="ATL" display_value="Atlanta, GA (ATL)"/>
		<EnumValue value="AUS" display_value="Austin, TX (AUS)"/>
		<EnumValue value="BWI" display_value="Baltimore, MD (BWI)"/>
		<EnumValue value="BOS" display_value="Boston, MA (BOS)"/>
		<EnumValue value="CLT" display_value="Charlotte, NC (CLT)"/>
		<EnumValue value="ORD" display_value="Chicago, IL (ORD)"/>
		<EnumValue value="CLE" display_value="Cleveland, OH (CLE)"/>
		<EnumValue value="CMH" display_value="Columbus, OH (CMH)"/>
		<EnumValue value="DFW" display_value="Dallas, TX (DFW)"/>
		<EnumValue value="DEN" display_value="Denver, CO (DEN)"/>
		<EnumValue value="DTW" display_value="Detroit, MI (DTW)"/>
		<EnumValue value="FLL" display_value="Fort Lauderdale, FL (FLL)"/>
		<EnumValue value="RSW" display_value="Fort Myers, FL (RSW)"/>
		<EnumValue value="BDL" display_value="Hartford, CT (BDL)"/>
		<EnumValue value="HNL" display_value="Honolulu, Oahu, HI (HNL)"/>
		<EnumValue value="IAH" display_value="Houston, TX (IAH)"/>
		<EnumValue value="IND" display_value="Indianapolis, IN (IND)"/>
		<EnumValue value="JAX" display_value="Jacksonville, FL (JAX)"/>
		<EnumValue value="MCI" display_value="Kansas City, MO (MCI)"/>
		<EnumValue value="LAS" display_value="Las Vegas, NV (LAS)"/>
		<EnumValue value="LAX" display_value="Los Angeles, CA (LAX)"/>
		<EnumValue value="MIA" display_value="Miami, FL (MIA)"/>
		<EnumValue value="MSP" display_value="Minneapolis, MN (MSP)"/>
		<EnumValue value="BNA" display_value="Nashville, TN (BNA)"/>
		<EnumValue value="MSY" display_value="New Orleans, LA (MSY)"/>
		<EnumValue value="JFK" display_value="New York, NY (JFK)"/>
		<EnumValue value="LGA" display_value="New York, NY (LGA)"/>
		<EnumValue value="EWR" display_value="Newark, NJ (EWR)"/>
		<EnumValue value="OAK" display_value="Oakland, CA (OAK)"/>
		<EnumValue value="SNA" display_value="Orange County, CA (SNA)"/>
		<EnumValue value="MCO" display_value="Orlando, FL (MCO)"/>
		<EnumValue value="PHL" display_value="Philadelphia, PA (PHL)"/>
		<EnumValue value="PHX" display_value="Phoenix, AZ (PHX)"/>
		<EnumValue value="PIT" display_value="Pittsburgh, PA (PIT)"/>
		<EnumValue value="PDX" display_value="Portland, OR (PDX)"/>
		<EnumValue value="RDU" display_value="Raleigh, NC (RDU)"/>
		<EnumValue value="RNO" display_value="Reno, NV (RNO)"/>
		<EnumValue value="SLC" display_value="Salt Lake City, UT (SLC)"/>
		<EnumValue value="SAT" display_value="San Antonio, TX (SAT)"/>
		<EnumValue value="SAN" display_value="San Diego, CA (SAN)"/>
		<EnumValue value="SFO" display_value="San Francisco, CA (SFO)"/>
		<EnumValue value="SJC" display_value="San Jose, CA (SJC)"/>
		<EnumValue value="SEA" display_value="Seattle, WA (SEA)"/>
		<EnumValue value="STL" display_value="St. Louis, MO (STL)"/>
		<EnumValue value="TPA" display_value="Tampa, FL (TPA)"/>
		<EnumValue value="DCA" display_value="Washington, DC (DCA)"/>
		<EnumValue value="IAD" display_value="Washington, DC (IAD)"/>
		<EnumValue value="PBI" display_value="West Palm Beach, FL (PBI)"/>

	</UserPref>
  
	<UserPref  name="DepartDate" display_name="Departure Month:" required="false" datatype="enum">
		<EnumValue display_value="May, 2009" value="5/1/2009"/>
		<EnumValue display_value="June, 2009" value="6/1/2009"/>
		<EnumValue display_value="July, 2009" value="7/1/2009"/>
		<EnumValue display_value="Aug, 2009" value="8/1/2009"/>
		<EnumValue display_value="Sept, 2009" value="9/1/2009"/>
		<EnumValue display_value="Oct, 2009" value="10/1/2009"/>
		<EnumValue display_value="Nov, 2009" value="11/1/2009"/>
		<EnumValue display_value="Dec, 2009" value="12/1/2009"/>
		<EnumValue display_value="Jan, 2010" value="1/1/2010"/>
		<EnumValue display_value="Feb, 2010" value="2/1/2010"/>
		<EnumValue display_value="March, 2010" value="3/1/2010"/>
		<EnumValue display_value="April, 2010" value="4/1/2010"/>
	</UserPref>

	<Content type="html"> 
		<![CDATA[
		<script src="http://www.google.com/js/nxsl.1.js" type="text/javascript"></script>
		<style>
		.clicktoprice { font-size:8pt; color: #0000FF; text-decoration: underline;font-family: Arial;cursor:pointer;}
		.hasprice { color: #0000FF; text-decoration: underline;cursor:pointer;}
		.cal {}
		.calborder	{ border-width:2px; border-style:solid; border-color:#336699}
		.cal td { text-align:center; font-size:8pt; border-width:1px; border-style:solid;}
		.cal td.head { font-size:12px; font-weight:bold; border-width:0px;font-family: Arial;}
		.cal td.arrow { background-color:#white; border-width:0px}
		
		.cal td.disabled {background-color:white; color:#CCCCCC; border-color:#E2E6EF}
		.best {background-color:#FFDF7B !important;border-color:#FFDF7B !important; cursor:pointer;}
		.sel {background-color:#D8EFCE !important; border-color:#9CD379 !important; border-width: 1px; border-style:solid;}
		
		
		.farPast	{border-width:1px; border-color:#E2E6EF; border-style:solid; background-color:#FFFFFF; color:#CCCCCC;font-family: Arial; background-image:url("http://www.expedia.com/eta/past_date.gif")}
		.farFuture	{border-width:1px; border-color:#E2E6EF; border-style:solid; background-color:#FFFFFF; color:#CCCCCC;font-family: Arial;}
		.unselDep	{border-width:1px; border-color:#E2E6EF; border-style:solid; background-color:#FFFFFF; color:#000000; cursor:hand;font-family: Arial;}
		.dontshowprc	{border-width:1px; border-color:#E2E6EF; border-style:solid; background-color:#FFFFFF; color:#000000;font-family: Arial;}
	
	
		.lowest	{border-width:1px; background-color:#FECB05; border-color:#FECB05; cursor:pointer;font-family: Arial;}
		.showPrc	{border-width:1px; background-color:#C8D4EE; border-color:#C8D4EE; cursor:pointer;font-family: Arial;}
		.selDep	{border-width:1px; background-color:#9CD379; border-color:#9CD379;font-family: Arial;}
		.inside	{border-width:0px; background-color:#FFFFFF; border-color:#FFFFFF; filter: progid:DXImageTransform.Microsoft.alpha(opacity=75);-moz-opacity: 0.75;}
		.exphdr { text-align:center; font-family: Arial; font-weight:bold; font-size:12px; border-width:0px; border-style:solid; }
		.expftr { text-align:center; color:#333399; font-family: Arial; font-size:11px; border-width:0px; border-style:solid; background-color:#FFFFFF;}
		.expairpc {text-align:center; color:#CC6600; font-family: Arial; font-weight:bold; font-size:12px; border-width:0px;}
		.ftrimg {align:baseline; position:relative; top: 2px;}
		.ftrlink {position:relative; margin-left:6px;}
		.exphdrimg { text-align:left; font-family: Arial; font-weight:bold; font-size:12px; border-width:0px; border-style:solid; }
		.exptxt { text-align:left; font-family: Arial; font-weight:normal; font-size:12px; border-width:0px; border-style:solid; }		
		
		
		.rc_top_yellow div {background: url(http://search.expediaguides.com/tripplanner/images/tl_yellow.gif) no-repeat top left;}
		.rc_top_yellow {background: transparent url(http://search.expediaguides.com/tripplanner/images/tr_yellow.gif) no-repeat top right;}
		
		.rc_top_blue div {background: url(http://search.expediaguides.com/tripplanner/images/tl_blue.gif) no-repeat top left;}
		.rc_top_blue {background: transparent url(http://search.expediaguides.com/tripplanner/images/tr_blue.gif) no-repeat top right;}
		
		.rc_top_green div {background: url(http://search.expediaguides.com/tripplanner/images/tl_green.gif) no-repeat top left;}
		.rc_top_green {background: transparent url(http://search.expediaguides.com/tripplanner/images/tr_green.gif) no-repeat top right;}
		
		.rc_top_tan div {background: url(http://search.expediaguides.com/tripplanner/images/tl_tan.gif) no-repeat top left;}
		.rc_top_tan {background: transparent url(http://search.expediaguides.com/tripplanner/images/tr_tan.gif) no-repeat top right;}
		
		.rc_top_silver div {background: url(http://search.expediaguides.com/tripplanner/images/tl_silver.gif) no-repeat top left;}
		.rc_top_silver {background: transparent url(http://search.expediaguides.com/tripplanner/images/tr_silver.gif) no-repeat top right;}
		
		.rc_bot div {background: url(http://search.expediaguides.com/tripplanner/images/bl.gif) no-repeat bottom left;}
		.rc_bot {background: transparent url(http://search.expediaguides.com/tripplanner/images/br.gif) no-repeat bottom right;}
		
		.rc_top_yellow div, .rc_yellow, .rc_bot div, .rc_bot {width: 100%;height: 10px;font-size: 1px;}
		.rc_top_blue div, .rc_top_blue, .rc_top_green div, .rc_top_green {width: 100%;height: 10px;font-size: 1px;}
		.rc_top_tan div, .rc_top_tan, .rc_top_silver div, .rc_top_silver {width: 100%;height: 10px;font-size: 1px;}
		.rc_content { margin: 0 10px; }
		
		.rc_box_yellow { background: #f4d425 url(http://search.expediaguides.com/tripplanner/images/yellow.gif) repeat-x top left;}
		.rc_box_green { background: #4ca64c url(http://search.expediaguides.com/tripplanner/images/green.gif) repeat-x top left;}
		.rc_box_blue { background: #7094b7 url(http://search.expediaguides.com/tripplanner/images/blue.gif) repeat-x top left;}
		.rc_box_tan { background: #C5BB9E url(http://search.expediaguides.com/tripplanner/images/tan.gif) repeat-x top left;}
		.rc_box_silver { background: #CCCCCC url(http://search.expediaguides.com/tripplanner/images/silver.gif) repeat-x top left;}
		
		.rc_conborder_yellow { margin: 0 0px; border-left:1px solid #f4d425;border-right:1px solid #f4d425;}
		.rc_conborder_green { margin: 0 0px; border-left:1px solid #1e860d;border-right:1px solid #1e860d;}
		.rc_conborder_blue { margin: 0 0px; border-left:1px solid #34679a;border-right:1px solid #34679a;}
		.rc_conborder_tan { margin: 0 0px; border-left:1px solid #C5BB9E;border-right:1px solid #C5BB9E;}
		.rc_conborder_silver { margin: 0 0px; border-left:1px solid #CCCCCC;border-right:1px solid #CCCCCC;}

		
		</style>
		<div id="content___MODULE_ID__"></div>
		<script type="text/javascript">
		var arVersion = navigator.appVersion.split("MSIE")
		var version = parseFloat(arVersion[1])
		
		function fixPNG(myImage) 
		{
			if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
			{
			   var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
			   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
			   var imgTitle = (myImage.title) ? 
							 "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
			   var imgStyle = "display:inline-block;" + myImage.style.cssText
			   var strNewHTML = "<span " + imgID + imgClass + imgTitle
						  + " style=\"" + "width:" + myImage.width 
						  + "px; height:" + myImage.height 
						  + "px;" + imgStyle + ";"
						  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
						  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
			   myImage.outerHTML = strNewHTML	  
			}
		}		
	  // Get user preferences
		var prefs = new _IG_Prefs(__MODULE_ID__);
 
		function loadExpFlexFareCalURL(seldate)
		{
			var depair = prefs.getString("DepatureAirport");
			var arrair = prefs.getString("ArrivalAirport");
			var depmonth =prefs.getString("DepartDate");
		  
			var lpURL="http://www.expedia.com/pub/agent.dll?qscr=flex&subm=1&city="+depair;
			lpURL += "&citd="+arrair+"&date1="+seldate+"&olacid=gw.farecalendar";
			window.open(lpURL);
	  
		}
		
		function expFlexFareCalchangeMonth(mod_month)
		{
			prefs.set("DepartDate", mod_month);
			LoadFlexFareCal___MODULE_ID__();
	  
		}

		function LoadFlexFareCal___MODULE_ID__() 
		{
          
			var depairportcode = prefs.getString("DepatureAirport");
			var arrairportcode = prefs.getString("ArrivalAirport");
			var depmonth =prefs.getString("DepartDate");
		  
			var selectedColor = prefs.getString("color");
			
			if(selectedColor == "gray")
				selectedColor = "tan";
			
			if(selectedColor == "lblue")
				selectedColor = "silver";
				
			var rcbox = "rc_box_"+selectedColor;
			var rctop = "rc_top_"+selectedColor;
			var rcbottom = "rc_bot";
			var rccontent = "rc_content";
			var rcborder = "rc_conborder_"+selectedColor;
       
            var url = 'http://search.expediaguides.com/tripplanner/GetFlexFareXml?';
			
            if(depairportcode != null)
              url += "&DepAirportCode=" + depairportcode;
			if(arrairportcode != null)
              url += "&arrAirportCode=" + arrairportcode;
			url +=  "&depDate="+depmonth;
			
			// Get the xml from the constructed URL
            _IG_FetchContent(url, function (responseXml) 
			{
				if (responseXml == null ) 
				{
					
					var errhtml = '<div id="exp_out___MODULE_ID__" >';
					errhtml +='<div class="'+rcbox+'"><div class="'+rctop+'"><div></div></div>';
			
					errhtml +='<div class="'+rcborder+'">';

					errhtml +='<div class="'+rccontent+'">';
					errhtml += '<TABLE align="center" width="231" class="exphdr">';
					errhtml += '<tr><td class="exphdrimg" align="left"><a href="http://www.expedia.com/Default.asp?olacid=gw.farecalendar" TARGET="resource window"><img src="http://search.expediaguides.com/tripplanner/images/exp_logo.png" align="left" border="0" alt="Expedia Home" onload="fixPNG(this)" /></a></td></tr>';
					errhtml += '<tr><td class="exptxt">';
					errhtml += "Expedia's fare calendar service is currently unavailable. Please check back later.</td></tr></table>";
					errhtml += '</div></div><div class="'+rcbottom+'"><div></div></div></div></div>';
					errhtml += '<div id="exp_ftr___MODULE_ID__" style="background-color:#ffffff;"><table align=center width="231" class="expftr"><tr align=center width="231"><td align=center width="25%"  class="expftr">';
					errhtml += '<img class="ftrimg"src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif" /><a href="http://www.expedia.com/daily/flights/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Flights</span></a></td>';
					errhtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/hotels/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Hotels</span></a></td>';
					errhtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/cars/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Cars</span></a></td>';
					errhtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/deals/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Deals</span></a></td></tr></table></td></tr></div>';
					_gel("content___MODULE_ID__").innerHTML = errhtml;
					// Tells gadget to resize itself
					_IG_AdjustIFrameHeight();
					return;
				} 
				else
				{
					var xmldoc;
					if (window.ActiveXObject) 
					{
						xmldoc = new ActiveXObject("MSXML2.DOMDocument");
						xmldoc.loadXML(responseXml);
						xmldoc.setProperty("SelectionLanguage", "XPath");
					}
					else 
					{
						xmldoc = (new DOMParser).parseFromString(responseXml, "text/xml");
					}
					var flexCalelements = xmldoc.getElementsByTagName('FlexCalPrices')[0];
					if(flexCalelements == null)
					{
						var nodealshtml = '<div id="exp_out___MODULE_ID__" >';
						nodealshtml +='<div class="'+rcbox+'"><div class="'+rctop+'"><div></div></div>';
				
						nodealshtml +='<div class="'+rcborder+'">';

						nodealshtml +='<div class="'+rccontent+'">';
						nodealshtml += '<TABLE align="center" width="231" class="exphdr">';
						nodealshtml += '<tr><td class="exphdrimg" align="left"><a href="http://www.expedia.com/Default.asp?olacid=gw.farecalendar" TARGET="resource window"><img src="http://search.expediaguides.com/tripplanner/images/exp_logo.png" align="left" border="0" alt="Expedia Home" onload="fixPNG(this)" /></a></td></tr>';
						nodealshtml += '<tr><td class="exptxt">No Expedia Fares currently meet your criteria. Please check back later, or try modyfying your settings.</td></tr></table>';
						nodealshtml += '</div></div><div class="'+rcbottom+'"><div></div></div></div></div>';
				
				
						nodealshtml += '<div id="exp_ftr___MODULE_ID__" style="background-color:#ffffff;"><table align=center width="231" class="expftr"><tr align=center width="231"><td align=center width="25%"  class="expftr">';
						nodealshtml += '<img class="ftrimg"src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif" /><a href="http://www.expedia.com/daily/flights/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Flights</span></a></td>';
						nodealshtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/hotels/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Hotels</span></a></td>';
						nodealshtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/cars/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Cars</span></a></td>';
						nodealshtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/deals/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Deals</span></a></td></tr></table></td></tr></div>';
						_gel("content___MODULE_ID__").innerHTML = nodealshtml;
						// Tells gadget to resize itself
						_IG_AdjustIFrameHeight();
						
						return;
					}
					
					
					var dayelements = xmldoc.getElementsByTagName('Day');
					var cheapestelement = xmldoc.getElementsByTagName('Cheapest');
					var cheapestPriceInt = parseInt(cheapestelement[0].childNodes[0].nodeValue);
					var priceelements = xmldoc.getElementsByTagName('Price');
					var pricelength= priceelements.length;
					
					var day, month, year;
			
					if(depmonth != null)
					{
						var dateArray = depmonth.split("/");						
						var month= (dateArray[0]-1);
						var day= dateArray[1];
						var year= dateArray[2];
					}
					else
					{
						var date =  new Date();
						day = date.getDate();
						month = date.getMonth();
						year = date.getFullYear();
			
					}

					months = new Array('JANUARY','FEBRUARY','MARCH', 'APRIL','MAY','JUNE','JULY','AUGUST',
									'SEPTEMBER','OCTOBER','NOVEMBER','DECEMBER');
         
					this_month = new Date(year, month, 1);
					next_month = new Date(year, month + 1, 1);
					prev_month = new Date(year, month-1, 1);
					var curdate =  new Date();
					var curMonth = curdate.getMonth();
					var showPrevArrow = true;
		
					if(prev_month.getFullYear() == curdate.getFullYear() )
					{
						if(prev_month.getMonth() < curdate.getMonth()) 
						{
							showPrevArrow = false;
						}
					} else if(curdate.getFullYear() < prev_month.getFullYear())
					{
						showPrevArrow = true;
					}
		
				var prevMonStr=prev_month.getMonth()+1+"/"+prev_month.getDate()+"/"+prev_month.getFullYear();
				
				var nextMonStr = next_month.getMonth()+1+"/"+next_month.getDate()+"/"+next_month.getFullYear();
		
				 //Find out when this month starts and ends.         
				first_week_day = this_month.getDay();
				days_in_this_month = Math.round((next_month.getTime() - this_month.getTime()) / (1000 * 60 * 60 * 24));
				 
				calendar_html = '<TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 CLASS="cal calborder" STYLE="border-color:#336699;background-color:ffffff;">';
				 
				calendar_html += '<tr><TD COLSPAN=7 STYLE="border-width:0px">';
				calendar_html += '<TABLE ALIGN=center BORDER=0 CELLPADDING=0 CELLSPACING=0 CLASS=cal WIDTH=231 STYLE="background-color:ffffff;">';
				calendar_html += '<TR WIDTH=231 HEIGHT=20 ALIGN=center><TD CLASS=head HEIGHT=20 WIDTH=20 ALIGN=center>';
				if(showPrevArrow) 
				{
					calendar_html += '<A ID="exp_rtarrow___MODULE_ID__" HREF="javascript:expFlexFareCalchangeMonth('+"'"+prevMonStr+"'"+')">';
					calendar_html += '<IMG SRC="http://search.expediaguides.com/tripplanner/images/arrow_left.gif" alt="Prev Month" BORDER=0 ALIGN=LEFT WIDTH=20 HEIGHT=20></A>'
				}
				calendar_html += ' </TD>';
				calendar_html += '<TD CLASS=head HEIGHT=20 WIDTH="80%" ALIGN=center>' +  months[month] + ' ' + year + '</TD>';
				calendar_html += '<TD CLASS=head HEIGHT=20 WIDTH=20 ALIGN=center>';
				calendar_html += '<A ID="exp_rtarrow___MODULE_ID__" HREF="javascript:expFlexFareCalchangeMonth('+"'"+nextMonStr+"'"+')">';
				calendar_html += '<IMG SRC="http://search.expediaguides.com/tripplanner/images/arrow_right.gif" alt="Next Month" BORDER=0 ALIGN=RIGHT WIDTH=20 HEIGHT=20></A>';		  
				calendar_html += '</TD></TR></TABLE></tr>';
				calendar_html +=" <TR ALIGN=center><TD STYLE='border-width:0px;font-family: Arial;' WIDTH=33>Sun </TD>";
				calendar_html +="<TD STYLE='border-width:0px;font-family: Arial;' WIDTH=33>Mon </TD>";
				calendar_html +="<TD STYLE='border-width:0px;font-family: Arial;' WIDTH=33>Tue </TD>";
				calendar_html +="<TD STYLE='border-width:0px;font-family: Arial;' WIDTH=33>Wed </TD>";
				calendar_html +="<TD STYLE='border-width:0px;font-family: Arial;' WIDTH=33>Thu </TD>";
				calendar_html +="<TD STYLE='border-width:0px;font-family: Arial;' WIDTH=33>Fri </TD>";
				calendar_html +="<TD STYLE='border-width:0px;font-family: Arial;' WIDTH=33>Sat </TD></TR>";
				calendar_html += '<tr>';
				  
				//Fill the first week of the month with the appropriate number of blanks.       
				for(week_day = 0; week_day < first_week_day; week_day++)
				{
					
					calendar_html += '<TD width=33 height=33 align=center valign=middle CLASS=farFuture>';
					calendar_html += '<TABLE CELLPADDING=0 CELLSPACING=0>';
					calendar_html += '<TR><TD CLASS="inside" ALIGN=CENTER WIDTH=31 HEIGHT=31>&nbsp;';
					calendar_html += '</TD></TR></TABLE></TD>';
					//calendar_html += '<td style="background-color:ffffff; color:ffffff;border-width:1px;border-color:#336699;"> </td>';   
				}
					
				week_day = first_week_day;
				for(day_counter = 1; day_counter <= days_in_this_month; day_counter++)
				{
						week_day %= 7;
					
						if(week_day == 0) 
						{
							calendar_html += '</tr><tr>';
						}
						
						var curdate = (month+1)+'/'+day_counter+'/'+year;
						//alert(curdate);
						var  pricefound = false;
						var curPrice="";
						for(var dayi=0; dayi < dayelements.length; dayi++)
						{
							//alert("dayval="+dayelements[dayi].childNodes[0].nodeValue);	
							if(curdate == dayelements[dayi].childNodes[0].nodeValue)
							{
								pricefound = true;
								curPrice = priceelements[dayi].childNodes[0].nodeValue;
								break;
							}
								
							
						}
						if(pricefound)
						{
							var curPriceInt = parseInt(curPrice.replace('$', ''));
							if(curPriceInt <= cheapestPriceInt)
							{
								calendar_html += '<TD width=33 height=33 align=center valign=middle  onClick="loadExpFlexFareCalURL(';
								calendar_html += "'"+curdate+"'"+')" CLASS=lowest>';
								calendar_html += '<TABLE CELLPADDING=0 CELLSPACING=0>';
								calendar_html += '<TR><TD CLASS="inside" ALIGN=CENTER WIDTH=31 HEIGHT=31>'+day_counter;
								calendar_html += '<BR> <SPAN CLASS=hasprice>'+curPrice+'</SPAN></TD></TR></TABLE></TD>';
							}
							else
							{
								calendar_html += '<TD width=33 height=33 align=center valign=middle  onClick="loadExpFlexFareCalURL(';
								calendar_html += "'"+curdate+"'"+')" CLASS=showprc>';
								calendar_html += '<TABLE CELLPADDING=0 CELLSPACING=0>';
								calendar_html += '<TR><TD CLASS="inside" ALIGN=CENTER WIDTH=31 HEIGHT=31>'+day_counter;
								calendar_html += '<BR> <SPAN CLASS=hasprice>'+curPrice+'</SPAN></TD></TR></TABLE></TD>';
							}
							
						}
						else
						{
							var today =  new Date();
							// Don't display URL for past dates
							if((this_month.getMonth() == today.getMonth()) && (day_counter < today.getDate()))
							{
							
								calendar_html += '<TD width=33 height=33 align=center valign=middle CLASS=farPast>';
								calendar_html += '<TABLE CELLPADDING=0 CELLSPACING=0>';
								calendar_html += '<TR><TD CLASS="inside" ALIGN=CENTER WIDTH=31 HEIGHT=31>'+day_counter;
								calendar_html += '<BR>&nbsp;</TD></TR></TABLE></TD>';
							
						
							} 
							else
							{
							
								calendar_html += '<TD width=33 height=33 align=center valign=middle  onClick="loadExpFlexFareCalURL(';
								calendar_html += "'"+curdate+"'"+')" CLASS=showprc>';
								calendar_html += '<TABLE CELLPADDING=0 CELLSPACING=0>';
								calendar_html += '<TR><TD CLASS="inside" ALIGN=CENTER WIDTH=31 HEIGHT=31>'+day_counter;
								calendar_html += '<BR>	<SPAN CLASS=clicktoprice>Price</SPAN></TD></TR></TABLE></TD>';
							}
						}
						pricefound = false;
						week_day++;
				}
				//Fill the last week of the month with appropiate number of blanks
				//alert('lastday='+week_day);
				for(last_day = week_day; last_day < 7; last_day++)
				{
					
					calendar_html += '<TD width=33 height=33 align=center valign=middle CLASS=farFuture>';
					calendar_html += '<TABLE CELLPADDING=0 CELLSPACING=0>';
					calendar_html += '<TR><TD CLASS="inside" ALIGN=CENTER WIDTH=31 HEIGHT=31>&nbsp;';
					calendar_html += '</TD></TR></TABLE></TD>';
					//calendar_html += '<td style="background-color:ffffff; color:ffffff;border-width:1px;border-color:#336699;"> </td>';   
				}
				
				
				calendar_html += '</tr>';
				calendar_html += '</table>';
				var contenthtml = '<div id="exp_out___MODULE_ID__" >';
				contenthtml +='<div class="'+rcbox+'"><div class="'+rctop+'"><div></div></div>';
				
				contenthtml +='<div class="'+rcborder+'">';
				
				contenthtml +='<div class="'+rccontent+'">';
				contenthtml += '<TABLE align="center" width="231" class="exphdr">';
				contenthtml += '<tr><td class="exphdrimg" align="left"><a href="http://www.expedia.com/Default.asp?olacid=gw.farecalendar" TARGET="resource window"><img src="http://search.expediaguides.com/tripplanner/images/exp_logo.png" align="left" border="0" alt="Expedia Home" onload="fixPNG(this)" /></a></td></tr>'
				contenthtml += '<tr><td class="exphdr">Latest roundtrip fares from ';
				contenthtml +='<span class="expairpc">'+depairportcode+ '</span> to <span class="expairpc">' +arrairportcode+'</span><td><tr>';
				contenthtml += "<tr><td>"+calendar_html+"</td></tr></table>";
				
				contenthtml += '</div></div><div class="'+rcbottom+'"><div></div></div></div></div>';
				
				
				contenthtml += '<div id="exp_ftr___MODULE_ID__" style="background-color:#ffffff;"><table align=center width="231" class="expftr"><tr align=center width="231"><td align=center width="25%"  class="expftr">';
				contenthtml += '<img class="ftrimg"src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif" /><a href="http://www.expedia.com/daily/flights/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Flights</span></a></td>';
				contenthtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/hotels/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Hotels</span></a></td>';
				contenthtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/cars/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Cars</span></a></td>';
				contenthtml += '<td width="25%" align=center class="expftr"><img class="ftrimg" src="http://search.expediaguides.com/tripplanner/images/small_arrow.gif"  /><a href="http://www.expedia.com/daily/deals/default.asp?olacid=gw.farecalendar" TARGET="resource window"><span class="ftrlink">Deals</span></a></td></tr></table></td></tr></div>';
				_gel('content___MODULE_ID__').innerHTML = contenthtml;
				// Tells gadget to resize itself
				_IG_AdjustIFrameHeight();
			}
				
			});
		}
		
		_IG_RegisterOnloadHandler( function() {LoadFlexFareCal___MODULE_ID__();} );
		</script> ]]> 
	</Content> 
</Module>
