Commits

Anonymous committed f9e0a67

fixing

Comments (0)

Files changed (2)

 }
 
 </script>
-<script type="text/javascript">
-function cookieAjax() {
-	return 		$.ajax({
-		type: "POST",
-		url: "userSearch.php",
-		data: { key: get_cookie('rcircostoken')},
-	});
-}
-$(document).ready(function() {
-	// check if the user has a cookie and if they do use it as the ID
-	if(get_cookie('rcircostoken') != '') {
-		var promise = cookieAjax();
-		promise.success(function (data) {
-			$('#seed_div').html(data);
-		});
-	}
-	var deloptions = {
-			target:			'#delete_div',
-			url: 'delFiles.php',
-	};
-	/* when the user clicks the delete files button the form is submited to
-		a file which handles the server side deletions and hiding the
-		row elements that were deleted*/
-	$('#deleteFiles').click(function() {
-		$('#idForm').ajaxSubmit(deloptions);
-	});
-	/* when the user clicks the start button it hides the data upload form 
-		and displays the plot making form */
-	$('#start').click(function() {
-		start();
-		$('#idForm').css('display','none');
-		$('#circosForm').css('display', 'block');
-	});
-	var optionsinit = { 
-	        target:        '#seed_div',   // target element to be updated with server response 
-	        url: 'fileupload.php',
-	    }; 
-    /* when the user clicks the data upload button the form is submitted to
-    	a file which creates the appropriate files in the directory
-    	and creates the table showing the uploaded files */
-	$('#idForm').submit(function() { 
-		$('#start').css('display', 'inline');
-	    $(this).ajaxSubmit(optionsinit); 
-	    return false; 
-	});
-    var options = { 
-        target:        '#circos_div',   // target element to be updated with server response 
-    }; 
-    /* when the user clicks the start button on the second form the data is 
-    	submitted to a file which creates the plot and displays it underneath
-    	the form. While it is processing a spinner appears */
-    $('#circosForm').submit(function() {
-    	document.getElementById('circos_div').innerHTML = '<img src=\'images/spinner2-greenie.gif\'   style=\'position:relative; left:0px;\' height=\'30\' width=\'30\' />';
-        $(this).ajaxSubmit(options); 
-        return false; 
-    });
-}); 
-</script>
-<script type="text/javascript">
-/* a function to make handling cookies easier. It takes cookie info
- * and then creates a cookie based on that if it is valid as well as
- * converting the usual seconds into days
- */
-function set_cookie ( cookie_name, cookie_value, lifespan_in_days, valid_domain ) {
-	    // http://www.thesitewizard.com/javascripts/cookies.shtml
-	    var domain_string = valid_domain ?
-	                       ("; domain=" + valid_domain) : '' ;
-	    document.cookie = cookie_name +
-	                       "=" + encodeURIComponent( cookie_value ) +
-	                       "; max-age=" + 60 * 60 *
-	                       24 * lifespan_in_days +
-	                       "; path=/" + domain_string ;
-	}
-/* a function to make handling cookies easier. It takes cookie info 
- * and returns any information stored as a cookie that matches that
- * info. If the cookies does not exits it returns an empty string 
- */
-function get_cookie ( cookie_name )
-{
-    // http://www.thesitewizard.com/javascripts/cookies.shtml
-    var cookie_string = document.cookie ;
-    if (cookie_string.length != 0) {
-        var cookie_value = cookie_string.match (
-                        '(^|;)[\s]*' +
-                        cookie_name +
-                        '=([^;]*)' );
-        return decodeURIComponent ( cookie_value[2] ) ;
-    }
-    return '' ;
-}
-/* a function to make handling cookies easier. It takes cookie info
- * and if that cookie exits it deletes it
- */
-function delete_cookie ( cookie_name, valid_domain )
-{
-    // http://www.thesitewizard.com/javascripts/cookies.shtml
-    var domain_string = valid_domain ?
-                       ("; domain=" + valid_domain) : '' ;
-    document.cookie = cookie_name +
-                       "=; max-age=0; path=/" + domain_string ;
-}
-/* a function that takes the number of the track that needs to be changed
- * and then changes the download sample data link to the file that matches
- * the selected type of track.
- */
-function trackDownload(num) {
-	"use strict";
-	var trackType = 'trackType' + num;
-	var trackDiv = "track" + num +"_div";
-	var doc = document.getElementById(trackType);
-	var type = doc.options[doc.selectedIndex].value;
-	var newDownload = "<a href = \"rcircos_help.html\" onclick=\"Javascript: return popitup('rcircos_help.html#" + type + "')\">?&nbsp;</a> <a href=\"Sampledata/example" + type + "Data.txt\">Download Data</a>";
-	document.getElementById(trackDiv).innerHTML = newDownload;
-}
-/* This function makes sure that the entered track height does not exceed 3
- * since the plot does not come out correctly if it does
- */
-function fixHeight() {
-	trackHeight = document.getElementById('trackHeight');
-	if(trackHeight.value > 3) {
-		trackHeight.value = 3;
-		alert("Warning! Track Height cannot be greater than 3!");
-	}
-}
-/* This function ensures that no illegal characters will be included in the
- * plot name to prevent errors
- */
-function fixName() {
-	var illegal = new Array(':', '|','/', '\\', '(', ')', '.', '~', "'", '"', "?", "#", "$", "%", "&", ",", "!", "@", "^", "*", ";", "[", "]", "{", "}", "<",">","+", "-", " ");
-	var name = $('#plotName').val();
-  	var error = false;
-  	length = illegal.length;
-	for(var i = 0; i<length; i++) {
-		var charExists = (name.indexOf(illegal[i]) >= 0);
-		if(charExists) {
-			error = true;
-			var character = illegal[i];
-			var rnum = name.split(character);
-			var len = rnum.length;
-			name = '';
-			for(var c = 0; c<len; c++) {
-				name += rnum[c];
-			}
-		}
-	}
-	if(error) {
-		$('#plotName').val(name);
-		window.alert('Illegal characters have been removed from the plot name');
-	}
-}
-/* This function creates the pop up windows that the help information shows up in
- * and shifts the focus to the new window.
- */
-function popitup(url) {
-	newwindow=window.open(url, 'name', 'height=600, width=800, scrollbars=yes');
-	if(window.focus) {newwindow.focus()}
-	return false;
-}
-/* HTML's reset function does not work properly with some elements of the form
- * so this manually resets the visability of chromosomes and download data links
- */
-function speciesReset() {
-	document.getElementById('track3_div').innerHTML = "<a href='Sampledata/exampleLineData.txt'>Download Data</a>";
-	document.getElementById('Chr20').style.display = "table-cell";
-	document.getElementById('Chr21').style.display = "table-cell";
-	document.getElementById('Chr22').style.display = "table-cell";
-	document.getElementById('ChrY').style.display = "table-cell";
-	document.getElementById('track1_div').innerHTML = "<a href='Sampledata/exampleHeatmapData.txt'>Download Data</a>";
-	document.getElementById('track2_div').innerHTML = "<a href='Sampledata/exampleHistogramData.txt'>Download Data</a>";
-	document.getElementById('track4_div').innerHTML = "<a href='Sampledata/exampleScatterData.txt'>Download Data</a>";
-	document.getElementById('track5_div').innerHTML = "<a href='Sampledata/exampleTileData.txt'>Download Data</a>";
-}
-/* Since each species has different chromosomes the chromosome exclude table 
- * must be modified to acurately reflect the chromosomes that the species has.
- * This function simply hides or shows the ones that are supposed to be there. 
- */
-function changeSpecies() {
-	var speciesName = document.getElementById('speciesName');
-	if(speciesName.value == "Human") {
-		document.getElementById('Chr20').style.display = "table-cell";
-		document.getElementById('Chr21').style.display = "table-cell";
-		document.getElementById('Chr22').style.display = "table-cell";
-		document.getElementById('ChrY').style.display = "table-cell";
-	} else if(speciesName.value == "Mouse") {
-		document.getElementById('Chr20').style.display = "none";
-		document.getElementById('Chr21').style.display = "none";
-		document.getElementById('Chr22').style.display = "none";
-		document.getElementById('ChrY').style.display = "table-cell";
-	} else {
-		document.getElementById('Chr20').style.display = "table-cell";
-		document.getElementById('Chr21').style.display = "none";
-		document.getElementById('Chr22').style.display = "none";
-		document.getElementById('ChrY').style.display = "none";
-	}
-}
-/* Generates a random 30 character long string that serves as the identifier 
- * for each unique user. The server creates a directory for this id and then
- * displays the id in the textbox and gives the option to save the id as a cookie
- */
-function startNewSession() { 
-	delete_cookie('rcircostoken');
-	$('#fileManager').css('display', 'none');
-	var chars = "1234567890abcdefghijklmnopqrstuvwxyz";
-	var token = "";
-	var c = 0;
-	while(c <= 30) {
-		token = token.concat(chars.charAt(Math.random()*47));
-		c++;
-	}
-	$.ajax({
-		type: "POST",
-		url: "makeDirectory.php",
-		data: { username: token}
-	}).done(function() {
-		var dis = document.getElementById('userID');
-		dis.value = token;
-		$('#username').val(token);
-		dis.type = "text";
-		$("#ID").html('');
-		$('#username').val(token);
-		$("#cookie").html("<button type='button' onclick='Javascript: saveCookie();'>Save as Cookie</button>");
-	});
-
-}
-function saveCookieAjax() {
-	return 		$.ajax({
-		type: "POST",
-		url: "hash.php",
-		data: { plaintext : document.getElementById('userID').value},
-	});
-}
-/* saves the id in the textbox as a cookie that will by default apear whenever
- * the user returns to the site and takes away the textbox for id input.
- */
-function saveCookie() {
-	 var promise = saveCookieAjax();
-	promise.success(function (data) {
-		$('#circos_div').html(data);
-	});
-//	var dis = document.getElementById('userID');
-//	dis.type = "hidden";
-//	$("#ID").html(dis.value);
-//	set_cookie('rcircostoken', dis.value, 14);
-//	$("#cookie").html("<button type='button' onclick='Javascript: forgetCookie();'>Forget Cookie</button>");
-}
-/* 
- * deletes the user's cookie and returns the function to input a user provided id 
- */
-function forgetCookie() {
-	var dis = document.getElementById('userID');
-	dis.type = "text";
-	dis.value = $('#ID').html();
-	$("#ID").html('');
-	delete_cookie('rcircostoken');
-	$("#cookie").html("<button type='button' onclick='Javascript: saveCookie();'>Save as Cookie</button>");
-}
-/* 
- * Switches the display to the currently selected plot from the hitory menu
- */
-function histUpdate() {
-	var username = $('#userID').val();
-	var circosPlot = $('#historySelect').val() ;
-	if(circosPlot.slice(-3) == 'pdf') {
-		$('#circos_div').html("<a href='" + circosPlot + "'>Download Plot</a>");
-	} else {
-		$('#circos_div').html("<img align='center' src='" + circosPlot +"' height='800' width='800' >");
-	}
-}
-/*
- * Draws a curved given start and stop coordinates
- */
-function DrawLine(x1, y1, x2, y2, color) {
-	var canvas = document.getElementById('relationsCanvas');
-	var context = canvas.getContext('2d');
-	var posAdjust = $('#relationsCanvas').offset();
-	x1 = x1-posAdjust.left;
-	y1 = y1-posAdjust.top;
-	x2 = x2-posAdjust.left;
-	y2 = y2-posAdjust.top;
-	context.beginPath();
-	context.lineWidth = 5;
-	context.moveTo(x1, y1);
-	context.quadraticCurveTo(200 , y2 , x2, y2);
-    context.strokeStyle = color;
-	context.stroke(); 
-	}
-/*
- * Espaces characters that need to be escaped in a jquery ID selector
- */
-function jq( myid ) {
-	return myid.replace( /(:|\.|\[|\])/g, "\\$1" );
-}
-</script>
 </head>
 <body>
 <!--[IF IE]>
 						<option value="Scatter">Scatter Plot</option>
 						<option value="Tile">Tile Plot</option>
 				</select>
