function setLink(link){
    document.getElementById('myLink').value= link;
	
		var a = document.getElementsByTagName("li")
       for( var i=0; i < a.length; ++i)
	   {
	   a[i].className="current";
	   }
}


    function changeColor(num,colorObj)
    {
		var n=num;
		//alert(n);
		if(num==1){
		document.getElementById(1).style.backgroundColor = colorObj;document.getElementById(4).style.backgroundColor ='';
		document.getElementById(2).style.backgroundColor ='';
		document.getElementById(3).style.backgroundColor ='';}
		else if(num==2){
		document.getElementById(2).style.backgroundColor = colorObj;document.getElementById(4).style.backgroundColor ='';
		document.getElementById(1).style.backgroundColor ='';
		document.getElementById(3).style.backgroundColor ='';}
		else if(num==3){
		document.getElementById(3).style.backgroundColor = colorObj;document.getElementById(4).style.backgroundColor ='';
		document.getElementById(2).style.backgroundColor ='';
		document.getElementById(1).style.backgroundColor ='';}
		else if(num==4){
		document.getElementById(4).style.backgroundColor = colorObj;document.getElementById(3).style.backgroundColor ='';
		document.getElementById(2).style.backgroundColor ='';
		document.getElementById(1).style.backgroundColor ='';}

        //document.getElementById(num.id).style.color = colorObj;
    }


var whichClick; 
window.onload=function() { attachBehaviors(); } 
function attachBehaviors() { 
 var arr = new Array ('submitOne','submitTwo'); 
 for (i=0;i<arr.length;i++) { 
  var but_id=arr[i];  
  if (document.getElementById(but_id)) { 
   document.getElementById(but_id).onclick=function() { whichClick=this.id; } 
  } 
 } 
} 
function converturl(form) { 
 if (document.getElementById('myLink')) { 
  var url = document.getElementById('myLink').value; 
  var url2 = document.getElementById('url').value; 
  
  var keyselection = document.getElementById('search_type');
  var keyvalue = keyselection.options[keyselection.selectedIndex];
  
  if (url=='') { alert('Enter a url.'); return false; } 
  var final_url; 
  if (whichClick=='submitTwo') {  
  final_url =url + 'completed=1&search_type='+keyvalue.value+'&search_key='+url2; 
 
  } 
  else { final_url =url +'completed=1&search_type='+keyvalue.value+'&search_key='+url2; } 
  // Uncomment the window.location, comment out the alert 
  parent.window.location=final_url; 
  //alert(final_url); 
 } 
 else { alert('no url field'); } 
 return false; 
} 

// JavaScript Document