// Careers handles

var activeJob=null

function ToggleBlock(who) {
	if (activeJob)
	{
		activeJob.className = (activeJob.className.indexOf("JClosed")>-1)?(activeJob.className.replace("JClosed","JOpen")):(activeJob.className.replace("JOpen","JClosed"));
		var dblock = document.getElementById(activeJob.id+"_descr");
		dblock.className = (dblock.className.indexOf("Collapsed")>-1)?(dblock.className.replace("Collapsed","Visible")):(dblock.className.replace("Visible","Collapsed"));	
	}
	who.className = (who.className.indexOf("JClosed")>-1)?(who.className.replace("JClosed","JOpen")):(who.className.replace("JOpen","JClosed"));
	var dblock = document.getElementById(who.id+"_descr");
	dblock.className = (dblock.className.indexOf("Collapsed")>-1)?(dblock.className.replace("Collapsed","Visible")):(dblock.className.replace("Visible","Collapsed"));	
	activeJob=who
}

function CloseBlock(id) {
	var b = document.getElementById(id);
	ToggleBlock(b);
}

function OpenArmyService() {
	document.getElementById("armyService").className = "Open";
}

function CloseArmyService() {
	document.getElementById("armyService").className = "Collapsed";
}

function IHaveACV() {
	document.getElementById("haveCV").className = "HasCV";
	document.getElementById("dontHaveCV").className = "HasCV Collapsed";
}

function IHaveNoCV() {
	document.getElementById("dontHaveCV").className = "HasCV";
	document.getElementById("haveCV").className = "HasCV Collapsed";
}

var defText = "הנחיות: גש לקובץ קורות החיים שלך, בחר את התוכן שאתה מעוניין להעביר אלינו ולחץ העתק (Ctrl+C). חזור למסך זה ולחץ הדבק (Ctrl+V)";

function checkDefText(who) {
	if (who.value == defText) {
		who.value = "";
	}
}

function setDefText(who) {
	if (who.value == "") {
		who.value = defText;
	}
}

function showForm(who)
{
	var form=document.getElementById(who.id+"_content");
	form.style.display="block";
	var jobId=form.parentNode.getElementsByTagName("input")[0].value;
	var id=form.parentNode.getElementsByTagName("input")[1].value;
	var url="/send_cv.aspx?job="+jobId+"&id="+id;
	form.src=url;
	/*
	else
	{
		form.style.display="none";
		alert("2");		
	}
	*/
		
}
function closeForm()
{
	window.parent.document.getElementById(frameid + "_content").style.display = "none";
}

function btnClick(who)
{
	var formValid=true;
	inputs=who.parentNode.getElementsByTagName('input')
	for (var i=0;i<inputs.length;i++)
	{
		if ((inputs[i].type=="text" || inputs[i].type=="file") && inputs[i].value.length==0)	
		{
			formValid=false
			alert('יש למלא את כל השדות הדרושים');
			break;
		}
	}
	if (formValid)
	{
		var btnSend=document.getElementById("btnSend");
		btnSend.click();
	}
}

