 <p> Genome Region or Gene Name: 
  <input name="region" type="text" size="25" value=$GENOME_REGION$>
  <input name="dbregion" type="hidden" size="25" value=$DB_REGION$>
  <input type="submit" name="goto" value="goto"> 
  <script language="javascript"> 
function selectallclick(){ 
	for (var i = 0; i < document.session.elements.length; i++) { 
		var e = document.session.elements[i]; 
		if ((e.name != 'selectall') && (e.type == 'checkbox')) { 
			e.checked = document.session.selectall.checked; 
		} 
	} 
}
function ucsc_click(){
	if (document.session.ucsc_genome_assembly.value == '') {
		alert ('You need to specify a genome assembly for the UCSC genome browser first.');
	} else if (document.session.ucsc_genome_assembly.value.substr(0,4) == 'tair'){
		window.open('http://gbrowse.arabidopsis.org/cgi-bin/gbrowse/arabidopsis_'+document.session.ucsc_genome_assembly.value+'/?'+document.session.region.value);
	} else {
		window.open('http://genome.ucsc.edu/cgi-bin/hgTracks?db='+document.session.ucsc_genome_assembly.value+'&position='+document.session.region.value);
	} 

}

var chr = '$CHR$';
var center = '';
var len = '$LEN$';
var start = '$START$';
var end = '$END$';

