&#xFEFF;<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="&#x5DE;&#x5D6;&#x5D2;-&#x5D0;&#x5D5;&#x5D5;&#x5D9;&#x5E8; &#x5D9;&#x5E9;&#x5E8;&#x5D0;&#x5DC;"
             title_url="http://www.israelweather.co.il/"
             directory_title="&#x5DE;&#x5D6;&#x5D2;-&#x5D0;&#x5D5;&#x5D5;&#x5D9;&#x5E8; &#x5D9;&#x5E9;&#x5E8;&#x5D0;&#x5DC;"
             author="Yonatan B."               
             author_affiliation="Google Inc."              
             description="&#x5DE;&#x5D6;&#x5D2; &#x5D4;&#x5D0;&#x5D5;&#x5D5;&#x5D9;&#x5E8; &#x5D1;&#x5D0;&#x5D6;&#x5D5;&#x5E8;&#x5D9;&#x5DD; &#x5E9;&#x5D5;&#x5E0;&#x5D9;&#x5DD; &#x5D1;&#x5D0;&#x5E8;&#x5E5;"
			 screenshot="/ig/modules/israel_weather.png"
			 thumbnail="/ig/modules/israel_weather-thm.png"
			 height="113">	
	<Locale lang="ALL" language_direction="rtl" />
	<Require feature="setprefs"/>
</ModulePrefs>
<UserPref name="city"
	display_name="&#x5D0;&#x5D6;&#x5D5;&#x5E8;"
	datatype="enum"
	default_value="1">	
	<EnumValue value="1" display_value="&#x5D0;&#x5D9;&#x5DC;&#x5EA;"/>
	<EnumValue value="20" display_value="&#x5D0;&#x5E4;&#x5E8;&#x5EA;"/>
        <EnumValue value="14" display_value="&#x5D0;&#x5E8;&#x5D9;&#x5D0;&#x5DC;"/>
        <EnumValue value="11" display_value="&#x5D1;&#x5D0;&#x5E8; &#x5E9;&#x5D1;&#x5E2;"/>
        <EnumValue value="21" display_value="&#x5D1;&#x5D9;&#x5EA; &#x5D0;&#x5DC;"/>
        <EnumValue value="17" display_value="&#x5D1;&#x5E7;&#x5E2;&#x5EA; &#x5D4;&#x5D9;&#x5E8;&#x5D3;&#x5DF;"/>
        <EnumValue value="4" display_value="&#x5D7;&#x5D5;&#x5E4;&#x5D9; &#x5E1;&#x5D9;&#x5E0;&#x5D9;"/>
	<EnumValue value="5" display_value="&#x5D7;&#x5D9;&#x5E4;&#x5D4;"/>
	<EnumValue value="6" display_value="&#x5D7;&#x5E8;&#x5DE;&#x5D5;&#x5DF;"/>
	<EnumValue value="2" display_value="&#x5D8;&#x5D1;&#x5E8;&#x5D9;&#x5D4;"/>
	<EnumValue value="7" display_value="&#x5D9;&#x5E8;&#x5D5;&#x5E9;&#x5DC;&#x5D9;&#x5DD;"/>
	<EnumValue value="9" display_value="&#x5DB;&#x5E8;&#x5DE;&#x5DC;"/>
	<EnumValue value="19" display_value="&#x5DE;&#x5E2;&#x5DC;&#x5D4; &#x5D0;&#x5D3;&#x5D5;&#x5DE;&#x5D9;&#x5DD;"/>
	<EnumValue value="10" display_value="&#x5DE;&#x5E6;&#x5E4;&#x5D4; &#x5E8;&#x5DE;&#x5D5;&#x5DF;"/>
	<EnumValue value="12" display_value="&#x5E0;&#x5E6;&#x5E8;&#x5EA; &#x5E2;&#x5D9;&#x5DC;&#x5D9;&#x5EA;"/>
	<EnumValue value="18" display_value="&#x5E2;&#x5D9;&#x5DF; &#x5D2;&#x5D3;&#x5D9;"/>
	<EnumValue value="8" display_value="&#x5E2;&#x5DE;&#x5E7;&#x5D9; &#x5D4;&#x5E6;&#x5E4;&#x5D5;&#x5DF;"/>
	<EnumValue value="3" display_value="&#x5E6;&#x5E4;&#x5EA;"/>
	<EnumValue value="13" display_value="&#x5E8;&#x5DE;&#x5EA; &#x5D4;&#x5D2;&#x5D5;&#x5DC;&#x5DF;"/>
	<EnumValue value="15" display_value="&#x5E9;&#x5E4;&#x5DC;&#x5D4;"/>						
	<EnumValue value="16" display_value="&#x5EA;&#x5DC; &#x5D0;&#x5D1;&#x5D9;&#x5D1;"/>
