﻿//© Matveev Stas
function set_cnd (cpi, cid, tca)
{
if(cpi.indexOf("set_cnd")!=-1)
	{
if(confirm("Zvolit tohoto freelancera uchazečem o zpracování projektu?"))
		{
						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="Odvolat tohoto freelancera od zpracování projektu";
									document["icnd"+tca[i]].src="/img/rem_cnd.gif";
								}
							}

						}
						xmlHttp.send(params);
		}
		else
		{
			return false;
		}
	}
else
	{
if(confirm("Odvolat tohoto freelancera od zpracování projektu?"))
		{
						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="Zvolit uchazečem o zpracování projektu";
									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("Zvolit tohoto freelancera zpracovatelem a uzavřít projekt?"))
		{
						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="Zvolit tohoto freelancera zpracovatelem projektu";
									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="Odvolat tohoto freelancera od zpracování projektu";
									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("Odvolat tohoto freelancera od zpracování projektu?"))
		{
						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="Zvolit tohoto freelancera zpracovatelem projektu";
									document["iplr"+tca[i]].src="/img/set_plr.gif";
								}
						getPlr=document.getElementById("prj_plr");
						getPlr.innerHTML="není zvolen";
							}
						}
						xmlHttp.send(params);
		}
		else
		{
			return false;
		}
	}
}