var coord_menu = new PopupMenu();
coord_menu.add('', function(target) {});
coord_menu.addSeparator();
coord_menu.add('Zoom in x10', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&zoomin10=&center='+center});
coord_menu.add('Zoom in x3', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&zoomin3=&center='+center});
coord_menu.add('Zoom in x1.5', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&zoomin1_5=&center='+center});
coord_menu.addSeparator();
coord_menu.add('Center', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&center='+center});
coord_menu.addSeparator();
coord_menu.add('Zoom out x1.5', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&zoomout1_5=&center='+center});
coord_menu.add('Zoom out x3', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&zoomout3=&center='+center});
coord_menu.add('Zoom out x10', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&zoomout10=&center='+center});
coord_menu.addSeparator();
coord_menu.add('Show base', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&zoominbase=&center='+center});
coord_menu.add('Show 10K', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&show10K=&center='+center});
coord_menu.add('Show 100K', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&show100K=&center='+center});
coord_menu.add('Show 1M', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&show1M=&center='+center});
coord_menu.add('Show 10M', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$REGION$&show10M=&center='+center});
coord_menu.addSeparator();
coord_menu.add('Mark start', function(target) {start = center});
coord_menu.add('Mark end & show', function(target) {end = center; if (end <= start) {alert('end must be after start, bad region')} else {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region=$CHR$:'+start+'-'+end}});
coord_menu.setSize(150, 0);
coord_menu.bind();

function show_coord_menu(e, pos){
	center = pos;
	coord_menu.items[0].text = chr+':'+center;	
    coord_menu.show(e);
}

var gene_menu = new PopupMenu();
var gene_name = '';
gene_menu.add('', function(target) {});
gene_menu.add('', function(target) {});
gene_menu.addSeparator();
gene_menu.add('Link to NCBI', function(target) {window.open('http://www.ncbi.nlm.nih.gov/entrez/viewer.fcgi?val='+gene_name)});
gene_menu.add('Link to Ensembl', function(target) {window.open('http://www.ensembl.org/Homo_sapiens/searchview?species=all&idx=All&q='+gene_name)});
gene_menu.add('Zoom to selected', function(target) {window.location.href='$HOSTNAME$session?name=$SESSION_NAME$&region='+gene_menu.items[1].text});
gene_menu.setSize(200, 0);
gene_menu.bind('');

function show_gene_menu(e, name, title, region){
	gene_name = name;	
	gene_menu.items[0].text = title;	
	gene_menu.items[1].text = region;	
    gene_menu.show(e);
}
</script>
  Length: $GENOME_REGION_LENGTH$ bp </p>
<p> Move: 
  <input type="submit" name="moveleft3" value="<<<">
  <input type="submit" name="moveleft2" value="<<">
  <input type="submit" name="moveleft" value="<">
  <input type="submit" name="moveright" value=">">
  <input type="submit" name="moveright2" value=">>">
  <input type="submit" name="moveright3" value=">>>">
  Zoom In: 
  <input type="submit" name="zoomin1_5" value="1.5x">
  <input type="submit" name="zoomin3" value="3x">
  <input type="submit" name="zoomin10" value="10x">
  <input type="submit" name="zoominbase" value="base">
  Zoom Out: 
  <input type="submit" name="zoomout1_5" value="1.5x">
  <input type="submit" name="zoomout3" value="3x">
  <input type="submit" name="zoomout10" value="10x">
  Copy: 
  <input type="submit" name="copybases" value="bases">
  <input type="submit" name="copyrevbases" value="complement">
  <input type="submit" name="copyvalues" value="values">
</p>
<p>Left Axis: 
  <input type="submit" name="leftaxis" value=$LEFT_AXIS$>
  Right Axis: 
  <input type="submit" name="rightaxis" value=$RIGHT_AXIS$>
  Grid: 
  <input type="submit" name="grid" value=$GRID$>
  Picture Width: 
  <input name="track_width" type="text" value=$TRACK_WIDTH$ size="4">
  Picture Margin: 
  <input name="pic_margin" type="text" value=$PIC_MARGIN$ size="4">
  Font Size: 
  <input name="font_size" type="text" value=$FONT_SIZE$ size="4">
  <input type="submit" name="refresh" value="refresh">
</p>

<p> 
  <input type="checkbox" name="selectall" onclick="selectallclick()">
  <input $REMOTE_HIDDEN$ type="submit" name="trackdelete" value="delete">
  <input type="submit" name="trackhide" value="hide/unhide">
  <input type="submit" name="trackmoveup" value="move up">
  <input type="submit" name="trackmovedown" value="move down">
  <input type="submit" name="tracktotop" value="to top">
  <input type="submit" name="tracktobottom" value="to bottom">
  <input type="submit" name="trackconfigure" value="configure">
  <input $REMOTE_HIDDEN$ type="submit" name="trackadd" value="add track">
  <input type="submit" name="fold" value="fold/unfold">
  now folded with tracks: 
  <input name="fold_track" type="text" value="$FOLD_TRACK$" size="4">
</p>
<p>$GENOME_TRACKS$ </p>
<p> 
  <input $REMOTE_HIDDEN$ type="submit" name="trackdelete" value="delete">
  <input type="submit" name="trackhide" value="hide/unhide">
  <input type="submit" name="trackmoveup" value="move up">
  <input type="submit" name="trackmovedown" value="move down">
  <input type="submit" name="tracktotop" value="to top">
  <input type="submit" name="tracktobottom" value="to bottom">
  <input type="submit" name="trackconfigure" value="configure">
  <input $REMOTE_HIDDEN$ type="submit" name="trackadd" value="add track">
  <input type="submit" name="fold" value="fold/unfold">
</p>
<p> Move: 
  <input type="submit" name="moveleft3" value="<<<">
  <input type="submit" name="moveleft2" value="<<">
  <input type="submit" name="moveleft" value="<">
  <input type="submit" name="moveright" value=">">
  <input type="submit" name="moveright2" value=">>">
  <input type="submit" name="moveright3" value=">>>">
  Zoom In: 
  <input type="submit" name="zoomin1_5" value="1.5x">
  <input type="submit" name="zoomin3" value="3x">
  <input type="submit" name="zoomin10" value="10x">
  <input type="submit" name="zoominbase" value="base">
  Zoom Out: 
  <input type="submit" name="zoomout1_5" value="1.5x">
  <input type="submit" name="zoomout3" value="3x">
  <input type="submit" name="zoomout10" value="10x">
</p>
<p>Left Axis: 
  <input type="submit" name="leftaxis" value=$LEFT_AXIS$>
  Right Axis: 
  <input type="submit" name="rightaxis" value=$RIGHT_AXIS$>
  Grid: 
  <input type="submit" name="grid" value=$GRID$>
  <input type="submit" name="refresh" value="refresh">
</p>
<p>UCSC Genome Browser 
  <input type="submit" name="ucsc_browser" value=$UCSC_BROWSER$>
  <input type="button" name="ucsc" value="new window" onClick="ucsc_click()">
  with genome assembly 
  <input name="ucsc_genome_assembly" type="text" size="5" value=$UCSC_GENOME_ASSEMBLY$>
  (e.g. hg18, mm9, etc) </p>
<p> $UCSC_BROWSER_FRAME$</p>
<p></p>
