function getEl(elId){
	return document.getElementById(elId);
}

function gotopage(uripart, uripart2){
	var page = getEl('page').value;
	if(!page.match(/^[\d]{1,8}$/)) {
		getEl('page').value = '';
		return false;
	}
	if(page < 1 || page > parseInt(getEl('pages').value)) {
		getEl('page').value = '';
		return false;
	}
	document.location.href = uripart + page + uripart2;
}

function go2page(uripart, page, uripart2){
	var val = page.value;
	uripart2 = typeof(uripart2) != 'undefined' ? uripart2 : '';
	if(!val.match(/^[\d]{1,8}$/)) {
		page.value = '';
		return false;
	}
	if(parseInt(val) < 1 || parseInt(val) > parseInt(getEl('pages').value)) {
		page.value = '';
		return false;
	}
	document.location.href = uripart + val + uripart2;
}

function other_device(obj){
	if(obj.options[obj.selectedIndex].getAttribute('other') == '1') 
		getEl('other_device').style.display = '';
	else
		getEl('other_device').style.display = 'none';
}

function clear_device(){
	var obj = getEl('device_id');
	if(obj.options[obj.selectedIndex].getAttribute('other') == '0'){
		getEl('device').value = '';
	}
}

