	var GetStates = function(url,sessID,countryId,ship_data)
	{
		url = checkSsl(url);
		if(ship_data == 1) {
			var MyAjax = new Ajax.Request(url + '?html=ajax/state_request.vsl&COUNTRY=' + countryId + '&ID=' + sessID,
				{
					method:'get',
					onComplete:showShipResult
				}
			);
		} else {
			var MyAjax = new Ajax.Request(url + '?html=ajax/state_request.vsl&COUNTRY=' + countryId + '&ID=' + sessID,
				{
					method:'get',
					onComplete:showResult
				}
			);
		}
	}
	
	var showResult = function(r) {
		var response = r.responseText;

		if(response == 'noResult') {
			
			$('state_tr').style.display = 'none';
			$('state_select').selectedIndex = 0;
		}	else {
				$('state_tr').style.display = 'table-row';
				$('state_select').innerHTML = '';
				$('state_select').insert(response);
				$('state_select').selectedIndex = 0;
		}
	}
		
		var showShipResult = function(r) {
		var response = r.responseText;
		if(response == 'noResult') {
			
			$('ship_state_tr').style.display = 'none';
			$('ship_state_select').selectedIndex = 0;
		}	else {
				$('ship_state_tr').style.display = 'table-row';
				$('ship_state_select').innerHTML = '';
				$('ship_state_select').insert(response);
				$('ship_state_select').selectedIndex = 0;
		}
	}


function checkSsl(url) {
	var loc = new String(window.parent.document.location);
	if (loc.indexOf("https://")!= -1)
					secure = true;
	else
					secure = false;

	if (url.indexOf("https://")!= -1 && !secure) {
			url = url.replace("https://", "http://");
			url = url.replace(":443", "");
	} else {
			if (url.indexOf("http://")!= -1 && secure)
			url = url.replace("http://", "https://");
	}

	return url;

}

