function update_skill_level_2()
    {       
	    id=document.getElementById("skill_industry_1").value;
	    reset_level_3 = 0
	    new Ajax.Updater('skill_level_2', '/enterprise_project/update_skill_level_2/'+id, {asynchronous:true, evalScripts:true});
	    new Ajax.Updater('skill_level_3', '/enterprise_project/update_skill_level_3/'+ reset_level_3, {asynchronous:true, evalScripts:true});
    }    
    function update_skill_level_3()
    {
		id=document.getElementById("skill_industry_2").value;
	    new Ajax.Updater('skill_level_3', '/enterprise_project/update_skill_level_3/'+id, {asynchronous:true, evalScripts:true});
    }	
	function update_subcategories(resource_search)
	{		
		id=document.getElementById("category").value;	
		if(id!='*' && document.getElementById("sub_cat_message"))
		{
			document.getElementById("sub_cat_message").style.display='inline';	
			if(document.getElementById("sub_cat_message").innerHTML=="")
			{
				if(resource_search=='1')
					document.getElementById("sub_cat_message").innerHTML+='Select one or more subject of study:';
				else			
					document.getElementById("sub_cat_message").innerHTML+='Select one or more sub-categories:';				
			}
		}
		else if(document.getElementById("sub_cat_message"))
		{
			document.getElementById("sub_cat_message").style.display='none';	
		}
		
		if(resource_search=='1')
		{
			new Ajax.Updater('sub_categories', '/enterprise_project/update_search_subject_of_studies?id='+id+'&flag_project=0'+'&resource_search='+resource_search, {asynchronous:true, evalScripts:true});
		}
		else
		{
			new Ajax.Updater('sub_categories', '/enterprise_project/update_subcategories?id='+id+'&flag_project=0'+'&resource_search='+resource_search, {asynchronous:true, evalScripts:true});			
		}
	}
		function update_project_services_subcategories(result)
	{		
	 is_classified=0
	 if(result == true)
	 {
	 	is_classified=1
	 }
		id=document.getElementById("category").value;	
		if(id!='*' && document.getElementById("sub_cat_message"))
		{
			document.getElementById("sub_cat_message").style.display='inline';	
			if(document.getElementById("sub_cat_message").innerHTML=="")
			{
					document.getElementById("sub_cat_message").innerHTML+='Select one or more sub-categories:';				
			}
		}
		else if(document.getElementById("sub_cat_message"))
		{
			document.getElementById("sub_cat_message").style.display='none';	
		}
			new Ajax.Updater('sub_categories', '/classified/update_subcategories?id='+id+'&flag_project=0'+'&is_classified='+is_classified, {asynchronous:true, evalScripts:true});			
	}
	function update_institutions(from_search)
	{		
		if(from_search=='1')
		{
			document.getElementById("checked_ins_count").value=0;
		}
		id=document.getElementById("country").value;			
		new Ajax.Updater('institutions', '/enterprise_project/update_institutions?id='+id+'&from_search='+from_search, {asynchronous:true, evalScripts:true});
		
	}
	function update_countries(from_search)
	{		
		
		id=document.getElementById("region").value;		
		if(from_search=='1')
		{
			document.getElementById("checked_ins_count").value=0;
		}			
		new Ajax.Updater('countries', '/enterprise_project/update_countries?id='+id+'&from_search='+from_search, {asynchronous:true, evalScripts:true});
		new Ajax.Updater('institutions', '/enterprise_project/update_institutions?id=*'+'&from_search='+from_search, {asynchronous:true, evalScripts:true});	
	}	
  function update_study_level_2()
  {
		id=document.getElementById("area_of_study_1").value;
	    new Ajax.Updater('red_drop_down_2', '/enterprise_project/update_study_level_2/'+id, {asynchronous:true, evalScripts:true});
   }	
		
	function check_num()
	{	   
		var filter  = /^([0-9]+|([0-9]+\.[0-9]+))$/;
		var budget=document.getElementById('budget_amount').value;		

		if (filter.test(budget) || budget=="") 
		{			
			return true;
			
		}
		else 
	    {
		    $('show_err').innerHTML = "<li>Budget amount should be a number </li>"
			$("err_main").style.display = 'block';
			return false;
		}
	}	
	
	function reset_keywords()
	{		
	 if(document.getElementById("keywords").className[0]!="txtBox")
	 {	
		document.getElementById("keywords").value="";		
		document.getElementById("keywords").className="txtBox";		
	 }		
	}	
	function toggle_search_img(img_id, div_id)
	{
		if($(div_id).style.display == "none" || $(div_id).style.display == "")
		{
			$(div_id).style.display = "block";
			$(img_id).src = "/images/bullet_arrow_down.gif";
		}
		else
		{
			$(div_id).style.display = "none";
			$(img_id).src = "/images/bullet_arrow.gif";
		}
		return false;
	}
	function check_keywords()
	{
		 if(document.getElementById("keywords").className[0]=="g")
		 {	
			document.getElementById("keywords").value="";		
		 }		
	     $('search_form').submit();
	}
	function toggle_industries(industries_count)
	{	
		any=document.getElementById("ind_any");		
		if(any.checked)	
		{		
			for (x=1;x<=industries_count;x++)
       		{               
               document.getElementById('ind_'+x).disabled=true;
               document.getElementById('ind_'+x).checked=false;              
            }	   	   	   
		}
		else
		{
			for (x=1;x<=industries_count;x++)
       		{               
               document.getElementById('ind_'+x).disabled=false;                            
            }   			
		}		
	}	
	function toggle_institutions(institutions_count)
	{	
		any=document.getElementById("ins_any");		
		if(any.checked)	
		{		
			for (x=1;x<=institutions_count;x++)
       		{               
			   document.getElementById('ins_'+x).disabled=true;
               document.getElementById('ins_'+x).checked=false;              
            }	   	   	   
		}
		else
		{
			for (x=1;x<=institutions_count;x++)
       		{               
               document.getElementById('ins_'+x).disabled=false;                            
            }   			
		}		
	}
	function toggle_subcategories(subcat_count)
	{	
		any=document.getElementById("cat_any");		
		if(any.checked)	
		{		
			for (x=1;x<=subcat_count;x++)
       		{               
               document.getElementById('subcat_'+x).disabled=true;
               document.getElementById('subcat_'+x).checked=false;              
            }	   	   	   
		}
		else
		{
			for (x=1;x<=subcat_count;x++)
       		{               
               document.getElementById('subcat_'+x).disabled=false;                            
            }   			
		}		
	}		
	
	function update_checked_institutions_count(ins_id)
	{
		if(document.getElementById(ins_id).checked)
		{
			document.getElementById("checked_ins_count").value++;
		}
		else
		{
			document.getElementById("checked_ins_count").value--;
		}
		
	}
	function check_marked_resources(marked_resources)
	{
		if($('marked_resources').value=='0')
		{			
			$('err_main').style.display="block";
			return false;
		}
		else
		{		
			return true;
		}
	}
	function mark_resource(flag,resource_id)
    {       
	    if(flag==1)
		{
			document.getElementById("marked_resources").value++;
			new Ajax.Updater('mark_resource_'+resource_id, '/project_application/mark_resource_for_invitation?resource_user_id='+resource_id, {asynchronous:true, evalScripts:true}); 
		}
		else
		{
			document.getElementById("marked_resources").value--;
			new Ajax.Updater('mark_resource_'+resource_id, '/project_application/unmark_resource_for_invitation?resource_user_id='+resource_id, {asynchronous:true, evalScripts:true}); 		
		}			    
    }    
	
	function change_search_action(value)
	{
		if(value=="camp_res")
		{
			$('search_form').action="/enterprise_project/search_results"				
		}
		else if(value=="camp_serv")
		{
			$('search_form').action="/classified/classified_search_results"	
		}
		else if(value=="camp_proj")
		{
			$('search_form').action="/classified/campus_project_search_results"	
		}
		else 
		{
			$('search_form').action="/resource_project/search_results"	
		}
		
	}