var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

function atlas_DoFSCommand(command, args)
{
	//var myFlashObj = InternetExplorer ? atlas : document.body.atlas;
	
	var kod;
	
	if (command == 'city_id')
	{
		//string += args;
		//alert(string);
		//var destinationStringPattern = /\(.*\)/;
		//alert(args.replace(destinationStringPattern,""));
		
		//$j('.wp-submit-p').hide();
		//alert(args.replace(destinationStringPattern,""));
		
		
		try{
			document.forms.searchForm_1.city.value = args.replace(destinationStringPattern,"");
		}catch(err){}
		
		try{
			document.forms.searchForm_2.city.value = args.replace(destinationStringPattern,"");
		}catch(err){}
		
		try{
			document.forms.searchForm_3.city.value = args.replace(destinationStringPattern,"");
		}catch(err){}
		
	}
	else if (command == 'city_name')
	{
		
		var destinationStringPattern = /\(.*\)/;
		//alert(args.replace(destinationStringPattern,""));
		
		try{
			code = document.forms.searchForm_1.city.value;
		}catch(err){}
		
		try{
			code = document.forms.searchForm_2.city.value;
		}catch(err){}
		
		try{
			code = document.forms.searchForm_3.city.value;
		}catch(err){}
		
		
		var country = '';
		var param = '';
		try{
			city = args.replace(destinationStringPattern,"");

			var url = location.protocol + "//" + location.host + "/hotel/Ajax/getLocationAtlas/";
			$j.get(url+code+'/'+city, function(data){

				try{
					document.forms.searchForm_1.city.value = args.replace(destinationStringPattern,"") + (data?", " + data:"");
				}catch(err){}
				try{
					document.forms.searchForm_2.city.value = args.replace(destinationStringPattern,"") + (data?", " + data:"");
				}catch(err){}
				try{
					document.forms.searchForm_3.city.value = args.replace(destinationStringPattern,"") + (data?", " + data:"");
				}catch(err){}
				document.getElementById('atlas').style.display = "none";
				document.getElementById('ShoutBoxAtlas').style.display = "none";
			});
		}catch(err){
			try{
				document.forms.searchForm_1.city.value = args.replace(destinationStringPattern,"") + (data?", " + data:"");
			}catch(err){}
			try{
				document.forms.searchForm_2.city.value = args.replace(destinationStringPattern,"") + (data?", " + data:"");
			}catch(err){}
			try{
				document.forms.searchForm_3.city.value = args.replace(destinationStringPattern,"") + (data?", " + data:"");
			}catch(err){}
			document.getElementById('atlas').style.display = "none";
			document.getElementById('ShoutBoxAtlas').style.display = "none";
		}

	} else if (command == 'close')
	{
		document.getElementById('atlas').style.display = "none";
		document.getElementById('ShoutBoxAtlas').style.display = "none";
	}
}
