// JavaScript Document

 function XMLreaderCity(res) {
	

		var xmlobject = res.responseXML;
		
		//alert(xmlobject);
		
		var root = xmlobject.getElementsByTagName('weatherdata');
		data = '<select onchange="SetDataW();" id="wdatacity" class="field"><option>Seçiniz</option>';
		for(i = 0; i<xmlobject.documentElement.childNodes.length;i++) {
		
			data += '<option value="'+xmlobject.documentElement.childNodes[i].getAttribute("weatherlocationcode")+'">' + xmlobject.documentElement.childNodes[i].getAttribute("weatherfullname") + "</option>";
		
		}
		
		$('wchannel').innerHTML = data + "</select>";
	
	}
	
	function XMLreader2(res) {
		$('ParaGaranti').innerHTML = res.responseText;
	}
	
	function XMLreader(res) {
	

		var xmlobject = res.responseXML;
		es = 0;
		//alert(dox);
		data = "<table border='0' align='center' width='100%'><tr>";

		var imgurl = xmlobject.documentElement.firstChild.getAttribute('imagerelativeurl');

		for(i = 0; i<xmlobject.documentElement.firstChild.childNodes.length;i++) {

		

			var img = xmlobject.documentElement.firstChild.childNodes[i].getAttribute("skycodeday");

			if(img != null) {

				if(dox > es) {

					var day = xmlobject.documentElement.firstChild.childNodes[i].getAttribute("day");

					var high = xmlobject.documentElement.firstChild.childNodes[i].getAttribute("high");

					var low = xmlobject.documentElement.firstChild.childNodes[i].getAttribute("low");

					var skytextday = xmlobject.documentElement.firstChild.childNodes[i].getAttribute("skytextday");

					data += "<td align='center'>"+day + '<br /><img src="' + imgurl + img + '.gif"><br />'+low+"&#176; / "+high+"&#176; <br />" + skytextday + "</td>";

					es++;	

				}

				

			}

		

		}

		$('hava').innerHTML = data + "</tr></table>";
		for(i=0;i<dox;i++) {
			$('hava').innerHTML = $('hava').innerHTML.replace('<?php echo MSiteURL;?>','');
		}
	
	}
		 
	 function getPersonInfo(is) {
		$('wchannel').innerHTML = '<strong>Loading...</strong>';
		new Ajax.Request('/Ajax/search.php?weasearchstr='+is,{method:'get',onSuccess:XMLreaderCity,
   		onFailure: function(){ alert('Something went wrong...') }});
	}
	
	function $G(id) {
		new Ajax.Request('/Ajax/search.php?wealocations=' + id,{method:'get',onSuccess:XMLreader,
   		 onFailure: function(){ alert('Something went wrong...') }});
		
		
	}
	
	function $RR() {
		new Ajax.Request('/Ajax/piyasa.php',{method:'get',onSuccess:XMLreader2,
   		 onFailure: function(){ alert('Something went wrong...') }});
		
		
	}