  var createdWindows = [];
  var createdWindowCnt = 0;
  var modelFile;
  var isWorkSaved = false;
  var fluxData = [];  
  var conditionData = [];
  var conditionIdx = [];
  var conditions = [];
  var expressionData = [];
  var expressions = [];
  var conditionCnt = 0;
  var pathwayName = "";
  var fileCount = 0;
  var userlevel = -1;
  var isUserIdOk = false;
  var loadedWork = false;
  var rnameArray = [];
  var rvalueArray = [];
  var rnset = [];
  var rvset = [];
  
  var isTrueOrFalse = true;
  
var localhost = "http://bioinfo.bti.a-star.edu.sg/webcoli/"
  //var localhost = "http://localhost:8080/webcoli/"
 //var localhost = "www.webcoli.org/"
  var reactionList = []; // reation list of selected pathway
  var fluxDataSet = [];  // flux set of reations
  var selectedFluxIdx = -1;
  var projectIdx = 0;
  
    //Visualization Option
  var thickness = 1;
  var reaction = 1;
  var vertexSize = 1;
  var showcofactor = 1;
  var minvalue = -10;
  var maxvalue = 10;
  
  var selectedPathwayName = '';
  var selectedCategory = '';
  
  var previousPathwayName = '';
  var previousCategory = '';
  var previousGubun = '';
  
  var openNewWindow = false;
  
  var isUseTip = false;
  
  var isIE = true;
  var eventValue;
  //dojo.addOnLoad(init);
  
  function checkIE()
  {
       if (navigator.appName == "Microsoft Internet Explorer")
           isIE = true;
       else
           isIE = false;
  }
  function SaveMouseEvent(e)
   {
      eventValue = e;
   }

 
  function initMouseCapture()
  {
       checkIE();

       if (isIE == false)
       {
           document.addEventListener('mousemove',SaveMouseEvent,false);
       }
  }

  function runEditor()
  {
	//alert("You need to install JDK(over 1.5, http://java.sun.com)!\nPlease check first!");
	window.open("SBMLEditor.jnlp",'','');
  } 
  
   function startMouseCapture(objCapture)
   {
       if ( isIE == false )
           return;

       objCapture.setCapture();
   }

   function endMouseCapture(objCapture)
   {
       if ( isIE == false )
           return;

       objCapture.releaseCapture();
   }
	
  
  /*Function of alert message*/
  function alertMessage(message)
  {
  	//progressdlg.hide();
  	//alert(message);
  }
  /*Display the registration form*/
  function showRegistForm()
  {
  	//var docPane = dojo.widget.getWidgetById("MainPagePane");
    //		docPane.setUrl('docs/registration.html');
  	//byId("loginPane").style.visibility = "hidden";
  	//byId("loginPane").style.display = 'none';
  	//byId("loginTable").style.display = "none";
  	//byId("loginTable").style.visibility = "hidden";

  	//byId("copyright").style.top = (winHeight - 600)/2 + 400;
  	showMain();
  }
  /*Display the login page*/
  function showLoginPage()
  {
  	//var docPane = dojo.widget.getWidgetById("MainPagePane");
    //		docPane.setUrl('docs/systeminfo.html');
  	hideMain();
  	//byId("loginPane").style.visibility = 'visible';
  	//byId("loginPane").style.display = 'inline';
  	//byId("loginTable").style.display = "inline";
  	//byId("loginTable").style.visibility = "visible";
  	//byId("copyright").style.top = (winHeight - 600)/2 + 300;
  }
  /*Registration data validation function*/
  function openNewWindow_ilog() 
  {
   popupWin = window.open('http://www.ilog.com','open_window','menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0')
  }
  function openNewWindow_sbml() 
  {
   popupWin = window.open('http://www.sbml.org','open_window','menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0')
  }
    function openNewWindow_kegg() 
  {
   popupWin = window.open('http://www.genome.jp/kegg/','open_window','menubar, toolbar, location, directories, status, scrollbars, resizable, dependent, width=640, height=480, left=0, top=0')
  }
  
  function registUserInfo()
  {
    
        var at="@"
		var dot="."
		var str=byId('username').value;
		
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
  	if(str == null)
  	{
  		alert("E-Mail is empty. Please fill out all of required fiels");
  		byId("username").focus();
  		return;
  	}
  	
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
  	checkUserId();
  	if(byId("password1").value!=byId("password2").value)
  	{
  	  alert("Password's mismatch!");
  	}
  	if(byId("firstName").value=="")
  	{
  	  alert("Firstname missing!");
  	  
  	} 
  	if(byId("lastName").value=="")
  	{
  	  alert("Lastname missing!");
  	  
  	} 
  	if(byId("company").value=="")
  	{
  	  alert("Organization name missing!");
  	  
  	} 
  	
    else
    {
   	
     

	 var sendData = "action=register";
	    
  	sendData = sendData + "&userid=newuser";
  	sendData = sendData + "&username="+byId("username").value;
  	sendData = sendData + "&password="+byId("password1").value;
  	
  	sendData = sendData + "&firstname="+byId("firstName").value;
  	sendData = sendData + "&lastname="+byId("lastName").value;
  	sendData = sendData + "&company="+byId("company").value;
  	sendData = sendData + "&country="+byId("country").value;
   	var getPost = "POST";                      
   	var urlFileAppl = "UserServlet";
   	var trueFalse = isTrueOrFalse;                       
 
   	var xmlHttp = newXMLHttpRequest();           
  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
  

    xmlHttp.onreadystatechange = function() {    
        if (xmlHttp.readyState == 4) {                
            if (xmlHttp.status == 200) { 
            	//alert("Registration is completed! \nYou can access WEbcoli now!");
            	//showLoginPage();
            	//Pleas Send and email from here;
            	
            } else {
                exceptionControl(xmlHttp);            
                alertMessage("Code: 1001");
            }
        }
    }
     	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
           xmlHttp.setRequestHeader("Content-Type", conType);
           	xmlHttp.send(sendData);
    }
  }
  /*If the user id is modified then initialize the validation check as false*/
  function changedUserId()
  {
  	isUserIdOk = false;
  }
  /*User id validation check*/
  function checkUserId()
  {
    
  	var sendData = "action=useridcheck";
  	var tmpName = byId("username").value;
  	sendData = sendData + "&userid="+tmpName;
   	var getPost = "POST";                      
   	var urlFileAppl = "UserServlet";
   	var trueFalse = isTrueOrFalse;                       

   	var xmlHttp = newXMLHttpRequest();           
  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
    xmlHttp.onreadystatechange = function() {    
        if (xmlHttp.readyState == 4) {                
            if (xmlHttp.status == 200) { 
            	if(xmlHttp.responseText == 'success')
            	{
            		//alert(tmpName+" is available!");
            		//isUserIdOk = true;
            	}else if(xmlHttp.responseText == 'wrong'){
            		alert(tmpName+" already in use!");
            		//isUserIdOk = false;
            	}else{
            		alert(tmpName+" is not available\n"+tmpName+" is already used by someone");
            		isUserIdOk = false;
            	}
            } else {
                exceptionControl(xmlHttp);            
                alertMessage("Code: 1002");
            }
        }
    }
    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
    xmlHttp.setRequestHeader("Content-Type", conType);
    xmlHttp.send(sendData);
      }
  /* Login process */
  function login()
  {
   
   alert("here");
  	//Start Login
  	var sendData = "action=login";
  	//sendData = sendData + "&userid=guest";
  	//sendData = sendData + "&passwd=guest";
   	sendData = sendData + "&userid="+byId("userid").value;
  	sendData = sendData + "&passwd="+byId("passwd").value;
   	var getPost = "POST";                      
   	var urlFileAppl = "UserServlet";
   	//var trueFalse = isTrueOrFalse;
   	
   	var trueFalse = false;
   	
   	var xmlHttp = newXMLHttpRequest();           
  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
    xmlHttp.onreadystatechange = function() {    
        if (xmlHttp.readyState == 4) {                
            if (xmlHttp.status == 200) {
            	loginProc(xmlHttp);
            } else {
                exceptionControl(xmlHttp);            
                alertMessage("Code: 1003");
            }
        }
    }
    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
    xmlHttp.setRequestHeader("Content-Type", conType);
    xmlHttp.send(sendData);
  	//End of Login
  	
  }
  /*Plus the visit counter */
  function plusCount()
  {
  	var sendData = "cmd=plus";
  	sendData = sendData + "&userid="+userid;
   	var getPost = "POST";                      
   	var urlFileAppl = "CounterServlet";
   	var trueFalse = isTrueOrFalse;

   	var xmlHttp = newXMLHttpRequest();           
  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
    xmlHttp.onreadystatechange = function() {    
        if (xmlHttp.readyState == 4) {                
            if (xmlHttp.status == 200) {               
            } else {
                exceptionControl(xmlHttp);            
                alertMessage("Code: 1003");
            }
        }
    }
    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
    xmlHttp.setRequestHeader("Content-Type", conType);
    xmlHttp.send(sendData);
  }
  /*Get the visitor's count*/
  function getCount()
  {
  	var sendData = "cmd=getCount";
  	sendData = sendData + "&userid="+userid;
   	var getPost = "POST";                      
   	var urlFileAppl = "CounterServlet";
   	var trueFalse = isTrueOrFalse;

   	var xmlHttp = newXMLHttpRequest();           
  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
    xmlHttp.onreadystatechange = function() {    
        if (xmlHttp.readyState == 4) {                
            if (xmlHttp.status == 200) {
            	if(xmlHttp.responseText == "Today: 0 / Total: 0")
            	{
            		getCount();
            	}else               
            		byId("counterDiv").innerHTML = "<center><font color='#787878'>"+xmlHttp.responseText+"</font></center>";
            } else {
                exceptionControl(xmlHttp);            
                alertMessage("Code: 1003");
            }
        }
    }
    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
    xmlHttp.setRequestHeader("Content-Type", conType);
    xmlHttp.send(sendData);
  }
  /*Display form of changing password*/
  function showPasswordForm()
  {
  	if(userid == 'guest') return;
  	if(byId("changePasswordForm").style.visibility == "visible"){
  		byId("changePasswordForm").style.visibility = "hidden";
  		byId("changePasswordForm").style.display = "none";
  	}else{
	  	byId("changePasswordForm").style.visibility = "visible";
	  	byId("changePasswordForm").style.display = "inline";
  	}
	byId("oldPass").value = '';
	byId("newPass1").value = '';
	byId("newPass2").value = '';  	
  }
  /*Function of change password*/
  function changePassword()
  {
  	var oldPass = byId("oldPass").value;
  	var newPass1 = byId("newPass1").value;
  	var newPass2 = byId("newPass2").value;
  	if(newPass1 != newPass2)
  	{
  		alert("New Password are not match!\n Please enter again!");
  		return;
  	}
  	var sendData = "action=changepasswd&userid="+userid;
  	sendData = sendData + "&oldpass="+oldPass;
  	sendData = sendData + "&newpass="+newPass1;

   	var getPost = "POST";                      
   	var urlFileAppl = "UserServlet";
   	var trueFalse = isTrueOrFalse;

   	var xmlHttp = newXMLHttpRequest();           
  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
    xmlHttp.onreadystatechange = function() {    
        if (xmlHttp.readyState == 4) {                
            if (xmlHttp.status == 200) {
            	alert(xmlHttp.responseText);
            	showPasswordForm();
            } else {
                exceptionControl(xmlHttp);            
                alertMessage("Code: 1004");
            }
        }
    }
    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
    xmlHttp.setRequestHeader("Content-Type", conType);
    xmlHttp.send(sendData);
  }
  /*Login process*/
  function loginProc(xmlHttp)
  {
  alert("here");
  	var xmlHttpData = xmlHttp.responseText;
  	if(xmlHttpData == "null")
  	{
  		alert("Failed to login!");
  	}else{
  	
  		var colSplit = xmlHttpData.split("<T>");
		userid = byId("userid").value;
		username = colSplit[0];
		userlevel = colSplit[1];
		
		
		if(userid != 'guest' && username != 'guest' && username != '') {
			//byId("usernameLabel").innerHTML = userid+"&nbsp;&nbsp;";
			//byId("loginlabel").innerHTML =  username+" is logged &nbsp;&nbsp;&nbsp;<a href='logout.jsp'><u>[Logout]</u></a>";
			
		}
	  	byId("mainmenu").style.visibility = "visible";
		byId("pathwayTree").style.visibility = "visible";	  	
		
		byId("systeminfopane").style.visibility = "visible";
   		byId("systeminfopane").style.display = "inline";
   		
		byId("copyright").style.visibility = 'hidden';
		byId("copyright").style.display = 'none';
		
		byId('pathwayTotalPane').style.display = 'inline';
		byId('pathwayTotalPane').style.visibility = 'visible';

		byId('analysisTotalPane').style.display = 'inline';
		byId('analysisTotalPane').style.visibility = 'visible';
		
		
	  	getPathwayListAll('pathwayListCombo');
	  	getPathwayListAll('pathwayListComboO');
	  	
	  	getProjectList(userid);
	  	showMain();
	  	plusCount();
        getCount();
        if(userid == 'guest')
        {
        	byId("newConditionBtn").disabled = true;
        }
  	}
  }
	/*Get the saved flux data of logged user*/
	function getDataList(pid,userid)
	{
		//Start get Flux data list
		removelAllArray(conditions);
		removelAllArray(conditionIdx);
		removelAllArray(conditionData);
		conditionCnt = 0;
		var sendData = "action=getDataList";
	  	sendData = sendData + "&userid="+pid+"&username="+userid;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       

	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	setDataList(xmlHttp);
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 1005");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	  	//End of Login
	}
	/*Display the saved flux data list*/
	function setDataList(xmlHttp)
	{
		var xmlHttpData = xmlHttp.responseText;
		
		var rowSplit = xmlHttpData.split("<N>");
		for(var i=0; i<rowSplit.length-1; i++)
		{
			var colSplit = rowSplit[i].split("<T>");
			if(colSplit[0] == "flux")
			{
				conditionIdx.push(colSplit[3]);
				conditions.push(colSplit[1]);
				conditionData.push(colSplit[2]);
			}
		}		
		showFluxList();
	}
	/*function of visualization*/
	function DirectVisualization(sendData, message)
	{
		if(openNewWindow == false)
		{
		var div = document.createElement("DIV");
		
		var l = createdWindows.length + 1; 
		
		var cssTxt = "background : #fff; position: absolute; left: 10px; top: 0px; z-index:1;  width: 650px; height: 650px;";
		// treat IE css special
		//if(dojo.render.html.ie){
		//	div.style.cssText = cssTxt;
		//}else{
		//	div.setAttribute("style", cssTxt);
		//}
		var cont = "<img id='"+message+l+"' src='GraphServlet?"+sendData+"' border='0'>";
		byId("visualizationArea").innerHTML = cont;
		//pane.setContent(cont);
		//progressdlg.hide();
		//if(createdWindowCnt == 0) byId("mytaskbar").style.visibility = "hidden";
		}else{
			//progressdlg.hide();
			//var url = 'http://localhost:8080/webcoli/GraphServlet?'+sendData;
			var url = localhost+'GraphServlet?'+sendData;
			//window.open(url, 'Model Graph', 'fullscreen,scrollbars');
			
			//window.open("index.jsp","","channelmode,scrollbars");
			window.open(url,"Graph","width=800 heiht=800")
		}
	}
	/*Get pathway list of given category(system) */
	function getPathwayList(system, paneName, divname)
    {
       
        var sendData = "";
    	if(paneName == 'User Defined')
    		sendData = "cmd=pathwayListOfUser&pid="+projectIdx+"&userid="+userid;
    	else sendData = "cmd=pathwayList&system="+system;
    	var getPost = "POST";                      
    	var urlFileAppl = "PathwayServlet";
    	var trueFalse = isTrueOrFalse;                      
		//alert(sendData);
    	var xmlHttp = newXMLHttpRequest();            
   		xmlHttp.open(getPost, urlFileAppl, trueFalse);
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                 
	            if (xmlHttp.status == 200) {
	            	if(paneName == 'User Defined')
	            		showPathwayListUser(xmlHttp, paneName, divname);
	            	else showPathwayList(xmlHttp, paneName, divname);
	            } else {
	                exceptionControl(xmlHttp);          
                	alertMessage("Code: 1006");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
    }
	/*Get pathway information of given pathway name(message)*/    
    function getPathway(message)
    {
       
    	var sendData = "cmd=reactionCondition&gubun=subsystem&name="+message;
    	var getPost = "POST";                     
    	var urlFileAppl = "PathwayServlet"; 
    	var trueFalse = isTrueOrFalse;                       

    	var xmlHttp = newXMLHttpRequest();            
   		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {   
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	//showReactionList(xmlHttp, message.node);
	            	showReactionList(xmlHttp);
	            } else {
	                exceptionControl(xmlHttp);            
                	alertMessage("Code: 1022");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
    }
    /*Display visualization option button*/
    function showSelectFluxSet()
    {
   		var cont = "";
   		cont = cont + "";
   		byId("visualizationHead").innerHTML = cont;
    }
    /*Visualization with muti flux data*/
    function readyWithMultiFlux()
    {
    	openNewWindow = false;
    	if(pathwayName == ""){
    		alert("There is no selected pathway!!");
    	}else{
	    	//progressdlg.show();
	    	//var sendData = "cmd=metaboliteList&name="+message.node.title;
	    	var sendData = "cmd=visualize&name="+pathwayName;
	    	sendData = sendData + "&pid="+projectIdx;
	    	var getPost = "POST";                      
	    	var urlFileAppl = "PathwayServlet";
	    	var trueFalse = isTrueOrFalse;                      
	
	    	var xmlHttp = newXMLHttpRequest();            
	   		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
		    xmlHttp.onreadystatechange = function() {    
		        if (xmlHttp.readyState == 4) {                 
		            if (xmlHttp.status == 200) {                
		            	modelFile = xmlHttp.responseText;
    					visualizeWithMultiFlux();
		            } else {
		                exceptionControl(xmlHttp);           
		               alertMessage("Code: 1024");
		            }
		        }
		    }
		    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
		    xmlHttp.setRequestHeader("Content-Type", conType);
		    xmlHttp.send(sendData);
	    }
    }
    /*Visualization in new window*/
    function viewImageInNewWindow()
    {
    	if(pathwayName == ""){
    		alert("There is no selected pathway!!");
    	}else{
	    	var sendData = "cmd=visualize&name="+pathwayName;
	    	sendData = sendData + "&pid="+projectIdx;
	    	
	    	var getPost = "POST";                      
	    	var urlFileAppl = "PathwayServlet";
	    	var trueFalse = isTrueOrFalse;                      
	
	    	var xmlHttp = newXMLHttpRequest();            
	   		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
		    xmlHttp.onreadystatechange = function() {    
		        if (xmlHttp.readyState == 4) {                 
		            if (xmlHttp.status == 200) {                
		            	modelFile = xmlHttp.responseText;
    					visualizeWithMultiFlux();
		            } else {
		                exceptionControl(xmlHttp);           
		                alertMessage("Code: 1009");
		            }
		        }
		    }
		    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
		    xmlHttp.setRequestHeader("Content-Type", conType);
		    xmlHttp.send(sendData);
		  }
    }
    /*Export SBML file of selected pathway*/
    function getSBML()
    {
    	if(pathwayName == ""){
    		alert("There is no selected pathway!!");
    	}else{
		var regx = new RegExp(" ",'g');
		pathwayName = pathwayName.replace(regx," ");
	    	var sendData = "cmd=SBML&name="+pathwayName;
    	 	sendData = sendData + "&pid="+projectIdx;
	    	 	
	    	var url = 'PathwayServlet?'+sendData;
			window.open(url,"SBML","titlebar menubar width=800 heiht=800")
		  }
    }
    /*Visualization*/
    function visualizeWithMultiFlux()
    {
    	var fluxdata = "";
	    
    	//progressdlg.show();
    	var sendData = "cmd=datas&modelfile="+modelFile;
    	var dataCnt = 0;
    	for(var i=0; i<conditions.length; i++)
    	{
    		if(byId("F"+conditionIdx[i]).checked)
    		{
    			dataCnt = dataCnt + 1;
    			sendData = sendData + "&datafile"+dataCnt+"="+conditionData[i];
    			fluxdata = fluxdata + " " + conditions[i];
    		}
    	}
    	if(dataCnt == 0) 
    	{
    		makeModel('model');
    		return;
    	}
    	if(dataCnt > 1)
    		sendData = sendData + "&thickness=0";
    	else
    	    sendData = sendData + "&thickness="+thickness;
    	sendData = sendData + "&reaction="+reaction;
    	sendData = sendData + "&vertexSize="+vertexSize;
    	sendData = sendData + "&showcofactor="+showcofactor;
    	sendData = sendData + "&minvalue="+minvalue;
    	sendData = sendData + "&maxvalue="+maxvalue;
    	sendData = sendData + "&dataCnt="+dataCnt;
    	//informationdlg.hide();
		DirectVisualization(sendData, pathwayName+":"+fluxdata);
    }
    /*Make a data model file of give pathway(message)*/
    function makeModel(message)
    {
    	if(pathwayName == ""){
    		alert("There is no selected pathway!!");
    	}else{
	    	//progressdlg.show();
	    	//var sendData = "cmd=metaboliteList&name="+message.node.title;
	    	var sendData = "cmd=visualize&name="+pathwayName;
	    	sendData = sendData + "&pid="+projectIdx;
	    	var getPost = "POST";                      
	    	var urlFileAppl = "PathwayServlet";
	    	var trueFalse = isTrueOrFalse;                       
	
	    	var xmlHttp = newXMLHttpRequest();            
	   		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
		    xmlHttp.onreadystatechange = function() {    
		        if (xmlHttp.readyState == 4) {                 
		            if (xmlHttp.status == 200) {               
		            	modelFile = xmlHttp.responseText;
		            	//alert(modelFile);
		            	if(modelFile != 'failed'){
			            	if(message == 'model') visualizeModel(message);		            	
	    					else applyData(message);
    					}
		            } else {
		                exceptionControl(xmlHttp);           
		                alertMessage("Code: 1010");
		            }
		        }
		    }
		    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
		    xmlHttp.setRequestHeader("Content-Type", conType);
		    xmlHttp.send(sendData);
	    }
    }
    /*visualization*/
    function visualizeModel(message)
    {
    	var sendData = "cmd=model&modelfile="+modelFile;
    	sendData = sendData + "&thickness="+thickness;
    	sendData = sendData + "&reaction="+reaction;
    	sendData = sendData + "&vertexSize="+vertexSize;
    	sendData = sendData + "&showcofactor="+showcofactor;
    	sendData = sendData + "&minvalue="+minvalue;
    	sendData = sendData + "&maxvalue="+maxvalue;

      	DirectVisualization(sendData, pathwayName);
      	
      	  
    }
    /*Map the flux data to pathway graph*/
    function applyData(idx)
    {
    	var dataFile = conditionData[idx];
    	var fluxdata = conditions[idx];
	    //informationdlg.hide();
    	//progressdlg.show();
    	var sendData = "cmd=data&datafile="+dataFile+"&modelfile="+modelFile;
    	sendData = sendData + "&thickness="+thickness;
    	sendData = sendData + "&reaction="+reaction;
    	sendData = sendData + "&vertexSize="+vertexSize;
    	sendData = sendData + "&showcofactor="+showcofactor;
    	sendData = sendData + "&minvalue="+minvalue;
    	sendData = sendData + "&maxvalue="+maxvalue;
    	    	    
    	
		DirectVisualization(sendData, pathwayName+":"+fluxdata);   	    	
    }
    /*display the reaction list to given panel(paneName)*/
    function showPathwayList(xmlHttp, paneName, divname)    
    {
    
  
    	showORhidePane(divname);
    	
    	var xmlHttpData = xmlHttp.responseText;
    	var pathwayList = xmlHttpData.split("<T>");
		var newTable = byId(paneName);
		for(var i=newTable.rows.length-1; i>=0; i--)
		{
			newTable.deleteRow(i);
		}
    	for(var i=0; i < pathwayList.length; i++)
    	{
    		var div = document.createElement("DIV");
    		div.id = pathwayList[i];
    		var tempName = pathwayList[i].replace("metabolism", "");
    		tempName = tempName.replace("Metabolism", "");
			//div.innerHTML = "<img src='images/spc1.gif'> <a id='a"+pathwayList[i]+"' href=\"javascript:getPathwayInformation('"+pathwayList[i]+"', '"+paneName+"')\">"+pathwayList[i]+"</a>";
			div.innerHTML = "&nbsp;<a id='a"+pathwayList[i]+"' href=\"javascript:getPathwayInformation('"+pathwayList[i]+"', '"+paneName+"')\">"+tempName+"</a>";  
            
    		var newRow = document.createElement("tr");
			
			var newCol = document.createElement("td");			
			newCol.appendChild(div);
			
			newCol.style.borderBottom = "1px solid #ccc";
			newCol.style.borderLeft = "1px solid #ccc";
			newRow.appendChild(newCol);
			newTable.appendChild(newRow);	
		}
    }
    /*display the pathway list of user defiend*/
    function showPathwayListUser(xmlHttp, paneName)
    {
      
    	var xmlHttpData = xmlHttp.responseText;
    
    	var pathwayList = xmlHttpData.split("<T>");
    	
		var newTable1 = byId(paneName+"_pathway");
		var newTable2 = byId(paneName+"_graph");
		deleteRowFromTable(newTable1);
		deleteRowFromTable(newTable2);
		
    	for(var i=0; i < pathwayList.length-1; i++)
    	{
    		var colSplit = pathwayList[i].split("<D>");
    		var div = document.createElement("DIV");
    		div.id = colSplit[0];
    		div.innerHTML = "&nbsp;<a id='a"+colSplit[0]+"' href=\"javascript:getPathwayInformationOfUser('"+colSplit[0]+"', '"+paneName+"', 'G')\">"+colSplit[0]+"</a>";  

    		var newRow = document.createElement("tr");
			var newCol = document.createElement("td");			
			newCol.appendChild(div);
			
			newCol.style.borderBottom = "1px solid #ccc";
			newCol.style.borderLeft = "1px solid #ccc";
			newRow.appendChild(newCol);
			if(colSplit[1] == "P")
				newTable1.appendChild(newRow);
			else
				newTable2.appendChild(newRow);
		}
    }
    
    /*display saved flux data list*/
    function showFluxList()
    {
    	var newTable = byId("FluxDataBody");
		deleteRowFromTable(newTable);
		
    	for(var i=0; i < conditions.length; i++)
    	{
    		var div = document.createElement("DIV");
    		div.id = conditions[i];
    		if(conditions[i].length > 10)
				div.innerHTML = "<table id='fluxTable"+i+"' width='100%' cellpadding=0 cellspacing=0><tr><td><input  type=checkbox id='fluxCombo"+i+"' onClick='changeCompareView();'><a id='flux"+i+"' href='#' onClick='selectFlux("+i+");'><span id='conditionLabel"+i+"'>"+conditions[i].substring(0,9)+"...</span></a></td><td align=right><a href='javascript:deleteCondition(\""+i+"\")'>[X]</a></td></tr></table>";
			else
				div.innerHTML = "<table id='fluxTable"+i+"' width='100%' cellpadding=0 cellspacing=0><tr><td><input  type=checkbox id='fluxCombo"+i+"' onClick='changeCompareView();'><a id='flux"+i+"' href='#' onClick='selectFlux("+i+");'><span id='conditionLabel"+i+"'>"+conditions[i]+"</span></a></td><td align=right><a href='javascript:deleteCondition(\""+i+"\")'>[X]</a></td></tr></table>"; 
			
			var newRow = document.createElement("tr");
    		newRow.id = i;
			var newCol = document.createElement("td");			
			newCol.appendChild(div);
			
			newCol.style.borderBottom = "1px solid #ccc";
			newRow.appendChild(newCol);
			newTable.appendChild(newRow);	
		}
		showSelectFluxSet();
    }
    /*function of flux data selection */
    function selectFlux(idx)
    {
    	showFluxList();
    	selectedFluxIdx = idx;
    	byId("fluxTable"+selectedFluxIdx).style.backgroundColor = "#FAAA92";
    	
    	byId("newCName").value = conditions[idx];
    	byId("newCName").focus = true;
    	byId("newCName").select();
    }
    /*move the selected flux to up*/
    function moveFluxUp()
    {
    	if(selectedFluxIdx < 1) return;
    	var temp = conditions[selectedFluxIdx-1];
    	conditions[selectedFluxIdx-1] = conditions[selectedFluxIdx];
    	conditions[selectedFluxIdx] = temp;
    	
    	var tempData = conditionData[selectedFluxIdx-1];
    	conditionData[selectedFluxIdx-1] = conditionData[selectedFluxIdx];
    	conditionData[selectedFluxIdx] = tempData;
    	
    	selectFlux(selectedFluxIdx-1);
    	readyToGetReactionWithAnalysisCompare();
    }
    /*move the selected flux to down*/
    function moveFluxDown()
    {
    	if(selectedFluxIdx < 0 || selectedFluxIdx > conditions.length-2) return;
    	var temp = conditions[selectedFluxIdx+1];
    	conditions[selectedFluxIdx+1] = conditions[selectedFluxIdx];
    	conditions[selectedFluxIdx] = temp;
    	
    	var tempData = conditionData[selectedFluxIdx+1];
    	conditionData[selectedFluxIdx+1] = conditionData[selectedFluxIdx];
    	conditionData[selectedFluxIdx] = tempData;
    	
    	selectFlux(selectedFluxIdx+1);
    	readyToGetReactionWithAnalysisCompare();
    }
    /*function of display pathway panel*/
    function showPathwayPane()
    {
    	byId("pathwayName").style.visibility = "visible";
    	byId("pathwayNamePane").style.visibility = "visible";    
    	byId("ReactionsPane").style.visibility = "visible";
    	byId('ReactionsPane').style.display = 'inline';    	
    	if(winHeight <= 768)
    	{
		   	byId("Reactions").style.height = 590; 
			byId("visualizationArea").style.height = 520; 
		}else{
		   	byId("Reactions").style.height = winHeight - 170;
			//byId("visualizationArea").style.height = winHeight - 240; 	
		}
		if(byId("reactionList").style.visibility == "hidden"
		   && byId("metaboliteList").style.visibility == "hidden"
		   && byId("visualizationList").style.visibility == "hidden")
			showPathwayReactions();
    }
    /*function of hide the pathway pane*/
    function hidePathwayPane()
    {
    	byId("pathwayName").style.visibility = "hidden";
    	byId("pathwayNamePane").style.visibility = "hidden";    
    	byId("ReactionsPane").style.visibility = "hidden";
    	byId('ReactionsPane').style.display = 'none';    	
    }
    /*function of show analysis pane*/
    function showAnalysisPane()
    {
    	byId("AnalysisPane").style.visibility = "visible";
  		byId('AnalysisPane').style.display = 'inline';
  		byId("analysisControl").style.visibility = "visible";
  		byId('analysisControl').style.display = 'inline';

		if(winHeight <= 768)
    	{
		   	byId("analysis").style.height = 590; 
			byId("condition").style.height = 560;
			byId("objfunc").style.height = 560; 
			byId("LPScript").style.height = 560;
			byId("conditionListDiv").style.height = 560;
			byId("lpscriptSource").rows = 22;
		}else{
		   	byId("analysis").style.height = winHeight - 170; 
			byId("condition").style.height = winHeight - 200;
			byId("objfunc").style.height = winHeight - 200; 
			byId("LPScript").style.height = winHeight - 200;
			byId("conditionListDiv").style.height = 560;
			byId("lpscriptSource").rows = 25;
		}
		if(userid == 'guest')
		{
			byId("newConstraintBtn").disabled = true;
			byId("newObjectBtn").disabled = true;
		}		
    }
    /*function of show compare pane*/
    function showComparePane()
    {
    	byId("AnalysisPane").style.visibility = "visible";
  		byId('AnalysisPane').style.display = 'inline';
  		byId("compareControl").style.visibility = "visible";
  		byId('compareControl').style.display = 'inline';

		if(winHeight <= 768)
    	{
		   	byId("compare").style.height = 590; 
			byId("compareResult").style.height = 560;
			byId("compareListDiv").style.height =560;
		}else{
		   	byId("compare").style.height = winHeight - 170; 
			byId("compareResult").style.height = winHeight - 200;
			byId("compareListDiv").style.height = 560;
		}		
    }
    /*function of hide analysis pane*/
    function hideAnalysisPane()
    {
    	removelAllArray(tempResultData);
    	byId("AnalysisPane").style.visibility = "hidden";
  		byId('AnalysisPane').style.display = 'none';
  		byId("analysisControl").style.visibility = "hidden";
  		byId('analysisControl').style.display = 'none';
    }
    /*function of show modeling pane*/
    function showModelingPane()
    {		
    	byId("ModelingPane2").style.visibility = "visible";
  		byId("ModelingPane2").style.display = 'inline';
  		byId("modelingControl2").style.visibility = "visible";
    	byId("modelingControl2").style.display = 'inline';
    	if(winHeight <= 768)
    	{
		   	//byId("modelingReactionList").style.height = 590; 
			//byId("newreactionDiv").style.height = 200;
		}else{
		   	//byId("modelingReactionList").style.height = winHeight - 170; 
			//byId("newreactionDiv").style.height = winHeight - 780;
		}
    }
    /*function of hide modeling pane*/
    function hideModelingPane()
    {
    	byId("ModelingPane2").style.visibility = "hidden";
  		byId("ModelingPane2").style.display = 'none';
  		byId("modelingControl2").style.visibility = "hidden";
  		byId("modelingControl2").style.display = 'none';
    }
    /*function of show comparing pane*/
    function showComparingPane()
    {		
    	byId("ComparingPane").style.visibility = "visible";
  		byId('ComparingPane').style.display = 'inline';
  		byId("compareControl").style.visibility = "visible";
  		byId('compareControl').style.display = 'inline';
    }
    /*function of hide compare pane*/
    function hideComparingPane()
    {
    	byId("ComparingPane").style.visibility = "hidden";
  		byId('ComparingPane').style.display = 'none';
  		byId("compareControl").style.visibility = "hidden";
  		byId('compareControl').style.display = 'none';
    }
    /*function of show main pane*/
    function showMain()
    {    	
    	hidePathwayPane();
    	hideAnalysisPane();
		hideModelingPane();
		hideComparingPane();
		byId("MainPagePane").style.visibility = "visible";
  		byId('MainPagePane').style.display = 'inline';
    }
    /*function of hide main pane*/
    function hideMain()
    {
		byId("MainPagePane").style.visibility = "hidden";    
  		byId('MainPagePane').style.display = 'none';
    }
    /*Get pathway information of given pathway(message) and category*/
    function getPathwayInformation(message, category, gubun)
    {	
       
       // getProject();
          	if(message == "") return;
    	showPathway();

    	deleteRowFromTable(byId("reactionTableBody"));
  		var newRow = document.createElement("tr");
  		var newCell = document.createElement("td");
  		newCell.innerHTML = "Loading....<img src='images/indicator.gif'>";
  		newRow.appendChild(newCell);
  		byId("reactionTableBody").appendChild(newRow);
  
  		deleteRowFromTable(byId("metaboliteTableBody"));
  		var newRow = document.createElement("tr");
  		var newCell = document.createElement("td");
  		newCell.innerHTML = "Loading....<img src='images/indicator.gif'>";
  		newRow.appendChild(newCell);
  		byId("metaboliteTableBody").appendChild(newRow);
  		
    	modelingGubun = 0;
    	byId("pathwayName").innerHTML = "&nbsp;&nbsp;<font size=3 color=blue><b>Pathway: "+category+"> "+message+"</b></font>";
    	if(previousPathwayName != '' && previousPathwayName != 'all' && previousCategory != 'User Defined')
    	{
    	   
    		var tempName = previousPathwayName.replace("metabolism", "");
    		tempName = tempName.replace("Metabolism", "");
   			byId(previousPathwayName).innerHTML = "&nbsp;<a href=\"javascript:getPathwayInformation('"+previousPathwayName+"','"+previousCategory+"')\">"+tempName+"</a>";    		
    		byId(previousPathwayName).style.backgroundColor = '#ffffff'; 
    	}else if(previousPathwayName != '' && previousPathwayName != 'all')
    	{
   
    		var tempName = previousPathwayName.replace("metabolism", "");
    		tempName = tempName.replace("Metabolism", "");
   			byId(previousPathwayName).innerHTML = "&nbsp;<a href=\"javascript:getPathwayInformationOfUser('"+previousPathwayName+"','"+previousCategory+"')\">"+tempName+"</a>";    		
    		byId(previousPathwayName).style.backgroundColor = '#ffffff'; 
    	
    	}
    	if(message != 'all'){
    	
    		var tempName = message.replace("metabolism", "");
    		tempName = tempName.replace("Metabolism", "");
	    	byId(message).innerHTML = "&nbsp;<b><a href=\"javascript:getPathwayInformation('"+message+"')\">"+tempName+"</a></b>";	
	    	byId(message).style.backgroundColor = '#FAFAAA';
   		}
   	
   		selectedPathwayName = message;
   		selectedCategory = category;
    	previousPathwayName = message;
    	previousCategory = category;
    	previousGubun = gubun;
    	pathwayName = message;
    	//progressdlg.show();
    	//readyToApplyFluxData();
    	
    	var sendData = "cmd=Condition&pathway="+pathwayName+"&length=0&pid="+projectIdx;
//    	alert(sendData);
    
   		var urlFileAppl = "PathwayServlet";

   		applyFluxData(urlFileAppl, sendData);
    	
    	makeModel('model');
    	
    }
    /*Get pathway information of given user defiend pathway(message) and category*/
    function getPathwayInformationOfUser(message, category, gubun)
    {	
     
    	if(message == "") return;
    	showPathway();
    	modelingGubun = 0;
    	showPathwayInfo(message);

    	byId("pathwayName").innerHTML = "&nbsp;&nbsp;<font size=3 color=blue><b>Pathway: "+category+"> "+message+"</b></font>";
    	if(previousPathwayName != '' && previousPathwayName != 'all' && previousCategory == 'User Defined')
    	{
   			byId(previousPathwayName).innerHTML = "&nbsp;<a href=\"javascript:getPathwayInformation('"+previousPathwayName+"','"+previousCategory+"')\">"+previousPathwayName+"</a>";    		
    		byId(previousPathwayName).style.backgroundColor = '#ffffff'; 
    	}else if(previousPathwayName != '' && previousPathwayName != 'all'){
   			byId(previousPathwayName).innerHTML = "&nbsp;<a href=\"javascript:getPathwayInformationOfUser('"+previousPathwayName+"','"+previousCategory+"')\">"+previousPathwayName+"</a>";
    		byId(previousPathwayName).style.backgroundColor = '#ffffff'; 
    	
    	}
    	if(message != 'all'){
	    	byId(message).innerHTML = "&nbsp;<b><a href=\"javascript:getPathwayInformationOfUser('"+message+"','"+category+"')\">"+message+"</a></b>";	
	    	byId(message).style.backgroundColor = '#FAFAAA';
   		}
    	previousPathwayName = message;
    	previousCategory = category;
    	previousGubun = gubun;
    	pathwayName = message;
    	//progressdlg.show();
    	//readyToApplyFluxData();
    	var sendData = "cmd=Condition&pathway="+pathwayName+"&length=0&pid="+projectIdx;
   		var urlFileAppl = "PathwayServlet";
   		applyFluxData(urlFileAppl, sendData);
    		
    	makeModel('model');
    }
    
    function readyToApplyFluxData()
    {
        
	    if(pathwayName == "") return;
	    
   			var sendData = "cmd=Condition&pathway="+pathwayName
   			var fluxCnt = 0;
   			if(isShowResult)
   			{
   				fluxCnt = 1;
   				sendData = sendData + "&condition0=tmp/"+solveResultFile;
   			}else{
	   			for(var i=0; i<conditionData.length; i++)
	   			{
	   				if(!byId("fluxCombo"+i).checked) continue;   				
	   				sendData = sendData + "&condition"+fluxCnt+"="+conditionData[i];
	   				fluxCnt++;
	   			}
   			}
   			sendData = sendData +"&length="+fluxCnt;
 		  	var urlFileAppl = "PathwayServlet";
   			applyFluxData(urlFileAppl, sendData);
    }
    
    function applyFluxData(urlFileAppl, sendData)
    {
      
    	//informationdlg.hide();
    	var getPost = "POST";                     
    	var trueFalse = isTrueOrFalse;                      
		
    	var xmlHttp = newXMLHttpRequest();            
   		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                 
	            if (xmlHttp.status == 200) {  
	            	showReactionList(xmlHttp);
	            } else {
	                exceptionControl(xmlHttp);           
	                alertMessage("Code: 1013");
	            }
	            //progressdlg.hide();
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
    }
    
    function showReactionList(xmlHttp)
    {
    	
    	var xmlHttpData = xmlHttp.responseText;
       // alert(xmlHttpData);
		var setSplit = xmlHttpData.split("<S>");
		var rowSplit = setSplit[0].split("<N>"); //Make a array of reaction list with flux		
        
		var mowSplit = setSplit[1].split("<N>"); //Make a array of metaobolite list with fluxsum

		///////////////////////////////////
		/* Start of Print reaction list*/
		///////////////////////////////////		
		makeTableDataWith("reaction", rowSplit, 0);		
		/* End of Print reaction list*/

	
		///////////////////////////////////
		/* Start of Print Metabolite list*/
		///////////////////////////////////
		
		makeTableDataWith("metabolite", mowSplit, 0);
		/* End of Print Metabolite list*/
		
		//byId("lhtab1").style.hieght = 100 + 20*rowSplit.length;
		//progressdlg.hide();
    }
    
    function makeTableDataWith(tablename, rowSplit, isMapping)
    {
      
    	var TableHead = byId(tablename+"TableHead");
		var TableBody = byId(tablename+"TableBody");
     
		for(var i=TableHead.rows[0].cells.length-1; i>1; i--)
			TableHead.rows[0].deleteCell(i);
		
		//var colCnt = 0;
		if(tablename == 'reaction')
		{
			if(byId('showReactionName').checked)
			{
				var newth = document.createElement("th");
				newth.innerHTML = 'Enzyme name';
				newth.width = "120px";
				TableHead.rows[0].appendChild(newth);
			}
			if(byId('showReactionEC').checked)
			{
				var newth = document.createElement("th");
				newth.innerHTML = 'EC-Number';
				newth.width = "100px";
				TableHead.rows[0].appendChild(newth);
			}
			if(byId('showReactionGene').checked)
			{
				var newth = document.createElement("th");
				newth.innerHTML = 'ORF/Gene Name';
				newth.width = "100px";
				TableHead.rows[0].appendChild(newth);
			}
		}
		if(tablename == 'metabolite')
		{
		  
			//if(byId('showCompoundName').checked)
			//{
				//var newth = document.createElement("th");
				//newth.innerHTML = 'Compound Name';
				//newth.width = "120px";
				//TableHead.rows[0].appendChild(newth);
			//}
			//if(byId('showCompoundName').checked)
			//{
				var newth = document.createElement("th");
				newth.innerHTML = 'Compound name';
				newth.width = "120px";
				TableHead.rows[0].appendChild(newth);
			//}
			//if(byId('showCompoundCharge').checked)
			//{
				//var newth = document.createElement("th");
				//newth.innerHTML = 'Formula';
				//newth.width = "100px";
				//TableHead.rows[0].appendChild(newth);
			//}
		}
		if(isMapping != 0){ //Print only pathway information eception flux data
			if(isShowResult)
			{
				var newth = document.createElement("th");
				newth.innerHTML = "Analysis Result";
				TableHead.rows[0].appendChild(newth);
			}else{
				for(var i=0; i<conditionData.length; i++)
				{
					if(!byId("fluxCombo"+i).checked) continue;
					var newth = document.createElement("th");
					newth.innerHTML = conditions[i];
					//newth.innerHTML = newth.innerHTML+ " <a href='#' onClick='javascript:makeModel(\""+i+"\");'>[V]</a></div>";
					TableHead.rows[0].appendChild(newth);
					//colCnt++;
				}
			}
		}
		//byId("lhtab1").style.width = 500 + 60*colCnt;
		for(var i=TableBody.rows.length-1; i>=0; i--)
			TableBody.deleteRow(i);
		
		if(tablename == "reaction") reactionList = rowSplit;
	
		for(var i=0; i<rowSplit.length-1; i++)
		{
			var colSplit = rowSplit[i].split("<T>");
			var fluxList = [];
			var newRow = makeNewRowWith(colSplit, i, tablename);
			newRow.id = tablename+"tr"+i;
			//newRow.setAttribute("onClick",new Function("showDetailInformation("+tablename+"tr"+i+")"));  
			TableBody.appendChild(newRow);
			if(tablename == 'metabolite')
			{ 
			     
				var nRow = document.createElement("tr");
				var nCol = document.createElement("td");
				nCol.colSpan = conditionData.length+2;
				nCol.id = tablename+"td"+i;
				//nCol.align ="right";
				nRow.appendChild(nCol);
				TableBody.appendChild(nRow);
			}
		}
    }
    
    function makeNewRowWith(colSplit, i, tablename)
    {
    
    	var newRow = document.createElement("tr");
		newRow.height = "20";
		newRow.style.backgroundColor = "#F8FFFF";
		var colLen = 2;
		
		if(tablename == 'reaction')
		{
			colLen = colSplit.length - 4;
		}
		if(tablename == 'metabolite')
		{
		 
			colLen = colSplit.length - 3;
		}
		var knockOut = "";
		var isKnockout = isExistKnockout(colSplit[0]);
	
		if((isKnockout)&&(byId('projectlist').value>0)) 
		{
		knockOut = "<font color='#cccccc'>";
		}
		for(var k=0; k<colLen-1; k++)
		{
	
			var newCol = document.createElement("td");

			if(k > 1)	newCol.style.width = "60px";
			if(k == 0)	newCol.style.width = "110px";
			if(k == 1)	newCol.style.width = "280px";
			newCol.style.borderBottomWidth = "1";
			newCol.style.borderBottomColor = "#eee";
			newCol.style.borderBottomStyle = "solid";

			newCol.style.borderRightWidth = "1";
			newCol.style.borderRightColor = "#eee";
			newCol.style.borderRightStyle = "solid";

			newCol.innerHTML = "";
			if(k < 2)
			{
				if((i % 2) == 0) newCol.bgColor = "#FFFFFF";
				if((i % 2) == 1) newCol.bgColor = "#eeeeee";
				if(i == -1) newCol.bgColor = "#FFFACD";
			}
			if(k == 0 && (tablename == 'reaction' || tablename == 'metabolite')) newCol.innerHTML = "&nbsp;"+ (i+1) + ". ";
			if(k == 0 && (tablename == 'reaction' || tablename == 'metabolite'))
			//if(k == 0 && tablename == 'reaction')
			 	//newCol.innerHTML = newCol.innerHTML+"<input dojoType=Checkbox type=checkbox id='ch"+i+"' value='"+colSplit[k]+"' onclick='changeBackgroud(\""+i+"\", \""+tablename+"\")'>";
			 	newCol.innerHTML = newCol.innerHTML;
			if(k >= 2)
			{
				var flux = colSplit[k];	
							
				if(flux > 0)
				{
					var bgco = "00";
					if(flux*1 > maxvalue*1)
					{ 
						flux = maxvalue;
					}else{
						bgco = makeHex(255 - flux * 255/maxvalue);
					}
					newCol.bgColor = "#FF"+bgco+bgco;
					if(flux/maxvalue > 0.7)
						newCol.innerHTML = newCol.innerHTML + "<font color=white>"+colSplit[k].substring(0,7)+"</font>";
					else
						newCol.innerHTML = newCol.innerHTML + colSplit[k].substring(0,7);
				}
				if(flux < 0)
				{
					var bgco = "00";
					if(flux*1 < minvalue*1)
					{
					 flux = minvalue;
					}else{
					 bgco = makeHex(255 - (flux * 255/minvalue));
					}
					newCol.bgColor = "#"+bgco+bgco+"FF";
					if(flux/minvalue > 0.7)
						newCol.innerHTML = newCol.innerHTML + "<font color=white>"+colSplit[k].substring(0,7)+"</font>";
					else
						newCol.innerHTML = newCol.innerHTML + colSplit[k].substring(0,7);
				}
				if(flux == 0)
				{
					newCol.bgColor = "#FFFFFF";
					newCol.innerHTML = newCol.innerHTML + colSplit[k];				
				}
			}else{
				newCol.innerHTML = knockOut + newCol.innerHTML + colSplit[k];
				if((k==1) && (tablename == 'metabolite'))
				{
				   
					//newCol.innerHTML = "<div id='"+tablename+"div"+i+"' style='cursor:hand;' onClick='showDetailInformation(\""+i+"\", \""+tablename+"\", \""+colSplit[k]+"\", \""+colSplit[0]+"\");'>"+colSplit[k]+ "</div>";	
					var formula = colSplit[k];	
					var newformula = getReactionsFromFormula(formula);
					newCol.innerHTML = colSplit[k];	
					newCol.innerHTML = newformula;
				}
				if(k ==0 && tablename == 'reaction')
				{
				 
					var checkString = "";
					if(projectIdx <= 0){
						checkString = "<input type=checkbox disabled id='candidateChk"+i+"' onClick='addOrDelknockout(\""+i+"\",\""+colSplit[k]+"\", \"G\");'>";
					}else{
						if(isKnockout)
							checkString = "<input type=checkbox checked id='candidateChk"+i+"' onClick='addOrDelknockout(\""+i+"\",\""+colSplit[k]+"\", \"G\");'><font color='#cccccc'>";
						else checkString = "<input type=checkbox id='candidateChk"+i+"' onClick='addOrDelknockout(\""+i+"\",\""+colSplit[k]+"\", \"G\");'>";
					}
					if(colSplit[colLen+2] != '0')
						newCol.innerHTML = checkString + "&nbsp;"+ (i+1) + ". " + colSplit[k]+"<font color=red>*</font>";
					else
						newCol.innerHTML = checkString + "&nbsp;"+ (i+1) + ". " + colSplit[k];
				}
			} 					
			newRow.appendChild(newCol);
			
			if(k==1){ // Add columns for additional information
				
				if(tablename == 'reaction')
				{
				     
					if(byId('showReactionName').checked)
					{
						var nCol = document.createElement("td");
						nCol.innerHTML = knockOut + colSplit[colLen-1];
						nCol.width = "120px";
						if((i % 2) == 0) nCol.bgColor = "#FFFFFF";
						if((i % 2) == 1) nCol.bgColor = "#eeeeee";
						newRow.appendChild(nCol);
					}
					if(byId('showReactionEC').checked)
					{
						var nCol = document.createElement("td");
						if(colSplit[colLen]!="null")
						{
						nCol.innerHTML =knockOut +"<a href=\'http://www.genome.jp/dbget-bin/www_bfind_sub?dbkey=enzyme&keywords=+EC+"+colSplit[colLen]+"&mode=bget' target='_blank'>" + colSplit[colLen]+"</a>";
						}
						else
						{
						nCol.innerHTML ="N.A";
						}
						nCol.width = "100px";
						if((i % 2) == 0) nCol.bgColor = "#FFFFFF";
						if((i % 2) == 1) nCol.bgColor = "#eeeeee";
						newRow.appendChild(nCol);
					}
					if(byId('showReactionGene').checked)
					{
						var nCol = document.createElement("td");
						if((colSplit[colLen+1].length<=5)&&(colSplit[colLen+1]!=""))
						{
						  
						   var inf=colSplit[colLen+1];
						  inf="<a href=\'http://www.genome.jp/dbget-bin/www_bget?eco:"+inf+"' target='_blank'>"+inf+"</a>";
						  
						   nCol.innerHTML=inf;
						}
						
						
						if((colSplit[colLen+1]!="null")&&(colSplit[colLen+1].length>5))
						{
						   var jass=colSplit[colLen+1].split("(");
						   if(jass[0]!=null)
						   {
						   jass[0]=jass[0].replace(/^\s+/,"");
				           colSplit[colLen+1]="<a href=\'http://www.genome.jp/dbget-bin/www_bget?eco:"+jass[0]+"' target='_blank'>"+jass[0]+"</a>";
						     var jass1=jass[1].split(")");
						     if(jass1[0]!=null)
						     {
						        colSplit[colLen+1]= colSplit[colLen+1]+"("+jass1[0]+")";
						        if(jass1[1]!=null)
						        {
						        jass1[1]=jass1[1].replace(/^\s+/,"");
						        colSplit[colLen+1]=colSplit[colLen+1]+"<BR>"+"<a href=\'http://www.genome.jp/dbget-bin/www_bget?eco:"+jass1[1]+"' target='_blank'>"+jass1[1]+"</a>";;
						         if(jass[2]!=null)
						         {
						           var jass2=jass[2].split(")");
						            colSplit[colLen+1]= colSplit[colLen+1]+"("+jass2[0]+")";
						            if(jass2[1]!=null)
						            {
						               jass2[1]=jass2[1].replace(/^\s+/,"");
						               colSplit[colLen+1]=colSplit[colLen+1]+"<BR>"+"<a href=\'http://www.genome.jp/dbget-bin/www_bget?eco:"+jass2[1]+"' target='_blank'>"+jass2[1]+"</a>";
						               if(jass[3]!=null)
						               {
						                var jass3=jass[3].split(")");
						                 colSplit[colLen+1]= colSplit[colLen+1]+"("+jass3[0]+")";
						                 if(jass3[1]!=null)
						                 {
						                   jass3[1]=jass3[1].replace(/^\s+/,"");
						                   colSplit[colLen+1]=colSplit[colLen+1]+"<BR>"+"<a href=\'http://www.genome.jp/dbget-bin/www_bget?eco:"+jass3[1]+"' target='_blank'>"+jass3[1]+"</a>";
						                   if(jass[4]!=null)
						                   {
						                     var jass4=jass[4].split(")");
						                     colSplit[colLen+1]= colSplit[colLen+1]+"("+jass4[0]+")";
						                     if(jass4[1]!=null)
						                     {
						                       jass4[1]=jass4[1].replace(/^\s+/,"");
						                       colSplit[colLen+1]=colSplit[colLen+1]+"<BR>"+"<a href=\'http://www.genome.jp/dbget-bin/www_bget?eco:"+jass4[1]+"' target='_blank'>"+jass4[1]+"</a>";
						                       if(jass[5]!=null)
						                       {
						                         var jass5=jass[5].split(")");
						                         colSplit[colLen+1]= colSplit[colLen+1]+"("+jass5[0]+")";
						                           if(jass5[1]!=null)
						                           {
						                             jass5[1]=jass5[1].replace(/^\s+/,"");
						                             colSplit[colLen+1]=colSplit[colLen+1]+"<BR>"+"<a href=\'http://www.genome.jp/dbget-bin/www_bget?eco:"+jass5[1]+"' target='_blank'>"+jass5[1]+"</a>";
						                           }
						                       
						                       }
						                        
						                     
						                     }
						                     
						                   }
						                
						                 }
						               }
						            }
						         }
						        }
						        
						     }
						   }  	 
						   nCol.innerHTML=colSplit[colLen+1];
						}
						
						
						else
						{
						nCol.innerHTML="N.A";
						}
						nCol.width = "100px";
						if((i % 2) == 0)
						{
						 nCol.bgColor = "#FFFFFF";
						}
						if((i % 2) == 1)
						{
						 nCol.bgColor = "#eeeeee";
						}
						newRow.appendChild(nCol);
					}
				}
			 if(tablename == 'metabolite')
				{
	
					//if(byId('showCompoundName').checked)
					//{
						//var nCol = document.createElement("td");
						//nCol.innerHTML = colSplit[colLen-1];
						///nCol.width = "120px";
						//if((i % 2) == 0) nCol.bgColor = "#FFFFFF";
						//if((i % 2) == 1) nCol.bgColor = "#eeeeee";
					//	newRow.appendChild(nCol);
					//}
					//if(byId('showCompoundFormula').checked)
					//{
						var nCol1 = document.createElement("td");
					
						//Make New Link into Compound Formula to know what's pathway contain that reaction
						
						nCol1.innerHTML = colSplit[colLen]
						nCol1.width = "100px";
						if((i % 2) == 0) nCol1.bgColor = "#FFFFFF";
						if((i % 2) == 1) nCol1.bgColor = "#eeeeee";
						newRow.appendChild(nCol1);
					//}
					//if(byId('showCompoundCharge').checked)
					//{
						//var nCol = document.createElement("td");
						//var len = colSplit[colLen+1].length;
						//if(len > 3)
							//nCol.innerHTML = colSplit[colLen+1].substring(0, len-3);
						//else
							//nCol.innerHTML = colSplit[colLen+1];
						//nCol.width = "100px";
						//if((i % 2) == 0) nCol.bgColor = "#FFFFFF";
						//if((i % 2) == 1) nCol.bgColor = "#eeeeee";
						//newRow.appendChild(nCol);
					//}
				}
			}
		}
		return newRow;
    }
    
    function getPathwayInfoOfReaction(rid,event)
    {
     
    	var x = 0;
		var y = 0;
		if ( isIE == false )
        {
       
           
           x = event.clientX;
           y = event.clientY;
       
        }
        else
        {
          	x = window.event.clientX;
          	y = window.event.clientY;
        }   					
    	
    	var sendData = "cmd=getPathwayInfoOfReaction&name="+rid.substring(1);
    	var getPost = "POST";                      
    	var urlFileAppl = "PathwayServlet";
    	var trueFalse = isTrueOrFalse;                       

    	var xmlHttp = newXMLHttpRequest();            
   		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                 
	            if (xmlHttp.status == 200) {               
	            	var result = xmlHttp.responseText;
	            	showPathwayInfoOfReaction(result, x, y);
	            } else {
	                exceptionControl(xmlHttp);           
	                alertMessage("Code: 1010");
	                
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
    }
    
    function showPathwayInfoOfReaction(result, x, y)
    {
       	if(result != 'failed'){
     		byId("pathwayInfoOfReaction").innerHTML = result;
		}else{
			byId("pathwayInfoOfReaction").innerHTML = "No Information";
		}
        byId("pathwayInfoOfReaction").style.top = y-20;
    	byId("pathwayInfoOfReaction").style.left = x+15;
    	byId("pathwayInfoOfReaction").style.visibility = 'visible';
    	byId("pathwayInfoOfReaction").style.display = 'inline';
    }
    
    function hidePathwayInfoOfReaction()    
    {
    	byId("pathwayInfoOfReaction").style.visibility = 'hidden';
    	byId("pathwayInfoOfReaction").style.display = 'none';
    }
    
    function getReactionsFromFormula(formula)
    {
        
    	var newformula = "";
    	var rs = formula.split("<R>");
    	for(var i=0; i<rs.length; i++)
    	{
    		//newformula = newformula+"<div onmouseover='getPathwayInfoOfReaction(\""+rs[i]+"\");' onmounseout'hidePathwayInfoOfReaction();'>"+rs[i]+"</div>";
    		newformula = newformula+"<a href='javascript:void(0);' onclick='getPathwayInfoOfReaction(\""+rs[i]+"\",\"event\");' onmouseout='hidePathwayInfoOfReaction();' >"+rs[i]+"</a>";
    	}
    	return newformula;
    }
    
    function makeHex(flux)
    {
    	var bg2 = flux % 16;
    	var bg1 = 0;
    	if(flux > 15)
    		bg1 = (flux - bg2) / 16;
    	else 
    		bg1 = 0;
    	var sbg = ""+bg2;
    	bg2 = sbg.substring(0, sbg.indexOf("."));
    	if(bg1 >= 10) bg1 = makeHexChar(bg1);
    	if(bg2 >= 10) bg2 = makeHexChar(bg2);
    	//alert(""+bg1+""+bg2+"");
    	return ""+bg1+""+bg2+"";
    }
    
    function makeHexChar(val)
    {
    	if(val == 10) return 'a';
    	if(val == 11) return 'b';
    	if(val == 12) return 'c';
    	if(val == 13) return 'd';
    	if(val == 14) return 'e';
    	if(val == 15) return 'f';
    }
    
    function showDetailInformation(id, tablename, reactions, mname)
    {
    	if(byId(tablename+"td"+id).innerHTML == "")
    	{
    		//byId(tablename+"td"+id).innerHTML = "Test";
    		var nTable = makeTableForDetailInformation(reactions, id, mname);
    		byId(tablename+"td"+id).appendChild(nTable);
    	}
    	else
    		byId(tablename+"td"+id).innerHTML = "";
    }
    
    function makeTableForDetailInformation(reactions, id, mname)
    {
    	var rlist = reactions.split("<R>");
   		var nTable = document.createElement("table");
   		var rBody = document.createElement("tbody");
    	for(var k=0; k<rlist.length; k++)
    	{
    		//alert(rlist[k].substring(1, rlist[k].length));
    		var reactionData = findReactionDataSet(rlist[k].substring(2, rlist[k].length));
    		var colSplit = reactionData.split("<T>");
    		var regexp = new RegExp(mname,'g');
    		colSplit[1] = colSplit[1].replace(regexp, "<font color='#8B008B'>"+mname+"</font>");
    		var newRow = makeNewRowWith(colSplit, -1, "reaction_metabolite")
    		rBody.appendChild(newRow);
    	}
    	nTable.width = "100%";
    	nTable.appendChild(rBody);
		return nTable;    	
    }
    
    function findReactionDataSet(reactionId)
    {
    	if(reactionId.indexOf("(")>= 0)
    	{
    		reactionId = reactionId.substring(reactionId.indexOf(")")+1, reactionId.length);
    	}
    	for(var i=0; i<reactionList.length; i++)
    	{
    		if(reactionList[i].indexOf(reactionId) >=0)
    		{
    			//alert(reactionList[i]);
    			return reactionList[i];
    		}
    	}
    }

	function changeBackgroud(trid, tablename)
	{
		var chk = byId("ch"+trid);
		if(chk.checked == true)
		{
			var trh = byId(tablename+"tr"+trid);
			//trh.style.backgroundColor = '#FAFAD2';	
			trh.cells[0].style.backgroundColor = '#FAFAD2';	
			trh.cells[1].style.backgroundColor = '#FAFAD2';				
		}else{
			var trh = byId(tablename+"tr"+trid);
			//trh.style.backgroundColor = '#F8FFFF';	
			if((trid % 2) == 0)
			{
				trh.cells[0].style.backgroundColor = '#FFFFFF';	
				trh.cells[1].style.backgroundColor = '#FFFFFF';
			}else{
				trh.cells[0].style.backgroundColor = '#EEEEEE';	
				trh.cells[1].style.backgroundColor = '#EEEEEE';				
			}
		}
	}
	
	
	function changeConditionName()
	{
		if (event.keyCode != 13) return;
		if(selectedFluxIdx < 0) return;
		var newCName = byId("newCName").value;
		for(var i=0; i<conditions.length; i++)
		{
			if(i != selectedFluxIdx && conditions[i] == newCName)
			{
				alert("There is a same name. \n\n Please check it!");
				return;
			}
		}
		changeConditionToDB(conditions[selectedFluxIdx], newCName);
		conditions[selectedFluxIdx] = newCName;
		showFluxList();
		selectFlux(selectedFluxIdx);
		getPathwayInformation(pathwayName);
	}
	
	function changeConditionToDB(beforename, aftername)
	{
		//Start save uploaded data info
		var sendData = "action=changeConditionName";
	  	sendData = sendData + "&pid="+projectIdx;
	   	sendData = sendData + "&gubun=flux";
	   	sendData = sendData + "&oname="+beforename;
	   	sendData = sendData + "&nname="+aftername;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
	
	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
					//alert("completed");
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 1025");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	  	//End of  save uploaded data info
		//}
	}
	
	function deleteCondition(idx)
	{
		var response = confirm('Delete??');
   		if(response) {
   			deleteConditionToDB(conditionIdx[idx], conditionData[idx]);
			conditionIdx.splice(idx, 1);
			conditions.splice(idx,1);
			conditionData.splice(idx,1);
			showFluxList();
			getPathwayInformation(pathwayName);
		}
	}
	
	function deleteConditionToDB(idx, filename)
	{
		//Start save uploaded data info
		var sendData = "action=deleteConditionName";
	  	sendData = sendData + "&pid="+projectIdx;
	   	sendData = sendData + "&userid="+userid;
	   	sendData = sendData + "&gubun=flux";
	   	sendData = sendData + "&filename="+filename;
	   	sendData = sendData + "&idx="+idx;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
		var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
					alert('Deleted');
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 1012");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	  	//End of  save uploaded data info
		//}
	}
  
    function startCallback() {
        // make something useful before submit (onStart)
        if(byId("filename").value == '')
        {
        	alert("No file");
        	return false;
        }
        return true;
    }
    
    function startCallback2() {
        // make something useful before submit (onStart)
        if(byId("filename2").value == '')
        {
        	alert("No file");
        	return false;
        }else{
        	var cname = byId("conditionName").value;
        	if(cname == '' || cname == 'Condition')
        	{
        		cname = "Condition 1";
        		if(conditions.length > 0)
        			cname = "Condition "+(conditions.length+1);
        	}
       		conditions.push(cname);
        	
        	return true;
        }
    }
    
    function startCallback3() {
        // make something useful before submit (onStart)
        if(byId("filename3").value == '')
        {
        	alert("No file");
        	return false;
        }else{
        	var ename = byId("expressionName").value;
        	if(ename == '' || ename == 'Expression')
        	{
        		ename = "Expression 1";
        		if(expressions.length > 0)
        			ename = "Expression "+(expressions.length+1);
        	}
       		expressions.push(ename);
        	
        	return true;
        }
    }
    
    function completeCallback_Model(response) {
        // make something useful after (onComplete)
        //informationdlg.hide();
        byId("modelFileName").innerHTML = "<font size=2><b>"+response+"</b></font>";
        modelFile = response;
    }
    
    function completeCallback_Data(response) {
        // make something useful after (onComplete)
        //informationdlg.hide();
        hidefluxUploadForm();
        var filename = response;
        conditionData.push(filename);
        saveUploadDataInfo("flux", conditions[conditions.length-1], filename);
        showFluxList();
        readyToApplyFluxData();
    }
    
    function saveUploadDataInfo(gubun, name, filename)
    {
    	//Start Login
		var sendData = "action=saveData";
	  	sendData = sendData + "&pid="+projectIdx;
	   	sendData = sendData + "&gubun="+gubun;
	   	sendData = sendData + "&name="+name;
	   	sendData = sendData + "&filename="+filename;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
	
	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	return;
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 1013");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	  	//End of Login
    }

    function hideInformationPane()
    {
                byId("systeminfopane").style.visibility = "hidden";
                byId("systeminfopane").style.display = "none";
                byId("summaryPane").style.visibility = "hidden";
                byId("summaryPane").style.display = "none";
                byId("peopleinfopane").style.visibility = "hidden";
                byId("peopleinfopane").style.display = "none";
                byId("contactpane").style.visibility = "hidden";
                byId("contactpane").style.display = "none";
		byId("resourcepane").style.visibility="hidden";
		byId("resourcepane").style.display = "none";
    }
    
    function showInformation(id)
    {
    	// 1=SystemInfor 2=searchForm 3= 4=tutorial1 5=loginForm 6=importSBMLForm 7=importFluxForm
    	if(id == 0)
    	{
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/notice.html');
    		//showMain();
    		
    		window.open(localhost+"docs/notice.html","Notice","width=1024 height=768 scrollbars")
    	}
    	if(id == 1)
    	{
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/systeminfo.html');
    		hideInformationPane();
    		byId("systeminfopane").style.visibility = "visible";
   		byId("systeminfopane").style.display = "inline";

   			showMain();
   			
   	//		window.open(localhost+"docs/systeminfo.html","Notice","width=1024 height=768 scrollbars")
    	}
    	if(id == 2)
    	{
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/searchForm.html');
    		//byId('MainPagePane').innerHTML = "";
    		//showMain();
    		
    		window.open(localhost+"docs/searchForm.html","Notice","width=1024 height=768 scrollbars")
    	}
    	if(id == 4)
    	{
    		//window.open(localhost+"docs/userguide.html","Manual","width=1024 height=768 scrollbars")
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/userguide.html');
    		//showMain();
		hideInformationPane();
		 byId("resourcepane").style.visibility = "visible";
                byId("resourcepane").style.display = "inline";
               showMain();
                changeManMenu(1);
    	}
    	if(id == 5)
    	{
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/login.html');
    		//showMain();
    		
    		window.open(localhost+"docs/login.html","Notice","width=1024 height=768 scrollbars")
    	}
    	if(id == 6)
    	{
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/importSBMLForm.html');
    		//showMain();
    		
    		window.open(localhost+"docs/importSBMLForm.html","Notice","width=1024 height=768 scrollbars")
    	}
    	if(id == 7)
    	{
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/importSBMLForm.html');
    		//showMain();
    		
    		window.open(localhost+"docs/importSBMLForm.html","Notice","width=1024 height=768 scrollbars")

    		//conditionCnt = 0;
    	}
    	if(id == 9)
    	{
    		//conditionCnt = 0;
			//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/people.html');
    		//showMain();    		
    		 hideInformationPane();
		byId("peopleinfopane").style.visibility = "visible";	
                byId("peopleinfopane").style.display = "inline";

                showMain();	
    		//window.open(localhost+"docs/people.html","Notice","width=1024 height=768 scrollbars")
    	}
    	if(id == 10)
    	{
    		//conditionCnt = 0;
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/contact.htm');
    		//showMain(); 
                 hideInformationPane();
		byId("contactpane").style.visibility = "visible";
                byId("contactpane").style.display = "inline";
          showMain();
    		//window.open(localhost+"docs/contact.htm","Notice","width=1024 height=768 scrollbars")
    	}
    	if(id == 11)
    	{
    		//conditionCnt = 0;
    		//var docPane = dojo.widget.getWidgetById("MainPagePane");
    		//docPane.setUrl('docs/tutorial.htm');
    		//showMain(); 
    		
    		window.open(localhost+"docs/tutorial.zip","Notice","width=1024 height=768 scrollbars")
    	}
    }


function showORhidePane(paneName)
{
   
	if(byId(paneName).style.display == 'none' && projectIdx == -1)
	{
		alert("Select a Strain");
		return;
	}
	if((paneName == 'analysisDataList' || paneName == 'PrivateLibraryList') && byId("projectlist").value < 0)
	{
	
		if(byId(paneName).style.display == 'inline')
		{
			byId(paneName).style.display = 'none'; 
			byId(paneName).style.visibility = 'hidden';
			byId(paneName+"T").src = "images/right.gif";
			return;	
		}else{
			alert("Select a Strain!!");
			return;
		}		
	}
	if(paneName == 'PrivateLibraryList' && byId("projectlist").value == 0)
	{
	
		if(byId(paneName).style.display == 'inline'){
			byId(paneName).style.display = 'none'; 
			byId(paneName).style.visibility = 'hidden';
			byId(paneName+"T").src = "images/right.gif";
			return;	
		}else{
			alert("You can't use this menu in Wild Type!!");
			return;
		}
	}
	if(byId(paneName).style.display == 'none')
	{
	
		if(projectIdx == -1) return;
		byId(paneName+"T").src = "images/down.gif";
		byId(paneName).style.display = 'inline';
		byId(paneName).style.visibility = 'visible';
	}else if(byId(paneName).style.display == 'inline')
	{
	
		byId(paneName).style.display = 'none'; 
		byId(paneName).style.visibility = 'hidden';
		byId(paneName+"T").src = "images/right.gif";
	}
}

function showOHideCompartive(paneName)
{	
   
	if( byId("projectlist").value == -1)
	{
		if(byId(paneName).style.display == 'inline')
		{
			byId(paneName).style.display = 'none'; 
			byId(paneName).style.visibility = 'hidden';
			byId(paneName+"T").src = "images/right.gif";
			return;
		}else
		{
			alert("Select a Strain!!");
			return;
		}
	}
	if(byId(paneName).style.display == 'none')
	{	
		byId(paneName+"T").src = "images/down.gif";
		byId(paneName).style.display = 'inline';
		byId(paneName).style.visibility = 'visible';
	}else if(byId(paneName).style.display == 'inline')
	{
		byId(paneName).style.display = 'none'; 
		byId(paneName).style.visibility = 'hidden';
		byId(paneName+"T").src = "images/right.gif";
	}
	getDataList(projectIdx,userid);
	showComparing();
}
//Implemented By Ganesh
function showOHideCompartive1(paneName)
{	
   

	    var newTable = byId("FluxDataBody");
		deleteRowFromTable(newTable);
		byId(paneName).style.display = 'none'; 
		byId(paneName).style.visibility = 'hidden';
		byId(paneName+"T").src = "images/right.gif";
		//showComparing();
}
function showHideMapping()
{
	if(byId('mappingTotalPane').style.visibility == 'hidden')
	{
		byId('mappingTotalPane').style.display = 'inline';
		byId('mappingTotalPane').style.visibility = 'visible';
	}else
	{
		byId('mappingTotalPane').style.display = 'none';
		byId('mappingTotalPane').style.visibility = 'hidden';
	}
}

function showHideModeling()
{
	if(byId('modelingTotalPane').style.visibility == 'hidden')
	{
		if(projectIdx == 0) {
			alert("You can't make a mutant for Wild Type!\n Please make a new Project!!");
			showProjectMenu();
			return;
		}
		byId('modelingTotalPane').style.display = 'inline';
		byId('modelingTotalPane').style.visibility = 'visible';
	}else
	{
		byId('modelingTotalPane').style.display = 'none';
		byId('modelingTotalPane').style.visibility = 'hidden';
	}
}

function showHideAnalysis()
{
	if(byId('analysisTotalPane').style.visibility == 'hidden')
	{
		byId('analysisTotalPane').style.display = 'inline';
		byId('analysisTotalPane').style.visibility = 'visible';
	}else
	{
		byId('analysisTotalPane').style.display = 'none';
		byId('analysisTotalPane').style.visibility = 'hidden';
	}
}

function showHidePathway()
{
	if(byId('pathwayTotalPane').style.visibility == 'hidden')
	{
		byId('pathwayTotalPane').style.display = 'inline';
		byId('pathwayTotalPane').style.visibility = 'visible';
	}else
	{
		byId('pathwayTotalPane').style.display = 'none';
		byId('pathwayTotalPane').style.visibility = 'hidden';
	}
}

function showAnalysis()
{
	hideMain();
	hidePathwayPane();
	hideModelingPane();
	hideComparingPane()
	showAnalysisPane();
	showAnalysisConstraint();
}

function showComparing()
{
	hideMain();
	hidePathwayPane();
	hideModelingPane();
	hideAnalysisPane();
	showComparingPane();
	showComparetiveAnalysis();
}

function showPathway()
{
	hideMain();
	hideAnalysisPane();
	hideModelingPane();
	hideComparingPane()
	showPathwayPane();
}

function showModeling()
{
	hideMain();
	hideAnalysisPane();
	hidePathwayPane();
	hideComparingPane()
	showModelingPane();
	
	//getMetaboliteList();
	
	showModelingReactionList();
	//getReactionList();
}

function showFieldSelect(divBody)
{

	if(byId(divBody).style.visibility == 'visible'){
		byId(divBody).style.visibility = 'hidden';
		byId(divBody).style.display = 'none';
	}else{
		byId(divBody).style.visibility = 'visible';
		byId(divBody).style.display = 'inline';
		byId(divBody).style.left = event.x-165;
		byId(divBody).style.top = event.y-120;
	}
}

function updateTable(divBody)
{
	byId(divBody).style.visibility = 'hidden';
	byId(divBody).style.display = 'none';
	getPathwayInformation(pathwayName);
}

function newProject()
{
	byId("projectName").value = "";
	byId("strainDescription").value = "";
	
	byId("projectName").disabled = false;
	byId("projectName").style.backgroundColor = "#ffffff";
	byId("projectIdx").value = "";
	byId("projectlist").selectedIndex = 0;
	
	//byId("projectDelBtn").disabled = true;
			
	clearAllofProjectData();
}

function clearAllofProjectData()
{
	deleteRowFromTable(byId("User Defined_pathway"));//pathway
	deleteRowFromTable(byId("analysisBody"));//Condition
	deleteRowFromTable(byId("FluxDataBody"));//pathway
}

	function saveProject()
	{
		var pid = byId("projectIdx").value;
		var projectName = byId("projectName").value;
		var description = byId("strainDescription").value;
		if(projectName == '') return;
		if(description == '') description = projectName;
		
		var sendData = "";
		if(pid == '')
			sendData = sendData+"action=saveproject&userid="+userid;
		else
			sendData = sendData+"action=updateproject&userid="+userid+"&pid="+projectIdx;
		sendData = sendData + "&name="+projectName;
		sendData = sendData + "&description="+description;
	   	//alert(sendData);
	   	
	   	var getPost = "POST";                     
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
	   	var xmlHttp = newXMLHttpRequest();            
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                 
	            if (xmlHttp.status == 200) {               
	            	getProjectList(userid);
			byId("newReactionBtn").disabled = false;
			byId("projectEditBtn").disabled = false;	
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 1016");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	}

	function getProjectList(userid)
	{
		var sendData = "action=getProejctList";
	  	sendData = sendData + "&userid="+userid;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
	
	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	setProjectList(xmlHttp);
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 1017");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	}
	
	function getProjectDescription(pid)
	{
		var sendData = "action=getProejctDescription";
	  	sendData = sendData + "&userid="+userid;
	  	sendData = sendData + "&pid="+pid;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
	
	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	byId("strainDescription").value = xmlHttp.responseText;
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 1018");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	}
	
	
	function setProjectList(xmlHttp)
	{
		var xmlHttpData = xmlHttp.responseText;
		//alert(xmlHttpData);
		var projectList = byId("projectlist");
		for(var i=projectList.options.length; i>=0; i--)
			projectList.remove(i);

		var rowSplit = xmlHttpData.split("<N>");

		if(userid != "guest"){
			var allOption = document.createElement("option");
			//allOption.value = "-1";
			//allOption.innerHTML = "ALL";
			//projectList.appendChild(allOption);
			//projectIdx = -1;
		}
		for(var i=0; i<rowSplit.length-1; i++)
		{
			var colSplit = rowSplit[i].split("<T>");
			var newOption = document.createElement("option");
    		newOption.value = colSplit[0];
    		if(colSplit[1].length > 10) newOption.innerHTML = colSplit[1].substring(0,8)+"..";
		else newOption.innerHTML = colSplit[1];
    		projectList.appendChild(newOption);
		}
		var colSplit = rowSplit[i].split("<T>");
		if(userid != "guest"){
			//var newOption = document.createElement("option");
	   	//	newOption.value = "-2";
	   		//newOption.innerHTML = ">>>NEW<<<<";
	   		//projectList.appendChild(newOption);
   		}
		if(projectIdx > 0)
		{
			byId("projectlist").selectedIndex = getProjectIdx(getProjectName(projectIdx));
		}
		getAnalysisList();
		getDataList(projectIdx,userid);
	}
	
	function openProject(idx)
	{
		byId("projectlist").value = idx;
		getProject();
	}
	
	function getProject()
	{
		projectIdx = byId("projectlist").value;
		if(projectIdx >= 0){
			showModeling();
			showOHideCompartive1('FluxDataList');
		  	getAnalysisList(); // get the list of analysis
		  	//getDataList(projectIdx);
		  	//getKnockoutListForPathway();
		  	//getProjectDescription(projectIdx);
	
			if(projectIdx != 0){
				byId("projectIdx").value = projectIdx;
				byId("projectName").value = getProjectName(projectIdx);
				byId("projectName").disabled = false;
				getPathwayList(projectIdx, "User Defined");
				showProjectMenu('show');
				byId("projectEditBtn").disabled = false;
				
				byId("projectEditBtn").disabled = false;
				byId("newCompoundBtn").disabled = false;
				byId("addReactionSelect").disabled = false;
				byId("newReactionBtn").disabled = false;
				byId("newReactionBtn1").disabled = false;
				byId("newKnockoutBtn").disabled = false;
				byId("newPahtwayName").disabled = false;
				if(modelingGubun > 0)
				{
					getReactionList();
					//getMetaboliteList();
				
					
					selectPathwayForCategory("selecPathway",byId("category").value);
			
				}
			}else{
				if(byId("PrivateLibraryList").style.display == 'inline')
					showORhidePane('PrivateLibraryList');
				
				byId("projectIdx").value = projectIdx;
				byId("projectName").value = "Wild Type";
				byId("projectName").disabled = true;
				showProjectMenu('show');
				byId("projectEditBtn").disabled = true;
				byId("newCompoundBtn").disabled = true;
				byId("addReactionSelect").disabled = true;
				byId("newReactionBtn").disabled = true;
				byId("newReactionBtn1").disabled = true;
				byId("newKnockoutBtn").disabled = true;
				byId("newPahtwayName").disabled = true;
				byId("newKnockoutBtn").disabled = true;
				
				deleteRowFromTable(byId("newcompoundsTableBody"));
				deleteRowFromTable(byId("newreactionsTableBody"));
				deleteRowFromTable(byId("newknockoutTableBody"));
				deleteRowFromTable(byId("User Defined_pathway"));
				//deleteRowFromTable(byId("User Defined_graph"));
				
			}
		}else if(projectIdx == -1)
		{
			
   			//var docPane = dojo.widget.getWidgetById("MainPagePane");
   			//docPane.setUrl('summary.html');
   			//byId("MainPagePane").style.visibility = "hidden";
   			//byId("MainPagePane").style.display = "none";
   			
   			byId("resourcepane").style.visibility = "hidden";
   			byId("resourcepane").style.display = "none";
   			byId("systeminfopane").style.visibility = "hidden";
   			byId("systeminfopane").style.display = "none";
			byId("peopleinfopane").style.visibility = "hidden";
                	byId("peopleinfopane").style.display = "none";
               	 	byId("contactpane").style.visibility = "hidden";
                	byId("contactpane").style.display = "none";
   			byId("summaryPane").style.visibility = "visible";
   			byId("summaryPane").style.display = "inline";

			//Hide Opened Pane
			if(byId("CentralLibraryList").style.display == 'inline') showORhidePane('CentralLibraryList');
			if(byId("AminoLibraryList").style.display == 'inline') showORhidePane('AminoLibraryList');
			if(byId("CarboLibraryList").style.display == 'inline') showORhidePane('CarboLibraryList');
			if(byId("EnergyLibraryList").style.display == 'inline') showORhidePane('EnergyLibraryList');
			if(byId("LipidLibraryList").style.display == 'inline') showORhidePane('LipidLibraryList');
			if(byId("CofactorLibraryList").style.display == 'inline') showORhidePane('CofactorLibraryList');
			if(byId("UnassignedLibraryList").style.display == 'inline') showORhidePane('UnassignedLibraryList');
			
			
			if(byId("analysisDataList").style.display == 'inline') showORhidePane('analysisDataList');
			if(byId("PrivateLibraryList").style.display == 'inline') showORhidePane('PrivateLibraryList');
			if(byId("FluxDataList").style.display == 'inline') showOHideCompartive('FluxDataList');

			
			//hideMain();
			hideAnalysisPane();
			hideModelingPane();
			hideComparingPane()
			showMain();
			
			getAnalysisList(); // get the list of analysis
		  	getDataList(projectIdx,userid);
			openUserSummary();
			
			
		}else if(projectIdx == -2)
		{
			showModeling();
			byId("projectIdx").value = "";
			byId("projectName").value = "";
			byId("projectName").disabled = false;
			showProjectMenu('show');
			byId("projectEditBtn").disabled = true;
			//byId("projectDelBtn").disabled = true;
			byId("newCompoundBtn").disabled = true;
			byId("addReactionSelect").disabled = true;
			byId("newReactionBtn").disabled = true;
			byId("newKnockoutBtn").disabled = true;
			
			deleteRowFromTable(byId("newcompoundsTableBody"));
			deleteRowFromTable(byId("newreactionsTableBody"));
			deleteRowFromTable(byId("newknockoutTableBody"));
			deleteRowFromTable(byId("User Defined_pathway"));
				
			//New project
			newProject();
		}
	}
	//Implemented By Ganesh
	function cStrain()
	{
	        showModeling();
			byId("projectIdx").value = "";
			byId("projectName").value = "";
			byId("projectName").disabled = false;
			showProjectMenu('show');
			byId("projectEditBtn").disabled = true;
			//byId("projectDelBtn").disabled = true;
			byId("newCompoundBtn").disabled = true;
			byId("addReactionSelect").disabled = true;
			byId("newReactionBtn").disabled = true;
			byId("newKnockoutBtn").disabled = true;
			
			deleteRowFromTable(byId("newcompoundsTableBody"));
			deleteRowFromTable(byId("newreactionsTableBody"));
			deleteRowFromTable(byId("newknockoutTableBody"));
			deleteRowFromTable(byId("User Defined_pathway"));
				
			//New project
			newProject();
	
	}
	function getSumm()
	{
	
	
			
   			//var docPane = dojo.widget.getWidgetById("MainPagePane");
   			//docPane.setUrl('summary.html');
   			//byId("MainPagePane").style.visibility = "hidden";
   			//byId("MainPagePane").style.display = "none";
   			
   			byId("resourcepane").style.visibility = "hidden";
   			byId("resourcepane").style.display = "none";
   			byId("systeminfopane").style.visibility = "hidden";
   			byId("systeminfopane").style.display = "none";
			byId("peopleinfopane").style.visibility = "hidden";
                	byId("peopleinfopane").style.display = "none";
               	 	byId("contactpane").style.visibility = "hidden";
                	byId("contactpane").style.display = "none";
   			byId("summaryPane").style.visibility = "visible";
   			byId("summaryPane").style.display = "inline";

			//Hide Opened Pane
			if(byId("CentralLibraryList").style.display == 'inline') showORhidePane('CentralLibraryList');
			if(byId("AminoLibraryList").style.display == 'inline') showORhidePane('AminoLibraryList');
			if(byId("CarboLibraryList").style.display == 'inline') showORhidePane('CarboLibraryList');
			if(byId("EnergyLibraryList").style.display == 'inline') showORhidePane('EnergyLibraryList');
			if(byId("LipidLibraryList").style.display == 'inline') showORhidePane('LipidLibraryList');
			if(byId("CofactorLibraryList").style.display == 'inline') showORhidePane('CofactorLibraryList');
			if(byId("UnassignedLibraryList").style.display == 'inline') showORhidePane('UnassignedLibraryList');
			
			
			if(byId("analysisDataList").style.display == 'inline') showORhidePane('analysisDataList');
			if(byId("PrivateLibraryList").style.display == 'inline') showORhidePane('PrivateLibraryList');
			if(byId("FluxDataList").style.display == 'inline') showOHideCompartive('FluxDataList');

			
			//hideMain();
			byId("projectlist").selectedIndex=0;
			hideAnalysisPane();
			hideModelingPane();
			hideComparingPane()
			showMain();
			changeSelectedProject("0");
			getAnalysisList(); // get the list of analysis
		  	getDataList(projectIdx,userid);
			openUserSummary();
			
			
		}
	function rules()
	{
	 var win_ref=window.open('rules.html','welcome3','resizable=1,width=300,height=300,menubar=no,status=no,location=no,toolbar=no,scrollbars=yes');	
	}
	function getProjectName(idx)
	{
		var projectSelect = byId("projectlist");
		for(var i=1; i<projectSelect.options.length; i++)
		{
			if(projectSelect.options[i].value == idx)
				return projectSelect.options[i].innerHTML;
		}
	}
	
	function getProjectIdx(name)
	{
		var projectSelect = byId("projectlist");
		for(var i=1; i<projectSelect.options.length; i++)
		{
			if(projectSelect.options[i].innerHTML == name)
				return i;
		}
	}

	function showProjectMenu(gubun)
	{
		if(gubun == 'show')
		{
			byId("projectEditBtn").onclick = function(){showProjectMenu('hide');};
			byId("projectEditBtn").value = "Close Description";
			byId("projectDiv").style.visibility = 'visible';
			byId("projectDiv").style.display = 'inline';
			byId('projectSaveBtn').disabled = true;
			
		}else{
			byId("projectDiv").style.visibility = 'hidden';
			byId("projectDiv").style.display = 'none';
			byId("projectEditBtn").value = "Open Description";
			byId("projectEditBtn").onclick = function(){showProjectMenu('show');};
		}
	}
	
	function deleteProject(idx)
	{
		var response = confirm('Delete all data in the selected project!!\nContinue?');
   		if(response) {
   			var projectIdx = idx;
			var sendData = "";
			sendData = sendData+"action=deleteproject&userid="+userid+"&pid="+projectIdx;
		   	
		   	var getPost = "POST";                     
		   	var urlFileAppl = "UserServlet";
		   	var trueFalse = isTrueOrFalse;                       
		   	var xmlHttp = newXMLHttpRequest();            
		  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
		    xmlHttp.onreadystatechange = function() {    
		        if (xmlHttp.readyState == 4) {                 
		            if (xmlHttp.status == 200) {               
		            	getProjectList(userid);
			 			getProjectListForSummary();	
		            } else {
		                exceptionControl(xmlHttp);            
		                alertMessage("Code: 1018");
		            }
		        }
		    }
		    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
		    xmlHttp.setRequestHeader("Content-Type", conType);
		    xmlHttp.send(sendData);
		    
		    byId("projectIdx").value = 0;
			byId("projectName").value = "";
			if(byId("projectDiv").style.visibility == 'visible')			
				showProjectMenu();
			//Hide Mutant
			if(modelingGubun != 0)
			{	
				showHideModeling();
			}
			showMain();
   		}
	}
	
	function showPathwayReactions()
	{
		byId("reactionList").style.visibility = "visible";
		byId("metaboliteList").style.visibility = "hidden";
		byId("visualizationList").style.visibility = "hidden";
		
		byId("ListOfReactionMenu").style.backgroundColor = "#C2D8FF";
		byId("ListOfCompoundMenu").style.backgroundColor = "#ffffff";
		byId("ListOfVisualizationMenu").style.backgroundColor = "#ffffff";
	}
	function showPathwayCompounds()
	{
		byId("reactionList").style.visibility = "hidden";
		byId("metaboliteList").style.visibility = "visible";
		byId("visualizationList").style.visibility = "hidden";

		byId("ListOfReactionMenu").style.backgroundColor = "#ffffff";
		byId("ListOfCompoundMenu").style.backgroundColor = "#C2D8FF";
		byId("ListOfVisualizationMenu").style.backgroundColor = "#ffffff";
	}
	function showPathwayVisualization()
	{
		byId("reactionList").style.visibility = "hidden";
		byId("metaboliteList").style.visibility = "hidden";
		byId("visualizationList").style.visibility = "visible";

		byId("ListOfReactionMenu").style.backgroundColor = "#ffffff";
		byId("ListOfCompoundMenu").style.backgroundColor = "#ffffff";
		byId("ListOfVisualizationMenu").style.backgroundColor = "#C2D8FF";
	}
	
	function printProjectListInSummary(xmlHttp)
	{
		var xmlHttpData = xmlHttp.responseText;
		
		//alert(xmlHttpData);
		var strainTable = byId("strainListInSummaryTableBody");
		deleteRowFromTable(strainTable);
		
		var rowSplit = xmlHttpData.split("<N>");
		for(var i=0; i<rowSplit.length-1; i++)
		{
			var newRow = document.createElement("tr");
	  		
	  		var newCell = [];
	  		for(var k=0; k<4; k++)
	  			newCell.push(document.createElement("td"));
	  		var colSplit = rowSplit[i].split("<T>");
            if(colSplit[0]=="0")
            {
	  		newCell[0].innerHTML = "<input type=radio id='selectedStrain' name='selectedStrain' checked='checked' value='"+colSplit[0]+"'  onClick='changeSelectedProject(\""+colSplit[0]+"\");'>";
	  	    }
	  	    else
	  	    {
	  	    newCell[0].innerHTML = "<input type=radio id='selectedStrain' name='selectedStrain'  value='"+colSplit[0]+"'  onClick='changeSelectedProject(\""+colSplit[0]+"\");'>";
	  	    }
	  	    
	  	    newCell[1].innerHTML = colSplit[1];
	  		newCell[2].innerHTML = colSplit[2];
                        if(colSplit[0] != "0")
	  		      newCell[3].innerHTML = "<a href='javascript:openProject(\""+colSplit[0]+"\");'>[Open]</a> <a href='javascript:deleteProject(\""+colSplit[0]+"\");'>[Del]</a>";
	  		else 
			      newCell[3].innerHTML = "<a href='javascript:openProject(\""+colSplit[0]+"\");'>[Open]</a>";
	  		newCell[0].style.width = '40px';
	  		newCell[0].align = 'center';
	  		newCell[1].style.width = '120px';
	  		newCell[2].style.width = '480px';
	  		newCell[3].style.width = '80px';
	  		
	  		newRow.appendChild(newCell[0]);
	  		newRow.appendChild(newCell[1]);
	  		newRow.appendChild(newCell[2]);
	  		newRow.appendChild(newCell[3]);
				
	  		strainTable.appendChild(newRow);
		}
		if(userid == 'guest')
			byId("newStrainBtnInSummary").disabled = true;
	}
	
	function changeSelectedProject(idx)
	{
		projectIdx = idx;
		openSummaryOfStrain(idx);
	}
	
	function openUserSummary()
	{
		getProjectListForSummary();		
		byId("systeminfopane").style.visibility = "hidden";
   		byId("systeminfopane").style.display = "none";
		 byId("peopleinfopane").style.visibility = "hidden";
                byId("peopleinfopane").style.display = "none";
                byId("contactpane").style.visibility = "hidden";
                byId("contactpane").style.display = "none";
   		byId("summaryPane").style.visibility = "visible";
   		byId("summaryPane").style.display = "inline";
	}
	
	function openSummaryOfStrain(pid)
	{
		getProjectDescriptionForSummary(pid);
		//getConditionListForSummary(pid);
	}

	function getConditionListForSummary(pid)
	{
		var sendData = "action=getAnalysisInfo&pid="+projectIdx;
    	var getPost = "POST";                      
    	var urlFileAppl = "AnalysisServlet";
    	var trueFalse = isTrueOrFalse;                      

    	var xmlHttp = newXMLHttpRequest();            
   		xmlHttp.open(getPost, urlFileAppl, trueFalse);
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                 
	            if (xmlHttp.status == 200) {                
	            	byId("conditionInfoOfStrainInSummary").innerHTML = "<H4>Condition Information</H4>"+xmlHttp.responseText;
	            } else {
	                exceptionControl(xmlHttp);          
                	alertMessage("CODE: 5010");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	}
	
	function getProjectListForSummary()
	{
		var sendData = "action=getProejctList";
	  	sendData = sendData + "&userid="+userid;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
	
	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	printProjectListInSummary(xmlHttp);
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 5004");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	}
	
	function getProjectDescriptionForSummary(pid)
	{
		var sendData = "action=getProejctDescription";
	  	sendData = sendData + "&userid="+userid;
	  	sendData = sendData + "&pid="+pid;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
		//alert(sendData);
	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	//byId("strainDescriptionInSummary").innerHTML = "<H4>Summary</H4>"+xmlHttp.responseText;
					byId("strainDescriptionInSummary").innerHTML = "<br><H4>Summary</H4>";
					getProjectSummery(pid);    	
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 5002");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	}
	
	function getProjectSummery(pid)
	{
		var sendData = "action=getProejctSummary";
	  	sendData = sendData + "&userid="+userid;
	  	sendData = sendData + "&pid="+pid;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
		//alert(sendData);
	
	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	byId("strainDescriptionInSummary").innerHTML = byId("strainDescriptionInSummary").innerHTML + xmlHttp.responseText;
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 5003");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	}
	
	function getUserTip(tid)
	{
		if(isUseTip == false) return;
		var x;
		var y;
		if ( isIE == false )
        {
           x = eventValue.pageX;
           y = eventValue.pageY;
           //alert(x+","+y);
        }
        else
        {
           x = event.x;
           y = event.y;
        }
		
		var sendData = "action=getUserTip";
	  	sendData = sendData + "&userid="+userid;
	  	sendData = sendData + "&tid="+tid;
	   	var getPost = "POST";                      
	   	var urlFileAppl = "UserServlet";
	   	var trueFalse = isTrueOrFalse;                       
		//alert(sendData);
	
	   	var xmlHttp = newXMLHttpRequest();           
	  		xmlHttp.open(getPost, urlFileAppl, trueFalse); 
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                
	            if (xmlHttp.status == 200) {               
	            	showUserTip(xmlHttp.responseText, x, y);
	            } else {
	                exceptionControl(xmlHttp);            
	                alertMessage("Code: 6001");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	}
	
	function showUserTip(tipInfo, x, y)
	{
		var tipDlg = byId("userTip");
		var tipLen = tipInfo.length;
		tipDlg.style.height = (tipLen / 50)*20+10;
		
		tipDlg.innerHTML = "<center><table width='90%'><tr><td align=left>"+tipInfo+"</td></tr></table></center>";
		tipDlg.style.left = x+20;
		tipDlg.style.top = y-20;
		tipDlg.style.visibility = "visible";
		tipDlg.style.display = "inline";
	}
	
	function hideUserTip()
	{
		var tipDlg = byId("userTip");
		tipDlg.style.visibility = "hidden";
		tipDlg.style.display = "none";
	}
	
	function useTip()
	{
		if(byId("usetipCheck").checked){
			isUseTip = true;
			byId("helponoff").innerHTML = "Help On";
		}else{
			isUseTip = false;
			byId("helponoff").innerHTML = "Help Off";
		}
			hideUserTip();
	}
	function openUserDefinedPathway()
	{
	
  		var sendData = "";
		sendData = "cmd=pathwayListOfProject";
		sendData = sendData + "&pid="+projectIdx;
		
       
  		var getPost = "POST";                      
    	var urlFileAppl = "PathwayServlet";
    	var trueFalse = isTrueOrFalse;                      
    	var xmlHttp = newXMLHttpRequest();            
   		xmlHttp.open(getPost, urlFileAppl, trueFalse);
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                 
	            if (xmlHttp.status == 200) {
	            	var xmlData = xmlHttp.responseText;
	            	printPathwayListForCategoryToCombo(xmlData, "userDefiendPathway");
	            } else {
	                exceptionControl(xmlHttp);          
                	alertMessage("CODE: 1050");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
  	}
  	
  	function clearNewPathwayForm()
  	{
  		byId("pathwayEditTR").style.visibility = 'visible';
  		byId("pathwayEditTR").style.display = 'inline';
  		byId("previousPathwayName").value = '';
  		byId("newPahtwayName").value = '';
  		byId("modelDescription").value = '';
  		byId("newPathwaySaveBtn").value = "Add";
  		//byId("newPahtwayName").focus();
  	}
  	function showPathwayInfo(message)
    {
    	var name = message;
    	previousName = name;

  		byId("pathwayEditTR").style.visibility = 'visible';
  		byId("pathwayEditTR").style.display = 'inline';
  		byId("previousPathwayName").value = message;
  		byId("newPahtwayName").value = message;
  		byId("modelDescription").value = "";
  		byId("newPathwaySaveBtn").value = "Save";
    }
    
    function hidepathwayEditTR()
    {
  		byId("pathwayEditTR").style.visibility = 'hidden';
  		byId("pathwayEditTR").style.display = 'none';
    }
    
    function cmdPathway(command)
    {
       
    	var previousName = byId("previousPathwayName").value;
    	if(previousName == '' && command == '') command = 'new';
    	else if(command == '') command = 'edit';
    	
    	var name = "";
    	var newName = "";
    	var description = "";
    	var sendData = "";
  		if(command == 'edit'){
    		name = previousName;
    		newName = byId("newPahtwayName").value;
    		previousPathwayName = newName;
    		if(newName == '')
	  		{
	  			alert("The pathway name is empty");
	  			return;
	  		}
	  		description = byId("modelDescription").value;
	  		if(description == '') description = newName;
	  		sendData = "cmd=updatePathway";
	  		//alert("edit: "+name+" -> "+newName+" "+description);
    	}
    	if(command == 'new'){
    		name = byId("newPahtwayName").value;
    		if(name == '')
	  		{
	  			alert("The pathway name is empty");
	  			return;
	  		}
    		description = byId("modelDescription").value;
    		if(description == '') description = name;
    		sendData = "cmd=newPathway";
	  		//alert("new: "+name+" "+description);
    	}
    	
  		sendData = sendData +"&name="+name;
  		sendData = sendData +"&newName="+newName;
  		sendData = sendData + "&pid="+projectIdx;
  		sendData = sendData + "&description="+description;
  		sendData = sendData + "&userid="+userid;
    	var getPost = "POST";                      
    	var urlFileAppl = "ModelingServlet";
    	var trueFalse = isTrueOrFalse;                      
		//alert(sendData);
    	var xmlHttp = newXMLHttpRequest();            
   		xmlHttp.open(getPost, urlFileAppl, trueFalse);
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                 
	            if (xmlHttp.status == 200) { 
	            	if(xmlHttp.responseText == 'success'){
		            	getPathwayList(projectIdx, "User Defined");
	            	}
	            } else {
	                exceptionControl(xmlHttp);          
                	alertMessage("Code: 3008");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	   
    }
    
    function deletePathway()
    {
      getProject();
    	var pname = byId("previousPathwayName").value;
    	var name = "";
    	var newName = "";
    	var description = "";
    	var sendData = "cmd=deletePathway";
  		sendData = sendData +"&name="+pname;
  		sendData = sendData +"&newName="+newName;
  		sendData = sendData + "&pid="+projectIdx;
  		sendData = sendData + "&description="+description;
    	var getPost = "POST";                      
    	var urlFileAppl = "ModelingServlet";
    	var trueFalse = isTrueOrFalse;                      
		//alert(sendData);
    	var xmlHttp = newXMLHttpRequest();            
   		xmlHttp.open(getPost, urlFileAppl, trueFalse);
	    xmlHttp.onreadystatechange = function() {    
	        if (xmlHttp.readyState == 4) {                 
	            if (xmlHttp.status == 200) { 
	            	if(xmlHttp.responseText == 'success'){
		            	getPathwayList(projectIdx, "User Defined");
	            	}
	            } else {
	                exceptionControl(xmlHttp);          
                	alertMessage("Code: 3008");
	            }
	        }
	    }
	    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
	    xmlHttp.setRequestHeader("Content-Type", conType);
	    xmlHttp.send(sendData);
	  
    }