-				<div id="track1_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#heatmaps')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleHeatmapData.txt">Download Data</a></div></td>
+				<div id="track1_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#Heatmap')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleHeatmapData.txt">Download Data</a></div></td>
 				<td name="ph1">placeholder
 				</td>
 				<td align="center"></td>
 						<option value="Scatter">Scatter Plot</option>
 						<option value="Tile">Tile Plot</option>
 				</select>
-				&nbsp; <div id="track2_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#histograms')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleHistogramData.txt">Download Data</a></div>
+				&nbsp; <div id="track2_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#Histogram')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleHistogramData.txt">Download Data</a></div>
 				</td>
 				
 				<td name="ph2">placeholder</td>
 						<option value="Scatter">Scatter Plot</option>
 						<option value="Tile">Tile Plot</option>
 				</select>
-				<div id="track3_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#linePlots')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleLineData.txt">Download Data</a></div>
+				<div id="track3_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#Line')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleLineData.txt">Download Data</a></div>
 				</td>
 				<td name="ph3">placeholder</td>
 				<td>&nbsp;</td>
 						<option value="Scatter" selected ='selected'>Scatter Plot</option>
 						<option value="Tile">Tile Plot</option>
 				</select>
-				<div id="track4_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#scatterPlots')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleScatterData.txt">Download Data</a></div>
+				<div id="track4_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#Scatter')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleScatterData.txt">Download Data</a></div>
 				</td>
 				<td name="ph4">placeholder</td>
 				<td>&nbsp;</td>
 						<option value="Scatter">Scatter Plot</option>
 						<option value="Tile" selected ='selected'>Tile Plot</option>
 				</select>
