var RequestForm = new Class({
	initialize: function() {
		$('country').addEvent('change', function() { requestform.toggleForm(); });
	},
		
	toggleForm: function() {
				
		if($('country').get('value')=='US') {
			
			var locRequest = new Request.HTML({url: '/sync/submit/location/us/?lang='+lang, onSuccess: function(tree, elements, html) { $('location').set('html', html); }}).send();
			var codRequest = new Request.HTML({url: '/sync/submit/code/us/?lang='+lang, onSuccess: function(tree, elements, html) { $('addresscode').set('html', html); }}).send();
		
		} else if($('country').get('value')=='CA') {

			var locRequest = new Request.HTML({url: '/sync/submit/location/ca/?lang='+lang, onSuccess: function(tree, elements, html) { $('location').set('html', html); }}).send();
			var codRequest = new Request.HTML({url: '/sync/submit/code/ca/?lang='+lang, onSuccess: function(tree, elements, html) { $('addresscode').set('html', html); }}).send();
			//new Ajax.Updater('location', '/sync/submit/location/ca/?lang='+lang, {asynchronous:true});
		//	new Ajax.Updater('addresscode', '/sync/submit/code/ca/?lang='+lang, {asynchronous:true});
			
		} else if ($('country').get('value')=='--') {

			var locRequest = new Request.HTML({url: '/sync/submit/location/all/?lang='+lang, onSuccess: function(tree, elements, html) { $('location').set('html', html); }}).send();
			var codRequest = new Request.HTML({url: '/sync/submit/code/all/?lang='+lang, onSuccess: function(tree, elements, html) { $('addresscode').set('html', html); }}).send();
			//new Ajax.Updater('location', '/sync/submit/location/all/?lang='+lang, {asynchronous:true});
		//	new Ajax.Updater('addresscode', '/sync/submit/code/all/?lang='+lang, {asynchronous:true});
			
		} else {
			$('location').set('html', '&nbsp;');
			var codRequest = new Request.HTML({url: '/sync/submit/code/all/?lang='+lang, onSuccess: function(tree, elements, html) { $('addresscode').set('html', html); }}).send();
		//	$('location').innerHTML = "&nbsp;";
	//		new Ajax.Updater('addresscode', '/sync/submit/code/all/?lang='+lang, {asynchronous:true});
			
		}
	
	}
});

var requestform;

window.addEvent('domready', function() {
	requestform = new RequestForm;
});