// JavaScript Document

	
function put_form_data(data,a)
	{
		fields=data.split('&');
		for (i=0;i<fields.length;i++)
			{
				document.getElementById(fields[i].split('=')[0]).value=fields[i].split('=')[1];
			}
	}
function get_form_data(a)
	{
		result='';	// get the number of elements in the form
		x = a.elements.length;
		
		// cycle through each element in the form
		for (i=0;i<x;i++)
		{
			// get the elements that includes "mis336" tag	
			if(a.elements[i].type=='text' || a.elements[i].type=='password' || a.elements[i].type=='textarea' || a.elements[i].type=='hidden' )
			{
				result+=a.elements[i].attributes.getNamedItem('name').value + '=' + a.elements[i].value + '&';
			}
			
			if(a.elements[i].type=='checkbox' || a.elements[i].type=='radio' )
			{
				if (a.elements[i].checked)
					result+=a.elements[i].attributes.getNamedItem('name').value + '=' + a.elements[i].value + '&';
				else
					result+=a.elements[i].attributes.getNamedItem('name').value + '=' + '&';
			}
			
			if(a.elements[i].type=='select-one'  )
			{
				result+=a.elements[i].attributes.getNamedItem('name').value + '=' + a.elements[i].options[a.elements[i].selectedIndex].value + '&';
			}
		}
		return(result);
	}
function send_http_data(url,method,data)
	{
		if (method=='GET')
			{
				x=new get_HttpObject();
				x.open("GET",url + '?' + data , false);
				//x.overrideMimeType('text/html; charset=ISO-8859-9');
				x.send(null);
				result=x.responseText;
			}
		else
			{
				x=new get_HttpObject();
				x.open("POST",url , false);
				x.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				//x.overrideMimeType('text/html; charset=ISO-8859-9');
				x.send(data);
				result=x.responseText;
			}
		return (result);
	}
function get_HttpObject()
	{
			var xmlhttp=false;
		/*@cc_on @*/
		/*@if (@_jscript_version >= 5)
		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		 try {
		  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		 } catch (e) {
		  try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (E) {
		   xmlhttp = false;
		  }
		 }
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		if (!xmlhttp && window.createRequest) {
			try {
				xmlhttp = window.createRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		a=xmlhttp;
	return (a);
	}
//x=get_HttpObject();
//x.open("GET","demo_index.php?ACTION=get_Point&ASKF=departure_city&ASKV=Istanbul&ANSF=arrival_city",false);
//x.send(null);
//alert(x.responseText);



function loadXMLDoc(url) {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		 if (req.overrideMimeType) {
            req.overrideMimeType('text/xml; charset=iso-8859-9');
         }
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send("");
		return req;
	}
}
