	var GetStates = function(url,sessID,countryId,ship_data)
	{
		url = checkSsl(url);
		if(ship_data == 1) {
			var MyAjax = new Ajax.Request(url + '?html=include/state_request.vsl&COUNTRY=' + countryId + '&ID=' + sessID,
				{
					method:'get',
					onComplete:showShipResult
				}
			);
		} else {
			var MyAjax = new Ajax.Request(url + '?html=include/state_request.vsl&COUNTRY=' + countryId + '&ID=' + sessID,
				{
					method:'get',
					onComplete:showResult
				}
			);
		}
	}
	
	var showResult = function(r) {
		var response = r.responseText;
		if(response == 'noResult') {
			
			document.getElementById('state_tr').style.display = 'none';
			document.getElementById('state_select').selectedIndex = 0;
		}	else {
				document.getElementById('state_tr').style.display = 'table-row';
				document.getElementById('state_select').innerHTML = response;
		}
	}
		
		var showShipResult = function(r) {
		var response = r.responseText;
		if(response == 'noResult') {
			
			document.getElementById('ship_state_tr').style.display = 'none';
			document.getElementById('ship_state_select').selectedIndex = 0;
		}	else {
				document.getElementById('ship_state_tr').style.display = 'table-row';
				document.getElementById('ship_state_select').innerHTML = response;
		}
	}


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;

}
