//© Matveev Stas
function set_cnd (cpi, cid, tca)
{
if(cpi.indexOf("set_cnd")!=-1)
	{
if(confirm("Определить данного фрилансера как кандидата на исполнение проекта?"))
		{
						var params="arguments="+cid;
						xmlHttp.open("POST","/js_ajax/set_cnd.php",true);
						xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded, charset=windows-1251");
						xmlHttp.onreadystatechange=function done () {if(xmlHttp.readyState==4 && xmlHttp.status==200) {
							for(i=0;i<tca.length;i++)
								{
									getCnd=document.getElementById("tbl_"+tca[i]);
									getCnd.style.backgroundColor="#CEE6FF";
									document["icnd"+tca[i]].title="Снять кандидатуру данного фрилансера на исполнение проекта";
									document["icnd"+tca[i]].src="/img/rem_cnd.gif";
								}
							}							
						
						} 
						xmlHttp.send(params);											
		}
		else
		{
			return false;
		}
	}
else
	{
if(confirm("Снять кандидатуру данного фрилансера на исполнение проекта?"))
		{
						var params="arguments="+cid;
						xmlHttp.open("POST","/js_ajax/rem_cnd.php",true);
						xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded, charset=windows-1251");
						xmlHttp.onreadystatechange=function done () {if(xmlHttp.readyState==4 && xmlHttp.status==200) {
							for(i=0;i<tca.length;i++)
								{
									getCnd=document.getElementById("tbl_"+tca[i]);
									getCnd.style.backgroundColor="#FFFFFF";
									document["icnd"+tca[i]].title="Определить как кандидата на исполнение проекта";
									document["icnd"+tca[i]].src="/img/set_cnd.gif";
								}
							}							
						
						} 
						xmlHttp.send(params);											
		}
		else
		{
			return false;
		}		
	}	
}


function set_plr (cpi, cid, tca)
{
if(cpi.indexOf("set_plr")!=-1)
	{
if(confirm("Определить данного фрилансера как иcполнителя и закрыть проект?"))
		{
						var params="arguments="+cid;
						xmlHttp.open("POST","/js_ajax/set_plr.php",true);
						xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded, charset=windows-1251");
						xmlHttp.onreadystatechange=function done () {if(xmlHttp.readyState==4 && xmlHttp.status==200) {
							for(i=0;i<cms_arr.length;i++)
								{
									getCnd=document.getElementById("tbl_"+cms_arr[i]);
									getCnd.style.backgroundColor="#FFFFFF";
									document["iplr"+cms_arr[i]].title="Определить данного фрилансера как иcполнителя проекта";
									document["iplr"+cms_arr[i]].src="/img/set_plr.gif";
								}
								
							for(i=0;i<tca.length;i++)
								{
									getCnd=document.getElementById("tbl_"+tca[i]);
									getCnd.style.backgroundColor="#EBDCA3";
									document["iplr"+tca[i]].title="Снять данного фрилансера с должности исполнителя проекта";
									document["iplr"+tca[i]].src="/img/rem_plr.gif";
								}
						getPlr=document.getElementById("prj_plr");
						getPlr.innerHTML=xmlHttp.responseText;								
							}					
						} 						
						xmlHttp.send(params);											
		}
		else
		{
			return false;
		}
	}
else
	{
if(confirm("Снять данного фрилансера с должности исполнителя проекта?"))
		{
						var params="arguments="+cid;
						xmlHttp.open("POST","/js_ajax/rem_plr.php",true);
						xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded, charset=windows-1251");
						xmlHttp.onreadystatechange=function done () {if(xmlHttp.readyState==4 && xmlHttp.status==200) {
							for(i=0;i<tca.length;i++)
								{
									getCnd=document.getElementById("tbl_"+tca[i]);
									getCnd.style.backgroundColor="#FFFFFF";
									document["iplr"+tca[i]].title="Определить данного фрилансера как иcполнителя проекта";
									document["iplr"+tca[i]].src="/img/set_plr.gif";
								}							
						getPlr=document.getElementById("prj_plr");
						getPlr.innerHTML="не определён";
							}						
						} 					
						xmlHttp.send(params);											
		}
		else
		{
			return false;
		}		
	}	
}
