function folder_validate(){
	
	
	var errorCont = $('#new_folder_errors');
	errorCont.empty();
	errorCont.hide();

	if($('#f_title').val()!=''){
		return true;
	} else {
		showFormError(errorCont,'Введите название папки');
		errorCont.show();
		//alert("Введите название папки");
		return false;
	}
}

function countDown(time) {
	var countDownTime;
	if(parseInt(time) > 0) {
		document.getElementById("countdown").innerHTML = 6;
	}

	countDownTime = parseInt(document.getElementById("countdown").innerHTML);
	countDownTime--;
	document.getElementById("countdown").innerHTML  = countDownTime;

	if (  parseInt(document.getElementById("countdown").innerHTML) <=0){
		clearTimeout(counter)
		window.close();
		return;
	}

	counter=setTimeout("countDown()", 1000);
}

function AddSelectOption(selectObj, text, value, isSelected)
{
	if (selectObj != null && selectObj.options != null){
		selectObj.options[selectObj.options.length] =
		new Option(text, value, false, isSelected);
	}
}

function getFolderId() {
 var fid = parseInt(document.getElementById('folder').value);
 
 document.getElementById('folder').disabled = 'true';
 document.getElementById('folder_cr_link').style.display = 'none';
 
 if( /^\d+$/.test(fid) ){
   return fid;
 }
 return; 
}

function show_crform()
{
	var parent_id = document.getElementById('folder').value;
	var popupWin = window.open("/folder.aspx?create&notpl=1&parent="+parent_id,'', "location,width=535,height=380,top=250,left=400,scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no");
	popupWin.focus(); // передаём фокус новому окну
}
