// JavaScript Document
var xmlhttp;
function getxml()
{
	if(navigator.appName=="Microsoft Internet Explorer")
	{
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");			
	}
	else
	{
		//xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp=new XMLHttpRequest();
	}
	return xmlhttp;
}
function mysubmit(myval,lid)
{
	var url="output.php?stid="+myval+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);					
					document.getElementById('stateid').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}		
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	mycountry2(myval,lid);
	myplacename1(myval,lid)
}
function mysubmit1(myval,lid,cnt)
{
	var url="output.php?ctid="+myval+"&lid="+lid;
		var req = getxml();
		if (req)
		{
			req.onreadystatechange = function()
	 		{
				if (req.readyState == 4)
				{
					// only if "OK"
					if (req.status == 200)
					{
						//alert(req.responseText);					
						document.getElementById('cityid').innerHTML=req.responseText;
					} 
					else 
					{
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}		
		}
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	if(myval!='' && myval!='0')
	{
		mystate2(myval,lid);
		myplacename2(myval,lid);
	}
	else
	{
		mysubmit(cnt,lid);
		
	}
}
function mymood(sectype,secname,lid)
{
	
	var url="output.php?mood=mood" + "&sectype="+sectype +"&secname="+secname+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);					
					document.getElementById('mood').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	/*mytype('','',lid);*/
}
function mytype(sectype,secname,lid)
{
	var url="output.php?type=type" + "&sectype="+sectype +"&secname="+secname+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);					
					document.getElementById('type').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function mycity(myval,lid,stid)
{
	if(myval!='' && myval!='0')
	{
		mycity2(myval,lid);
		myplacename3(myval,lid);
	}
	else
	{
		mysubmit1(stid,lid);	
	}
	
}
function mycity1(myval,lid)
{
	var url="output.php?cttype=" + myval+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);					
					document.getElementById('type').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	mycity2(myval,lid);
	myplacename3(myval,lid);
}
function mycity2(myval,lid)
{
	var url="output.php?cityname=" + myval+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);
					document.getElementById('cityname').innerHTML="<br>"+req.responseText;
					//document.getElementById('placename').innerHTML=req.responseText;
					//document.getElementById('placename').innerHTML=<? $_SESSION["testing999"] ?>;
					//document.getElementById('go').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	mymood('cityname',myval,lid);
	mytype('cityname',myval,lid);
}
function mystate2(myval,lid)
{
	var url="output.php?statename=" + myval+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);	
					document.getElementById('cityname').innerHTML="<br>"+req.responseText;
					//document.getElementById('placename').innerHTML=req.responseText;
					//document.getElementById('placename').innerHTML=<? $_SESSION["testing999"] ?>;
					//document.getElementById('go').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	mymood('statename',myval,lid);
	mytype('statename',myval,lid);
}
function mycountry2(myval,lid)
{
	var url="output.php?countryname=" + myval+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);
					document.getElementById('cityname').innerHTML="<br>"+req.responseText;
					//document.getElementById('placename').innerHTML=req.responseText;
					//document.getElementById('placename').innerHTML=mynewvalue;
					//document.getElementById('go').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	mymood('country',myval,lid);
	mytype('country',myval,lid);
}
function loadcity(val)
{
	
	var url="output.php?loadcity="+val;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);
					document.getElementById('cityid').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function playvideo(myval)
{
	
	var url="output.php?video=" + myval;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);
					document.getElementById('myplayer').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function rotateimage(myval)
{
	//alert(myval);
	var url="output.php?roteteimage=" + myval;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);
					document.getElementById('myplayer').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function myplacename1(myval,lid)
{
	var url="output.php?countryplace=" + myval+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);
					//document.getElementById('cityname').innerHTML="<br>"+req.responseText;
					document.getElementById('placename').innerHTML=req.responseText;
					//document.getElementById('placename').innerHTML=mynewvalue;
					//document.getElementById('go').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function myplacename2(myval,lid)
{
	var url="output.php?stateplace=" + myval+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);	
					//document.getElementById('cityname').innerHTML="<br>"+req.responseText;
					document.getElementById('placename').innerHTML=req.responseText;
					//document.getElementById('go').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function myplacename3(myval,lid)
{
	var url="output.php?cityplace=" + myval+"&lid="+lid;
	var req = getxml();
	if (req)
	{
		req.onreadystatechange = function()
	 	{
			if (req.readyState == 4)
			{
				// only if "OK"
				if (req.status == 200)
				{
					//alert(req.responseText);	
					//document.getElementById('cityname').innerHTML="<br>"+req.responseText;
					document.getElementById('placename').innerHTML=req.responseText;
					//document.getElementById('go').innerHTML=req.responseText;
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