</UserPref>
<UserPref name="is_init" datatype="hidden" default_value="false" />
<Content type="html">
<![CDATA[
<style type="text/css">
	.w_box {overflow:hidden; height: 100px;}
	.w_ind {width: 110px; overflow:hidden; float:right;}
	.w_fc {text-align:center;padding:6px 10px 0px 0px; float:right;}
	.w_fci {border:#bbbbcc 1px solid;padding:1px; width:40px;height:40px;}
	.w_num {font-size:100%;}
</style>
<div id="content_div">
<div id="setup" style="display:none;">
<img src="/ig/images/weather_welcome_image.jpg" style="margin:5px 0px 20px 10px;" align="right">
&#x5E6;&#x5E4;&#x5D5; &#x5D1;&#x5EA;&#x5D7;&#x5D6;&#x5D9;&#x5EA; &#x5DE;&#x5D6;&#x5D2; &#x5D4;&#x5D0;&#x5D5;&#x5D5;&#x5D9;&#x5E8; &#x5D1;&#x5D0;&#x5D6;&#x5D5;&#x5E8;&#x5D9;&#x5DD; &#x5E9;&#x5D5;&#x5E0;&#x5D9;&#x5DD; &#x5D1;&#x5D0;&#x5E8;&#x5E5;.<br><br>&#x5D1;&#x5D7;&#x5E8;&#x5D5; &#x5D0;&#x5EA; &#x5D4;&#x5D0;&#x5D6;&#x5D5;&#x5E8; &#x5E9;&#x5DC;&#x5DB;&#x5DD;:
<SELECT id="city_select" name="city_select">
</SELECT>
<INPUT type="button" value="&#x5E9;&#x5DE;&#x5D5;&#x5E8;" onclick="changeCity();">
</div>
<div id="regular" style="display:none;">
	<div id="city_and_date"></div>
	<div class="w_box">
		<div class="w_fc" id="day1_div" title=""><span id="day1_name"></span><br><img id="day1_image" class="w_fci" src="http://www.google.com/images/cleardot.gif" alt=""><br><nobr><span id="day1_low"></span>&deg; - <span id="day1_high"></span>&deg;</nobr></div>
		<div class="w_fc" id="day2_div" title=""><span id="day2_name"></span><br><img id="day2_image" class="w_fci" src="http://www.google.com/images/cleardot.gif" alt=""><br><nobr><span id="day2_low"></span>&deg; - <span id="day2_high"></span>&deg;</nobr></div>
		<div class="w_fc" id="day3_div" title=""><span id="day3_name"></span><br><img id="day3_image" class="w_fci" src="http://www.google.com/images/cleardot.gif" alt=""><br><nobr><span id="day3_low"></span>&deg; - <span id="day3_high"></span>&deg;</nobr></div>
		<div class="w_fc" id="day4_div" title=""><span id="day4_name"></span><br><img id="day4_image" class="w_fci" src="http://www.google.com/images/cleardot.gif" alt=""><br><nobr><span id="day4_low"></span>&deg; - <span id="day4_high"></span>&deg;</nobr></div>
		<div class="w_fc" id="day5_div" title=""><span id="day5_name"></span><br><img id="day5_image" class="w_fci" src="http://www.google.com/images/cleardot.gif" alt=""><br><nobr><span id="day5_low"></span>&deg; - <span id="day5_high"></span>&deg;</nobr></div>
	</div>
</div>
</div>
<script type="text/javascript">
    
  var prefs = new _IG_Prefs(__MODULE_ID__);
  
  var cityCode2CityName = new Object();
  cityCode2CityName[1] = "&#x5D0;&#x5D9;&#x5DC;&#x5EA;";
  cityCode2CityName[20] = "&#x5D0;&#x5E4;&#x5E8;&#x5EA;";
  cityCode2CityName[14] = "&#x5D0;&#x5E8;&#x5D9;&#x5D0;&#x5DC;";
  cityCode2CityName[11] = "&#x5D1;&#x5D0;&#x5E8; &#x5E9;&#x5D1;&#x5E2;";
  cityCode2CityName[21] = "&#x5D1;&#x5D9;&#x5EA; &#x5D0;&#x5DC;";
  cityCode2CityName[17] = "&#x5D1;&#x5E7;&#x5E2;&#x5EA; &#x5D4;&#x5D9;&#x5E8;&#x5D3;&#x5DF;";
  cityCode2CityName[4] = "&#x5D7;&#x5D5;&#x5E4;&#x5D9; &#x5E1;&#x5D9;&#x5E0;&#x5D9;";
  cityCode2CityName[5] = "&#x5D7;&#x5D9;&#x5E4;&#x5D4;";
  cityCode2CityName[6] = "&#x5D7;&#x5E8;&#x5DE;&#x5D5;&#x5DF;";
  cityCode2CityName[2] = "&#x5D8;&#x5D1;&#x5E8;&#x5D9;&#x5D4;";
  cityCode2CityName[7] = "&#x5D9;&#x5E8;&#x5D5;&#x5E9;&#x5DC;&#x5D9;&#x5DD;";
  cityCode2CityName[9] = "&#x5DB;&#x5E8;&#x5DE;&#x5DC;";
  cityCode2CityName[19] = "&#x5DE;&#x5E2;&#x5DC;&#x5D4; &#x5D0;&#x5D3;&#x5D5;&#x5DE;&#x5D9;&#x5DD;";
  cityCode2CityName[10] = "&#x5DE;&#x5E6;&#x5E4;&#x5D4; &#x5E8;&#x5DE;&#x5D5;&#x5DF;";
  cityCode2CityName[12] = "&#x5E0;&#x5E6;&#x5E8;&#x5EA; &#x5E2;&#x5D9;&#x5DC;&#x5D9;&#x5EA;";
  cityCode2CityName[18] = "&#x5E2;&#x5D9;&#x5DF; &#x5D2;&#x5D3;&#x5D9;";
  cityCode2CityName[8] = "&#x5E2;&#x5DE;&#x5E7;&#x5D9; &#x5D4;&#x5E6;&#x5E4;&#x5D5;&#x5DF;";
  cityCode2CityName[3] = "&#x5E6;&#x5E4;&#x5EA;";
  cityCode2CityName[13] = "&#x5E8;&#x5DE;&#x5EA; &#x5D4;&#x5D2;&#x5D5;&#x5DC;&#x5DF;";
  cityCode2CityName[15] = "&#x5E9;&#x5E4;&#x5DC;&#x5D4;";
  cityCode2CityName[16] = "&#x5EA;&#x5DC; &#x5D0;&#x5D1;&#x5D9;&#x5D1;";

  var sortedCityCodes = new Array(1, 20, 14, 11, 21, 17, 4, 5, 6, 2, 7, 9, 19, 10, 12, 18, 8, 3, 13, 15, 16);
  
  var conditionCode2ConditionName = new Object();
  conditionCode2ConditionName[1] = "&#x5E0;&#x5D0;&#x5D4;";
  conditionCode2ConditionName[2] = "&#x5D1;&#x5D4;&#x5D9;&#x5E8; &#x5D5;&#x5D7;&#x5DD;";
  conditionCode2ConditionName[3] = "&#x5D1;&#x5D4;&#x5D9;&#x5E8;";
  conditionCode2ConditionName[4] = "&#x5DE;&#x5E2;&#x5D5;&#x5E0;&#x5DF; &#x5D7;&#x5DC;&#x5E7;&#x5D9;&#x5EA;";
  conditionCode2ConditionName[5] = "&#x5DE;&#x5E2;&#x5D5;&#x5E0;&#x5DF;";
  conditionCode2ConditionName[6] = "&#x5D0;&#x5D1;&#x5D9;&#x5DA;";
  conditionCode2ConditionName[8] = "&#x5E8;&#x5D5;&#x5D7; &#x5E2;&#x5D6;&#x5D4;";
  conditionCode2ConditionName[10] = "&#x5D2;&#x5E9;&#x5DD; &#x5DE;&#x5E7;&#x5D5;&#x5DE;&#x5D9;";
  conditionCode2ConditionName[12] = "&#x5D2;&#x5E9;&#x5DD; &#x5DC;&#x5E4;&#x5E8;&#x5E7;&#x5D9;&#x5DD;";
  conditionCode2ConditionName[15] = "&#x5E1;&#x5D5;&#x5E4;&#x5D5;&#x5EA; &#x5E8;&#x5E2;&#x5DE;&#x5D9;&#x5DD;";
  conditionCode2ConditionName[18] = "&#x5D2;&#x5E9;&#x5DD; &#x5DE;&#x5E2;&#x5D5;&#x5E8;&#x5D1; &#x5D1;&#x5E9;&#x5DC;&#x5D2;";
  conditionCode2ConditionName[300] = "&#x5D2;&#x5E9;&#x5DD; &#x5DE;&#x5D9;&#x5D3;&#x5D9; &#x5E4;&#x5E2;&#x5DD;";
  conditionCode2ConditionName[405] = "&#x5E9;&#x5DC;&#x5D2; &#x5DB;&#x5D1;&#x5D3;";
  conditionCode2ConditionName[596] = "&#x5D4;&#x5D1;&#x5D9;&#x5DC;";
  conditionCode2ConditionName[597] = "&#x5E2;&#x5E0;&#x5E0;&#x5D5;&#x5EA; &#x5D2;&#x5D1;&#x5D5;&#x5D4;&#x5D4;";
  
  var conditionCode2Image = new Object();
  conditionCode2Image[1] = "http://www.google.com/images/weather/sunny.gif";
  conditionCode2Image[2] = "http://www.google.com/ig/modules/israel_weather_content/red.jpg";
  conditionCode2Image[3] = "http://www.google.com/images/weather/sunny.gif";
  conditionCode2Image[4] = "http://www.google.com/images/weather/mostly_sunny.gif";
  conditionCode2Image[5] = "http://www.google.com/images/weather/cloudy.gif";
  conditionCode2Image[6] = "http://www.google.com/ig/modules/israel_weather_content/hazy_new.jpg";
  conditionCode2Image[8] = "http://www.google.com/ig/modules/israel_weather_content/windy_new.jpg";
  conditionCode2Image[10] = "http://www.google.com/images/weather/chance_of_rain.gif";
  conditionCode2Image[12] = "http://www.google.com/images/weather/thunderstorm.gif";
  conditionCode2Image[15] = "http://www.google.com/ig/modules/israel_weather_content/yellow.jpg"
  conditionCode2Image[18] = "http://www.google.com/ig/modules/israel_weather_content/rain_snow.jpg";
  conditionCode2Image[300] = "http://www.google.com/images/weather/rain.gif";
  conditionCode2Image[405] = "http://www.google.com/images/weather/snow.gif";
  conditionCode2Image[596] = "http://www.google.com/ig/modules/israel_weather_content/red_maym.jpg"
  conditionCode2Image[597] = "http://www.google.com/ig/modules/israel_weather_content/red_ananim.jpg";
  
  var dayNames = new Array("&#x5E8;&#x5D0;&#x5E9;&#x5D5;&#x5DF;", "&#x5E9;&#x5E0;&#x5D9;", "&#x5E9;&#x5DC;&#x5D9;&#x5E9;&#x5D9;", "&#x5E8;&#x5D1;&#x5D9;&#x5E2;&#x5D9;", "&#x5D7;&#x5DE;&#x5D9;&#x5E9;&#x5D9;", "&#x5E9;&#x5D9;&#x5E9;&#x5D9;", "&#x5E9;&#x5D1;&#x5EA;");
  function extractInformation(dataObjects, requestedCity) {
	var result = new Object();
	result.highs = new Array();
	result.lows = new Array();
	result.conditions = new Array();
	for (var i = 0; i < dataObjects.length; i++) {
		var dataObject = dataObjects.item(i);
		var nodeList = dataObject.childNodes;			
		var tempAttributes = new Object();
		for (var j = 0; j < nodeList.length; j++) {
			var node = nodeList.item(j);
			if (node.nodeName != "Attribute")
				continue;
			tempAttributes[node.getAttribute("name")] = node.getAttribute("value");
		}
		var objectType = dataObject.getAttribute("type");
		if (tempAttributes["city_code"] == requestedCity) {
			// we do not need currcond for now
			if (objectType == "forecast") {		
				for (var j=1; j <= 5; j++) {
					result.highs[j] = tempAttributes["high"+j];
					result.lows[j] = tempAttributes["low"+j];
					result.conditions[j] = tempAttributes["condition"+j];
				}
			}
		}
	}
	return result;
  }
  function GetDayName(distance) {
	if (distance == 0)
		return "&#x5D4;&#x5D9;&#x5D5;&#x5DD;";
	var curr_date = new Date();
	var curr_day = curr_date.getDay();
	var referenced_day = (curr_day + distance) % 7;
	return dayNames[referenced_day];
  }
  
  function populateSetupCityList() {
	var sel = _gel("city_select");
	for (var i = 0; i < sortedCityCodes.length; ++i) {
		var cityCode = sortedCityCodes[i];
		if (cityCode2CityName[cityCode] == "")
			continue;
		var newOption = document.createElement('option');
		newOption.text = cityCode2CityName[cityCode];
		newOption.value = cityCode;
		try {
			sel.add(newOption, null); // standard, doesn't work in IE
		}
		catch(ex) {
			sel.add(newOption); // works in IE but nonstandard
		} 
	}
  }
  
  function changeCity() {
	var selectedIndex = _gel("city_select").selectedIndex;
	prefs.set("city", _gel("city_select").options[selectedIndex].value);
	prefs.set("is_init", "true");
	displayAll();
  }
  
  function loadSetup() {
  	populateSetupCityList();
	_gel('setup').style.display="block";
	_gel('regular').style.display="none";		
  }
  
  function loadRegular() {
  	_gel('setup').style.display="none";
	_gel('regular').style.display="block";
	 var url = "http://www.israelweather.co.il/google_day_xml.asp?show_cur=1";   
	 var requestedCity = prefs.getString("city");
	_IG_FetchXmlContent(url, function (response) {		
		if (response == null || typeof(response) != "object" || 
			response.firstChild == null) {
				_gel("content_div").innerHTML = "<i>Invalid data.</i>";
			return;
		}

		var dataObjects = response.getElementsByTagName("DataObject");
		var relevantData = extractInformation(dataObjects, requestedCity);		
		var curr_date = new Date();
		_gel('city_and_date').innerHTML = "<b>" + cityCode2CityName[requestedCity] + "</b> - " + curr_date.getDate() + 
                                                          "/" + (curr_date.getMonth()+1) + "/" + curr_date.getFullYear();
		for (var i=1; i <= 5; i++) {
			var cond = relevantData.conditions[i];
			_gel('day'+i+'_div').title = conditionCode2ConditionName[cond];
			_gel('day'+i+'_name').innerHTML = GetDayName(i-1); // day 1 is today - distance is 0, etc.
			_gel('day'+i+'_image').src = conditionCode2Image[cond];
			_gel('day'+i+'_image').alt = conditionCode2ConditionName[cond];
			_gel('day'+i+'_low').innerHTML = relevantData.lows[i];
			_gel('day'+i+'_high').innerHTML = relevantData.highs[i];
		}
	}, { refreshInterval: (60 * 5) }); 
  }    
  
  function displayAll() {    
    var is_init = prefs.getString("is_init");
	if (is_init == "false") { // no city selected yet
		loadSetup();
	}
	else {
		loadRegular();		
	}
	//_IG_AdjustIFrameHeight();
  }
	
  _IG_RegisterOnloadHandler(function() { displayAll(); });

  </script>
  ]]> 
  </Content>
</Module>
