//In the name of Allah who is the lord of all the universe
// Result.js

var xobject=connectIt();
	var total=0;

//-----------------------------------------------------------------------------------------


function connectIt(){
	var xobject;
	try{
		xobject=new XMLHttpRequest();
		}
	catch(e){
		try{
			xobject=new ActiveXObject("Microsoft.XMLHTTP");
			}
		catch(e){
			try{
				xobject=new ActiveXObject("Msxml2.XMLHTTP");
				}
			catch(e){}
			}
		}
	if(!xobject){
		window.alert("May be you are unable to support AJAX or may be it is not suitable for AJAX that has been used in this site");
		}
	else{
		return xobject;
		}
	}
	

//-----------------------------------------------------------------------------------------


function calling(){
	//waiter=document.getElementById('wait').style;
	//waiter.display="block";
	value=document.getElementById("city_code").value;
	if(xobject){ 
	try{
		xobject.open("POST","post_news.php?value="+value,true);
		
		 xobject.onreadystatechange=displayResult;
		 xobject.send(null);
		 //xobject.send("quiz="+quiz+"&Q="+q+"&Ans="+value);
            }catch(e){
                   window.alert("Can't connect to server:\n"+e.toString());
			     }
               
                               }
									   
	
	
		
	}
	

//-----------------------------------------------------------------------------------------


	
	function displayResult(){
		if(xobject.readyState==4){
		//	waiter.display="none";
			if(xobject.status==200){
				try{
					response=xobject.responseText;	
					document.getElementById("ajaxdiv").innerHTML=response;
					
					}
				catch(e){
					try{
						window.alert(response);
					}
					catch(e){
						window.alert("Problem facing in retrieving data from server "+xobject.statusText+e.toString());
						}
					}
				}	
			}
		}
//--------------------------------------------------------------------------------

function totali(){
	document.f2.total.value=total;
	return true;
	}
