function converter (rate,amount,oid) {
	var new_amount=amount*rate;
	new_amount=Math.round(new_amount*100)/100; 
	document.getElementById('usd_amount').innerHTML=new_amount;
	return new_amount;
}

function state_loader (country,room,person) {
	var qstr='r=1&action=load_states&room='+escape(room)+'&person='+escape(person)+'&country='+escape(country);
	var qurl='remote.php?';	
	xmlhttpPost(qurl+qstr,'states_'+room+'_'+person);
}

function xmlhttpPost(strURL,update_element) {
    var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            document.getElementById(update_element).innerHTML = self.xmlHttpReq.responseText;
        }
    }
    self.xmlHttpReq.send(strURL);
}

function staff_change (imgid,pic) {
	document.getElementById(imgid).src='spic/'+pic;	
}


function card_change (who) {
	if (who=='him') {
		document.getElementById('who').value='him';
		document.getElementById('card').src='gfx/invitation_card_him.jpg';
	}
	else {
		document.getElementById('who').value='her';
		document.getElementById('card').src='gfx/invitation_card_her.jpg';
	}
}

function verify500(w,room) {
	sharing=document.getElementById('sharing_'+room+'_1_no').checked;
	sharing2=document.getElementById('sharing_'+room+'_1_yes').checked;
	v500=document.getElementById('agree_'+room+'_1').checked;
	
	if (w=='sharing') {
		if (document.getElementById('sharing_'+room+'_1_no').checked) {
			document.getElementById('agree_'+room+'_1').checked=true;
		}
	}
	else if (w=='sharing2') {
		if (document.getElementById('sharing_'+room+'_1_yes').checked) {
			document.getElementById('agree_'+room+'_1').checked=false;
		}
	}
	else if (w=='500') {
		if (document.getElementById('agree_'+room+'_1').checked==false && document.getElementById('sharing_'+room+'_1_no').checked) {
			document.getElementById('sharing_'+room+'_1_no').checked=false;
			document.getElementById('sharing_'+room+'_1_yes').checked=true;
		}
		if (document.getElementById('agree_'+room+'_1').checked==true && document.getElementById('sharing_'+room+'_1_yes').checked) {
			document.getElementById('sharing_'+room+'_1_yes').checked=false;
			document.getElementById('sharing_'+room+'_1_no').checked=true;
		}		
	}
}