
function updateFormAction(form) {
    currentAction=form.action;

    if (currentAction.indexOf('://') != -1)
        return;

    form.action='http://'+location.host+currentAction;
}

function writeOb(src){
    document.write(src);
}


function openWnd(url, width,height, name){
    var optionstr = "height=" + height + ",width=" + width + ",menubar=no,toolbar=no,status=no,personalbar=no,resizable=yes,scrollbars=no";
    var wnd = window.open(url,name,optionstr);
    wnd.width=width;
    wnd.height=height;
    wnd.resizeTo(width,height);
    wnd.screenY = (screen.height - height)/2;
    wnd.screenX = (screen.width - width)/2;
    return wnd;
}

function checkclear(what) {
  if(!what._haschanged){  
	what.value=''
  };
  what._haschanged=true;
}

function su_trim( str ) {
  str = str.replace( /^[\s\r\n\t]+/, "" );
  str = str.replace( /[\s\r\n\t]+$/, "" );
  return str;
}
  
function su_alpha( str ) {
  if( !str.match( /[a-z]{2}/i ) ) return false;
  return true;
}

var eurCountryOnly = ",11,14,20,21,27,33,56,58,59,60,71,76,77,";
eurCountryOnly += "84,87,88,99,100,105,106,107,119,124,126,141,";
eurCountryOnly += "142,151,152,161,171,12,176,177,188,192,193,";
eurCountryOnly += "194,199,205,206,217,222,237,240,246,";
 
function changeCountry() {
    try {
        var e = document.forms[1].elements;
 
	//enable or disable state and USD selection
        if (e.country.value == "225") {
            if(e.state){e.state.disabled = false;}
        } else {
            if(e.state){e.state.disabled = true;}
        }
//alert(document.getElementById('mainstatetd'))
	//handle currency
	//alert(e.country.value)
        if (e.country.value == "225" || e.country.value == "226") {
		//United States, US Minor Outlying Islands - assigned USD only (players 
		//from these countries cannot select any other currency)
		e.currency.options[0].disabled = true;
		e.currency.options[1].disabled = false;
		e.currency.options[2].disabled = true;
		e.currency.options[3].disabled = true;
		e.currency.value = "0";
		 
		if(document.getElementById('stateLoc5')){ document.getElementById('stateLoc5').style.backgroundImage = "url(/images/register/handgray.png)" ;}
		if(document.getElementById('currencyLoc5')){ document.getElementById('currencyLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;}
		//alert('1')
		if(document.getElementById('mainstatetd'))
			{ 
			var x = document.getElementById('mainstatetbval').innerHTML;
			
			document.getElementById('mainstatesep').style.height='15px'
			document.getElementById('mainstatetd').innerHTML = x
			}
	} else if (e.country.value == "258" || e.country.value == "224" || e.country.value == "68") {
		//UK, United Kingdom - assigned GBP only (players from these 
		//countries cannot select any other currency)
		e.currency.options[0].disabled = true;
		e.currency.options[1].disabled = true;
		e.currency.options[2].disabled = true;
		e.currency.options[3].disabled = false;
		e.currency.value = "2";
		if(document.getElementById('stateLoc5')){ document.getElementById('stateLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;}
		if(document.getElementById('currencyLoc5')){ document.getElementById('currencyLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;}
		if(document.getElementById('mainstatetd')){document.getElementById('mainstatetd').innerHTML = '';document.getElementById('mainstatesep').style.height='0px'}	
	} else if (eurCountryOnly.indexOf("," + e.country.value + ",") > -1) {
		// assigned EUR only (players from this country cannot select 
		//any other currency)
		e.currency.options[0].disabled = true;
		e.currency.options[1].disabled = true;
		e.currency.options[2].disabled = false;
		e.currency.options[3].disabled = true;
		e.currency.value = "1";
		if(document.getElementById('stateLoc5'))
			{ 
			document.getElementById('stateLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;
			}
		if(document.getElementById('currencyLoc5')){ document.getElementById('currencyLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;}	
		if(document.getElementById('mainstatetd')){document.getElementById('mainstatetd').innerHTML = '';document.getElementById('mainstatesep').style.height='0px'}
	} else if (e.country.value == "105" ) {
		//The currency for 'Ireland' have the default setting of 'Euro'
		//but the player can also select any of the 3 currencies that they would like.
		//The currency field for 'France' and 'Italy' be changed to have the default setting of 
		//'Euro' but the player can also select any of the 3 currencies that they would like.
		e.currency.options[0].disabled = false;
		e.currency.options[1].disabled = false;
		e.currency.options[2].disabled = false;
		e.currency.options[3].disabled = true;
		e.currency.value = "1";
		if(document.getElementById('stateLoc5'))
			{ 
			document.getElementById('stateLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;
			}
		if(document.getElementById('currencyLoc5')){ document.getElementById('currencyLoc5').style.backgroundImage = "url(/images/register/handgray.png)" ;}	
		if(document.getElementById('mainstatetd')){document.getElementById('mainstatetd').innerHTML = '';document.getElementById('mainstatesep').style.height='0px'}
		
	} else if (e.country.value == "77" || e.country.value == "107" ) {
		//The currency for 'Ireland' have the default setting of 'Euro'
		//but the player can also select any of the 3 currencies that they would like.
		//The currency field for 'France' and 'Italy' be changed to have the default setting of 
		//'Euro' but the player can also select any of the 3 currencies that they would like.
		e.currency.options[0].disabled = false;
		e.currency.options[1].disabled = false;
		e.currency.options[2].disabled = false;
		e.currency.options[3].disabled = true;
		e.currency.value = "1";	
		if(document.getElementById('stateLoc5'))
			{ 
			document.getElementById('stateLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;
			}
		if(document.getElementById('currencyLoc5')){ document.getElementById('currencyLoc5').style.backgroundImage = "url(/images/register/handgray.png)" ;}
		if(document.getElementById('mainstatetd')){document.getElementById('mainstatetd').innerHTML = '';document.getElementById('mainstatesep').style.height='0px'}
	} else if (e.country.value == "192" || e.country.value == "13" || e.country.value == "38" ) {
		e.currency.options[0].disabled = false;
		e.currency.options[1].disabled = false;
		e.currency.options[2].disabled = false;
		e.currency.options[3].disabled = true;
		e.currency.value = "0";	
		if(document.getElementById('stateLoc5'))
			{ 
			document.getElementById('stateLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;
			}
		if(document.getElementById('currencyLoc5')){ document.getElementById('currencyLoc5').style.backgroundImage = "url(/images/register/handgray.png)" ;}
		if(document.getElementById('mainstatetd')){document.getElementById('mainstatetd').innerHTML = '';document.getElementById('mainstatesep').style.height='0px'}			
	} else {
		e.currency.options[0].disabled = false;
		e.currency.options[1].disabled = false;
		e.currency.options[2].disabled = false;
		e.currency.options[3].disabled = true;
		e.currency.value = "1";
		if(document.getElementById('stateLoc5'))
			{ 
			document.getElementById('stateLoc5').style.backgroundImage = "url(/images/register/handgreen.png)" ;
			}
			if(document.getElementById('currencyLoc5')){ document.getElementById('currencyLoc5').style.backgroundImage = "url(/images/register/handgray.png)" ;}
		if(document.getElementById('mainstatetd')){document.getElementById('mainstatetd').innerHTML = '';document.getElementById('mainstatesep').style.height='0px'}
	}

    } catch (Exception) {
    }

}
