		function CheckForHash(){
			if(document.location.hash){
				var HashLocationName = document.location.hash;
				HashLocationName = HashLocationName.replace("#","");
				if(document.getElementById('test_hash').name!=HashLocationName) {
					document.getElementById('test_hash').name=HashLocationName;
					arata_localitati_back(HashLocationName); 
				}
			}
		}
		
		function RenameAnchor(anchorid, anchorname){
			document.getElementById(anchorid).name = anchorname; //this renames the anchor
		}
		
		function RedirectLocation(anchorid, anchorname, HashName){
			RenameAnchor(anchorid, anchorname);
			document.location = HashName;
		}
		
		function getMyHTTPObject(){
			var xmlhttp;
			// Attempt to initialize xmlhttp object
			try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
		    catch (e) {
				// Try to use different activex object
				try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (E) {
					xmlhttp = false;
				}
			}
			// If not initialized, create XMLHttpRequest object
			if (!xmlhttp) {
				if (typeof XMLHttpRequest != 'undefined') {
					xmlhttp = new XMLHttpRequest();
				}
				else {
					alert("This browser does not support AJAX.");
					return null;
				}
			}
			return xmlhttp;
		}
		 
		
		function setMyOutput(){
			var combo = document.getElementById('localitate');
			combo.options.length = 0;
			if(httpObject.readyState == 4){
				var response = httpObject.responseText;
				var items = response.split(";");
				var count = items.length;
				combo.options[0] = new Option('Alege localitatea', '');
				for (var i=1;i<count;i++) {
					if (items[i] == '') continue;
					var options = items[i].split("-");
					/*combo.options[i] =	new Option(options[0], options[0]);
					if (options[1] == true)
						combo.options[i].selected = true;*/
					if (options[1] == 'false')
						combo.options[i] =	new Option(options[0], options[0]);
					else
						combo.options[i] =	new Option(options[0], options[0], true, true);			
					
				}
			}
			else 
				combo.options[0] = new Option('asteptati...');
		}
		
		function arata_localitati_back(judet){
			httpObject = getMyHTTPObject();
			if (httpObject != null) {
				loc = '/orase/arata_localitati_back/'+judet;
				httpObject.open("GET", loc, true);
				httpObject.onreadystatechange = setMyOutput;
				httpObject.send(null);
			}
		}
		
		
		
		var HashCheckInterval = setInterval("CheckForHash()", 50);
		window.onload = CheckForHash;