-				<div id="track5_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#tilePlots')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleTileData.txt">Download Data</a></div>
+				<div id="track5_div"><a href = "rcircos_help.html" onclick="Javascript: return popitup('rcircos_help.html#Tile')">?&nbsp;&nbsp;</a><a href="Sampledata/exampleTileData.txt">Download Data</a></div>
 				</td>
 				<td name="ph5">placeholder</td>
 				<td>&nbsp;</td>
     </tr>
 		</table>
 
-</form>
-<div id='circos_div' align='center'></div>
-<div id='stop_div'><a style="display:none">huehuehue</a></div>
+</form>
+<div id='circos_div' align='center'></div>
+<div id='stop_div'><a style="display:none">huehuehue</a></div>
+<script type="text/javascript">
+function cookieAjax() {
+	return 		$.ajax({
+		type: "POST",
+		url: "userSearch.php",
+		data: { key: get_cookie('rcircostoken')},
+	});
+}
+$(document).ready(function() {
+	// check if the user has a cookie and if they do use it as the ID
+	if(get_cookie('rcircostoken') != '') {
+		var promise = cookieAjax();
+		promise.success(function (data) {
+			$('#seed_div').html(data);
+		});
+	}
+	var deloptions = {
+			target:			'#delete_div',
+			url: 'delFiles.php',
+	};
+	/* when the user clicks the delete files button the form is submited to
+		a file which handles the server side deletions and hiding the
+		row elements that were deleted*/
+	$('#deleteFiles').click(function() {
+		$('#idForm').ajaxSubmit(deloptions);
+	});
+	/* when the user clicks the start button it hides the data upload form 
+		and displays the plot making form */
+	$('#start').click(function() {
+		start();
+		$('#idForm').css('display','none');
+		$('#circosForm').css('display', 'block');
+	});
+	var optionsinit = { 
+	        target:        '#seed_div',   // target element to be updated with server response 
+	        url: 'fileupload.php',
+	    }; 
+    /* when the user clicks the data upload button the form is submitted to
+    	a file which creates the appropriate files in the directory
+    	and creates the table showing the uploaded files */
+	$('#idForm').submit(function() { 
+		$('#start').css('display', 'inline');
+	    $(this).ajaxSubmit(optionsinit); 
+	    return false; 
+	});
+    var options = { 
+        target:        '#circos_div',   // target element to be updated with server response 
+    }; 
+    /* when the user clicks the start button on the second form the data is 
+    	submitted to a file which creates the plot and displays it underneath
+    	the form. While it is processing a spinner appears */
+    $('#circosForm').submit(function() {
+    	document.getElementById('circos_div').innerHTML = '<img src=\'images/spinner2-greenie.gif\'   style=\'position:relative; left:0px;\' height=\'30\' width=\'30\' />';
+        $(this).ajaxSubmit(options); 
+        return false; 
+    });
+}); 
+</script>
+<script type="text/javascript">
+/* a function to make handling cookies easier. It takes cookie info
+ * and then creates a cookie based on that if it is valid as well as
+ * converting the usual seconds into days
+ */
+function set_cookie ( cookie_name, cookie_value, lifespan_in_days, valid_domain ) {
+	    // http://www.thesitewizard.com/javascripts/cookies.shtml
+	    var domain_string = valid_domain ?
+	                       ("; domain=" + valid_domain) : '' ;
+	    document.cookie = cookie_name +
+	                       "=" + encodeURIComponent( cookie_value ) +
+	                       "; max-age=" + 60 * 60 *
+	                       24 * lifespan_in_days +
+	                       "; path=/" + domain_string ;
+	}
+/* a function to make handling cookies easier. It takes cookie info 
+ * and returns any information stored as a cookie that matches that
+ * info. If the cookies does not exits it returns an empty string 
+ */
+function get_cookie ( cookie_name )
+{
+    // http://www.thesitewizard.com/javascripts/cookies.shtml
+    var cookie_string = document.cookie ;
+    if (cookie_string.length != 0) {
+        var cookie_value = cookie_string.match (
+                        '(^|;)[\s]*' +
+                        cookie_name +
+                        '=([^;]*)' );
+        return decodeURIComponent ( cookie_value[2] ) ;
+    }
+    return '' ;
+}
+/* a function to make handling cookies easier. It takes cookie info
+ * and if that cookie exits it deletes it
+ */
+function delete_cookie ( cookie_name, valid_domain )
+{
+    // http://www.thesitewizard.com/javascripts/cookies.shtml
+    var domain_string = valid_domain ?
+                       ("; domain=" + valid_domain) : '' ;
+    document.cookie = cookie_name +
+                       "=; max-age=0; path=/" + domain_string ;
+}
+/* a function that takes the number of the track that needs to be changed
+ * and then changes the download sample data link to the file that matches
+ * the selected type of track.
+ */
+function trackDownload(num) {
+	"use strict";
+	var trackType = 'trackType' + num;
+	var trackDiv = "track" + num +"_div";
+	var doc = document.getElementById(trackType);
+	var type = doc.options[doc.selectedIndex].value;
+	var newDownload = "<a href = \"rcircos_help.html\" onclick=\"Javascript: return popitup('rcircos_help.html#" + type + "')\">?&nbsp;</a> <a href=\"Sampledata/example" + type + "Data.txt\">Download Data</a>";
+	document.getElementById(trackDiv).innerHTML = newDownload;
+}
+/* This function makes sure that the entered track height does not exceed 3
+ * since the plot does not come out correctly if it does
+ */
+function fixHeight() {
+	trackHeight = document.getElementById('trackHeight');
+	if(trackHeight.value > 3) {
+		trackHeight.value = 3;
+		alert("Warning! Track Height cannot be greater than 3!");
+	}
+}
+/* This function ensures that no illegal characters will be included in the
+ * plot name to prevent errors
+ */
+function fixName() {
+	var illegal = new Array(':', '|','/', '\\', '(', ')', '.', '~', "'", '"', "?", "#", "$", "%", "&", ",", "!", "@", "^", "*", ";", "[", "]", "{", "}", "<",">","+", "-", " ");
+	var name = $('#plotName').val();
+  	var error = false;
+  	length = illegal.length;
+	for(var i = 0; i<length; i++) {
+		var charExists = (name.indexOf(illegal[i]) >= 0);
+		if(charExists) {
+			error = true;
+			var character = illegal[i];
+			var rnum = name.split(character);
+			var len = rnum.length;
+			name = '';
+			for(var c = 0; c<len; c++) {
+				name += rnum[c];
+			}
+		}
+	}
+	if(error) {
+		$('#plotName').val(name);
+		window.alert('Illegal characters have been removed from the plot name');
+	}
+}
+/* This function creates the pop up windows that the help information shows up in
+ * and shifts the focus to the new window.
+ */
+function popitup(url) {
+	newwindow=window.open(url, 'name', 'height=600, width=800, scrollbars=yes');
+	if(window.focus) {newwindow.focus()}
+	return false;
+}
+/* HTML's reset function does not work properly with some elements of the form
+ * so this manually resets the visability of chromosomes and download data links
+ */
+function speciesReset() {
+	document.getElementById('track3_div').innerHTML = "<a href='Sampledata/exampleLineData.txt'>Download Data</a>";
+	document.getElementById('Chr20').style.display = "table-cell";
+	document.getElementById('Chr21').style.display = "table-cell";
+	document.getElementById('Chr22').style.display = "table-cell";
+	document.getElementById('ChrY').style.display = "table-cell";
+	document.getElementById('track1_div').innerHTML = "<a href='Sampledata/exampleHeatmapData.txt'>Download Data</a>";
+	document.getElementById('track2_div').innerHTML = "<a href='Sampledata/exampleHistogramData.txt'>Download Data</a>";
+	document.getElementById('track4_div').innerHTML = "<a href='Sampledata/exampleScatterData.txt'>Download Data</a>";
+	document.getElementById('track5_div').innerHTML = "<a href='Sampledata/exampleTileData.txt'>Download Data</a>";
+}
+/* Since each species has different chromosomes the chromosome exclude table 
+ * must be modified to acurately reflect the chromosomes that the species has.
+ * This function simply hides or shows the ones that are supposed to be there. 
+ */
+function changeSpecies() {
+	var speciesName = document.getElementById('speciesName');
+	if(speciesName.value == "Human") {
+		document.getElementById('Chr20').style.display = "table-cell";
+		document.getElementById('Chr21').style.display = "table-cell";
+		document.getElementById('Chr22').style.display = "table-cell";
+		document.getElementById('ChrY').style.display = "table-cell";
+	} else if(speciesName.value == "Mouse") {
+		document.getElementById('Chr20').style.display = "none";
+		document.getElementById('Chr21').style.display = "none";
+		document.getElementById('Chr22').style.display = "none";
+		document.getElementById('ChrY').style.display = "table-cell";
+	} else {
+		document.getElementById('Chr20').style.display = "table-cell";
+		document.getElementById('Chr21').style.display = "none";
+		document.getElementById('Chr22').style.display = "none";
+		document.getElementById('ChrY').style.display = "none";
+	}
+}
+/* Generates a random 30 character long string that serves as the identifier 
+ * for each unique user. The server creates a directory for this id and then
+ * displays the id in the textbox and gives the option to save the id as a cookie
+ */
+function startNewSession() { 
+	delete_cookie('rcircostoken');
+	$('#fileManager').css('display', 'none');
+	var chars = "1234567890abcdefghijklmnopqrstuvwxyz";
+	var token = "";
+	var c = 0;
+	while(c <= 30) {
+		token = token.concat(chars.charAt(Math.random()*47));
+		c++;
+	}
+	$.ajax({
+		type: "POST",
+		url: "makeDirectory.php",
+		data: { username: token}
+	}).done(function() {
+		var dis = document.getElementById('userID');
+		dis.value = token;
+		$('#username').val(token);
+		dis.type = "text";
+		$("#ID").html('');
+		$('#username').val(token);
+		$("#cookie").html("<button type='button' onclick='Javascript: saveCookie();'>Save as Cookie</button>");
+	});
+
+}
+function saveCookieAjax() {
+	return 		$.ajax({
+		type: "POST",
+		url: "hash.php",
+		data: { plaintext : document.getElementById('userID').value},
+	});
+}
+/* saves the id in the textbox as a cookie that will by default apear whenever
+ * the user returns to the site and takes away the textbox for id input.
+ */
+function saveCookie() {
+	 var promise = saveCookieAjax();
+	promise.success(function (data) {
+		$('#circos_div').html(data);
+	});
+//	var dis = document.getElementById('userID');
+//	dis.type = "hidden";
+//	$("#ID").html(dis.value);
+//	set_cookie('rcircostoken', dis.value, 14);
+//	$("#cookie").html("<button type='button' onclick='Javascript: forgetCookie();'>Forget Cookie</button>");
+}
+/* 
+ * deletes the user's cookie and returns the function to input a user provided id 
+ */
+function forgetCookie() {
+	var dis = document.getElementById('userID');
+	dis.type = "text";
+	dis.value = $('#ID').html();
+	$("#ID").html('');
+	delete_cookie('rcircostoken');
+	$("#cookie").html("<button type='button' onclick='Javascript: saveCookie();'>Save as Cookie</button>");
+}
+/* 
+ * Switches the display to the currently selected plot from the hitory menu
+ */
+function histUpdate() {
+	var username = $('#userID').val();
+	var circosPlot = $('#historySelect').val() ;
+	if(circosPlot.slice(-3) == 'pdf') {
+		$('#circos_div').html("<a href='" + circosPlot + "'>Download Plot</a>");
+	} else {
+		$('#circos_div').html("<img align='center' src='" + circosPlot +"' height='800' width='800' >");
+	}
+}
+/*
+ * Draws a curved given start and stop coordinates
+ */
+function DrawLine(x1, y1, x2, y2, color) {
+	var canvas = document.getElementById('relationsCanvas');
+	var context = canvas.getContext('2d');
+	var posAdjust = $('#relationsCanvas').offset();
+	x1 = x1-posAdjust.left;
+	y1 = y1-posAdjust.top;
+	x2 = x2-posAdjust.left;
+	y2 = y2-posAdjust.top;
+	context.beginPath();
+	context.lineWidth = 5;
+	context.moveTo(x1, y1);
+	context.quadraticCurveTo(200 , y2 , x2, y2);
+    context.strokeStyle = color;
+	context.stroke(); 
+	}
+/*
+ * Espaces characters that need to be escaped in a jquery ID selector
+ */
+function jq( myid ) {
+	return myid.replace( /(:|\.|\[|\])/g, "\\$1" );
+}
+</script>
 </body>
 </html>
 fclose($RFileHandle);
 $cmd = "/usr/bin/R --vanilla < " .  $cmd_file . ' 2>&1';
 $changeDir = shell_exec("cd ".$outDir);
-$output = shell_exec($cmd);
+$output = shell_exec($cmd); // pdf's crash here when on Jack's server
 $errorCheck = explode("Error!", $output);
 if(count($errorCheck) > 1) {
 	echo "<script>window.alert('Some of your data was unable to be plotted. Check what data is missing in your plot and make sure that the files with that data are formatted correctly and do not go outside chromosome bounds');</script>";