/* common javascript functions */

function set_focus(x) {
	if (!x) return;
	x.focus();
	x.select();
}

function open_url(url) {
        if (url.length) {
		var r=Math.floor(Math.random()*11)
                window.open(url, 'butt_window_'+r);
	}
}

function showpermissiondialog(){
	FB.Connect.showPermissionDialog('email',function(perms) {
	window.location='/login.php';
	});
}


var sample=true;
function select_field(id) {

	if (sample == true) {
		var q1 = document.getElementById("q1");
		var q2 = document.getElementById("q2");
		q1.value = '';
		q2.value = '';
		sample = false;
	}

	document.getElementById(id).select();
}

function blur_field(id) {
}


function fillTextBox(id, text_value) {
	if (!id.value.length)
		id.value = text_value;
}
