var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);


function checkField2(form) {
  if (nonBlank(form.user, "Alegeţi cel puţin un răspuns")) 
  {
    form.submit();
  }
}
function checkField3(form) {
  if (nonBlank(form.user, "Alegeţi un răspuns")) 
  {
    form.submit();
  }
}


function testqq(){
	alert("ME:");
}

function conf_delete_file(text, name){
	if(confirm(text))
		{
			document.forms[name].submit();
			//alert(name);
		}
}


function is_valid_form(form){

	if(form.new_descr.value==''){
		alert("Trebuie sa faceti o descriere simpla a fisierului !");
	}
	else 
	{
		if(form.new_file.value=="" || form.new_file.value.indexOf(".doc")==-1){
			alert("Nu ati ales fisierul, sau fisierul ales de Dvs nu este al aplicatiei MS Word!");
		}
		else{
		form.old_file_path.value=form.new_file.value;
		form.submit();
		}
	}
}




function openWindowXY(url, X, Y){
	var str="toolbar=0,location=0,directories=no,status=1,menubar=1,scrollbars=1,resizable=1,copyhistory=no,width=" + X + ",height=" + Y + ",screenX=10,screenY=10,top=10,left=10";
winResult=open(url, "displayWindow", str);
}

function confirm_delete(text, name){
var f=name;
//alert(f);
	if(confirm(text))
	{
		document.forms[f].submit();
	}

}

function submitonce(theform){
	//if IE 4+ or NS 6+
	//alert("me:");
	if (document.all||document.getElementById)
	{
		//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++)
		{
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
			//disable em
			tempobj.disabled=true
		}
	}
}


function CalcRest(name)
{
	
	var maxnum;
	var rest;
	var str1;
	var form_name=name;
	maxnum = 800;
	if (document.forms[form_name].content.value != null)
	{	str1=document.forms[form_name].content.value;
		rest =maxnum - str1.length;
		if (rest < 0 )
		{	document.forms[form_name].content.value=str1.substring(0,maxnum);
			rest = 0;
		}
		document.forms[form_name].rest.value=rest;
	}
	
	return (rest>0)
}

function MsgOnKeyPress(name)
{
  var form_name=name;
  event.returnValue=CalcRest(form_name);

}

function setMsgFocus(name)
{
	var form_name=name;
	document.forms['form_name'].content.focus();
	document.forms['form_name'].content.select();
}

function selectLink(formName, formField, confirmText, positions){
//Redirect browser to the link in the VALUE of the formFiled of the formName

//positions - comma separated option ids, like: 2,3,5, which will be confirmed
//in case if you have more options to delete...
	var val = document.forms[formName].elements[formField].value;
	var del = document.forms[formName].elements[formField].selectedIndex;
	
	var optionsToConfirm = positions.split(",");
	var conf=0;
	
	for(i=0; i<optionsToConfirm.length; i++)
	{
		if(del == parseInt(optionsToConfirm[i])) { conf=1; }
	}

	if(confirmText && conf )
	{
		if(confirm(confirmText)) {location.replace(val);} else { return false; }
	}
	else
	{
		location.replace(val);
	}
}

function gotoLink(tolink){
	var val = tolink;
	location.replace(val);
}


function check_crit(formname){
	var myform=formname;
	var err='';
	var myfocus='';
	//alert(myform);
	//Nota 1 to	
	if(myform.crit_mode2.checked)
	{
	
	if(eval(myform.nota1to.value.length) == 0)		{ err='Nota 1 "Pînă la" nu este setată'; myfocus='nota1to';}
	else if(myform.nota1to.value.search("[^0-9]")>=0)	{ err='Nota 1 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.'; myfocus='nota1to';}
	else if(parseInt(myform.nota1to.value)==0)			{ err='Nota 1 "Pînă la" nu poate fi nulă'; myfocus='nota1to';}

	//Nota 2 from	
	else if(eval(myform.nota2from.value.length) == 0)	{ err='Nota 2 "De la" nu este setată'; myfocus='nota2to';}
	else if(myform.nota2from.value.search("[^0-9]")>=0)	{ err='Nota 2 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.'; myfocus='nota2to'; }
	else if(parseInt(myform.nota2from.value)==0)			{ err='Nota 2 "De la" nu poate fi nulă'; myfocus='nota2to'; }
	else if(parseInt(myform.nota2from.value)!=(parseInt(myform.nota1to.value)+1)){ err='Interval vid sau intersecţie! Nota 2 "De la" trebuie să fie egală cu '+(parseInt(myform.nota1to.value)+1)+' puncte.'; myfocus='nota2to'; }	
	//Nota 2 to	
	else if(eval(myform.nota2to.value.length) == 0)		{ err='Nota 2 "Pînă la" nu este setată'; myfocus='nota2to';}
	else if(myform.nota2to.value.search("[^0-9]")>=0)	{ err='Nota 2 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.'; myfocus='nota2to'; }
	else if(parseInt(myform.nota2to.value)==0)			{ err='Nota 2 "Pînă la" nu poate fi nulă'; myfocus='nota2to'; }
	else if(parseInt(myform.nota2to.value)<=parseInt(myform.nota2from.value)){ err='Nota 2 "Până la" trebuie să fie mai mare decât Nota 2 "De la", adică mai mare decât '+ parseInt(myform.nota2from.value); myfocus='nota2to';}	

	//Nota 3 from	
	else if(eval(myform.nota3from.value.length) == 0)	{ err='Nota 3 "De la" nu este setată'; myfocus='nota3to';}
	else if(myform.nota3from.value.search("[^0-9]")>=0)	{ err='Nota 3 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota3to';}
	else if(parseInt(myform.nota3from.value)==0)			{ err='Nota 3 "De la" nu poate fi nulă' ; myfocus='nota3to';}
	else if(parseInt(myform.nota3from.value)!=(parseInt(myform.nota2to.value)+1)){ err='Interval vid sau intersecţie! Nota 3 "De la" trebuie să fie egală cu '+(parseInt(myform.nota2to.value)+1)+' puncte.' ; myfocus='nota3to';}	
	//Nota 3 to	
	else if(eval(myform.nota3to.value.length) == 0)		{ err='Nota 3 "Pînă la" nu este setată'; myfocus='nota3to'; }
	else if(myform.nota3to.value.search("[^0-9]")>=0)	{ err='Nota 3 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota3to';}
	else if(parseInt(myform.nota3to.value)==0)			{ err='Nota 3 "Pînă la" nu poate fi nulă' ; myfocus='nota3to';}
	else if(parseInt(myform.nota3to.value)<=parseInt(myform.nota3from.value)){ err='Nota 3 "Până la" trebuie să fie mai mare decât Nota 3 "De la", adică mai mare decât '+ parseInt(myform.nota3from.value); myfocus='nota3to';}	

	//Nota 4 from	
	else if(eval(myform.nota4from.value.length) == 0)	{ err='Nota 4 "De la" nu este setată'; myfocus='nota4to'; }
	else if(myform.nota4from.value.search("[^0-9]")>=0)	{ err='Nota 4 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota4to';}
	else if(parseInt(myform.nota4from.value)==0)			{ err='Nota 4 "De la" nu poate fi nulă' ; myfocus='nota4to';}
	else if(parseInt(myform.nota4from.value)!=(parseInt(myform.nota3to.value)+1)){ err='Interval vid sau intersecţie! Nota 4 "De la" trebuie să fie egală cu '+(parseInt(myform.nota3to.value)+1)+' puncte.' ; myfocus='nota4to';}	
	//Nota 4 to	
	else if(eval(myform.nota4to.value.length) == 0)		{ err='Nota 4 "Pînă la" nu este setată'; myfocus='nota4to'; }
	else if(myform.nota4to.value.search("[^0-9]")>=0)	{ err='Nota 4 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota4to';}
	else if(parseInt(myform.nota4to.value)==0)			{ err='Nota 4 "Pînă la" nu poate fi nulă' ; myfocus='nota4to';}
	else if(parseInt(myform.nota4to.value)<=parseInt(myform.nota4from.value)){ err='Nota 4 "Până la" trebuie să fie mai mare decât Nota 4 "De la", adică mai mare decât '+ parseInt(myform.nota4from.value); myfocus='nota4to';}	

	//Nota 5 from	
	else if(eval(myform.nota5from.value.length) == 0)	{ err='Nota 5 "De la" nu este setată'; myfocus='nota5to'; }
	else if(myform.nota5from.value.search("[^0-9]")>=0)	{ err='Nota 5 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.'; myfocus='nota5to'; }
	else if(parseInt(myform.nota5from.value)==0)		{ err='Nota 5 "De la" nu poate fi nulă' ; myfocus='nota5to';}
	else if(parseInt(myform.nota5from.value)!=(parseInt(myform.nota4to.value)+1)){ err='Interval vid sau intersecţie! Nota 5 "De la" trebuie să fie egală cu '+(parseInt(myform.nota4to.value)+1)+' puncte.' ; myfocus='nota5to';}	
	//Nota 5 to	
	else if(eval(myform.nota5to.value.length) == 0)		{ err='Nota 5 "Pînă la" nu este setată'; myfocus='nota5to'; }
	else if(myform.nota5to.value.search("[^0-9]")>=0)	{ err='Nota 5 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota5to';}
	else if(parseInt(myform.nota5to.value)==0)			{ err='Nota 5 "Pînă la" nu poate fi nulă' ; myfocus='nota5to';}
	else if(parseInt(myform.nota5to.value)<=parseInt(myform.nota5from.value)){ err='Nota 5 "Până la" trebuie să fie mai mare decât Nota 5 "De la", adică mai mare decât '+ parseInt(myform.nota5from.value); myfocus='nota5to';}	

	//Nota 6 from	
	else if(eval(myform.nota6from.value.length) == 0)	{ err='Nota 6 "De la" nu este setată'; myfocus='nota6to'; }
	else if(myform.nota6from.value.search("[^0-9]")>=0)	{ err='Nota 6 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota6to';}
	else if(parseInt(myform.nota6from.value)==0)		{ err='Nota 6 "De la" nu poate fi nulă' ; myfocus='nota6to';}
	else if(parseInt(myform.nota6from.value)!=(parseInt(myform.nota5to.value)+1)){ err='Interval vid sau intersecţie! Nota 6 "De la" trebuie să fie egală cu '+(parseInt(myform.nota5to.value)+1)+' puncte.' ; myfocus='nota6to';}	
	//Nota 6 to	
	else if(eval(myform.nota6to.value.length) == 0)		{ err='Nota 6 "Pînă la" nu este setată';myfocus='nota6to';}
	else if(myform.nota6to.value.search("[^0-9]")>=0)	{ err='Nota 6 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota6to';}
	else if(parseInt(myform.nota6to.value)==0)			{ err='Nota 6 "Pînă la" nu poate fi nulă' ; myfocus='nota6to';}
	else if(parseInt(myform.nota6to.value)<=parseInt(myform.nota6from.value)){ err='Nota 6 "Până la" trebuie să fie mai mare decât Nota 6 "De la", adică mai mare decât '+ parseInt(myform.nota6from.value); myfocus='nota6to';}	

	//Nota 7 from	
	else if(eval(myform.nota7from.value.length) == 0)	{ err='Nota 7 "De la" nu este setată'; myfocus='nota7to'; }
	else if(myform.nota7from.value.search("[^0-9]")>=0)	{ err='Nota 7 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota7to';}
	else if(parseInt(myform.nota7from.value)==0)			{ err='Nota 7 "De la" nu poate fi nulă' ; myfocus='nota7to';}
	else if(parseInt(myform.nota7from.value)!=(parseInt(myform.nota6to.value)+1)){ err='Interval vid sau intersecţie! Nota 7 "De la" trebuie să fie egală cu '+(parseInt(myform.nota6to.value)+1)+' puncte.' ; myfocus='nota7to';}	
	//Nota 7 to	
	else if(eval(myform.nota7to.value.length) == 0)		{ err='Nota 7 "Pînă la" nu este setată'; myfocus='nota7to'; }
	else if(myform.nota7to.value.search("[^0-9]")>=0)	{ err='Nota 7 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota7to';}
	else if(parseInt(myform.nota7to.value)==0)			{ err='Nota 7 "Pînă la" nu poate fi nulă' ; myfocus='nota7to';}
	else if(parseInt(myform.nota7to.value)<=parseInt(myform.nota7from.value)){ err='Nota 7 "Până la" trebuie să fie mai mare decât Nota 7 "De la", adică mai mare decât '+ parseInt(myform.nota7from.value); myfocus='nota7to';}	

	//Nota 8 from	
	else if(eval(myform.nota8from.value.length) == 0)	{ err='Nota 8 "De la" nu este setată'; myfocus='nota8to';}
	else if(myform.nota8from.value.search("[^0-9]")>=0)	{ err='Nota 8 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota8to';}
	else if(parseInt(myform.nota8from.value)==0)			{ err='Nota 8 "De la" nu poate fi nulă' ; myfocus='nota8to';}
	else if(parseInt(myform.nota8from.value)!=(parseInt(myform.nota7to.value)+1)){ err='Interval vid sau intersecţie! Nota 8 "De la" trebuie să fie egală cu '+(parseInt(myform.nota7to.value)+1)+' puncte.' ; myfocus='nota8to';}	
	//Nota 8 to	
	else if(eval(myform.nota8to.value.length) == 0)		{ err='Nota 8 "Pînă la" nu este setată'; myfocus='nota8to'; }
	else if(myform.nota8to.value.search("[^0-9]")>=0)	{ err='Nota 8 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota8to';}
	else if(parseInt(myform.nota8to.value)==0)			{ err='Nota 8 "Pînă la" nu poate fi nulă' ; myfocus='nota8to';}
	else if(parseInt(myform.nota8to.value)<=parseInt(myform.nota8from.value)){ err='Nota 8 "Până la" trebuie să fie mai mare decât Nota 8 "De la", adică mai mare decât '+ parseInt(myform.nota8from.value); myfocus='nota8to';}	

	//Nota 9 from	
	else if(eval(myform.nota9from.value.length) == 0)	{ err='Nota 9 "De la" nu este setată'; myfocus='nota9to';}
	else if(myform.nota9from.value.search("[^0-9]")>=0)	{ err='Nota 9 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota9to';}
	else if(parseInt(myform.nota9from.value)==0)			{ err='Nota 9 "De la" nu poate fi nulă' ; myfocus='nota9to';}
	else if(parseInt(myform.nota9from.value)!=(parseInt(myform.nota8to.value)+1)){ err='Interval vid sau intersecţie! Nota 9 "De la" trebuie să fie egală cu '+(parseInt(myform.nota8to.value)+1)+' puncte.' ; myfocus='nota9to';}	
	//Nota 9 to	
	else if(eval(myform.nota9to.value.length) == 0)		{ err='Nota 9 "Pînă la" nu este setată'; myfocus='nota9to'; }
	else if(myform.nota9to.value.search("[^0-9]")>=0)	{ err='Nota 9 "Pînă la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota9to';}
	else if(parseInt(myform.nota9to.value)==0)			{ err='Nota 9 "Pînă la" nu poate fi nulă' ; myfocus='nota9to';}
	else if(parseInt(myform.nota9to.value)<=parseInt(myform.nota9from.value)){ err='Nota 9 "Până la" trebuie să fie mai mare decât Nota 9 "De la", adică mai mare decât '+ parseInt(myform.nota9from.value); myfocus='nota9to';}	

	//Nota 10 from	
	else if(eval(myform.nota10from.value.length) == 0)	{ err='Nota 10 "De la" nu este setată'; myfocus='nota10to';}
	else if(myform.nota10from.value.search("[^0-9]")>=0)	{ err='Nota 10 "De la" conţine caractere inadmisibile. Se admit doar cifrele 0-9.' ; myfocus='nota10to';}
	else if(parseInt(myform.nota10from.value)==0)			{ err='Nota 10 "De la" nu poate fi nulă'  ; myfocus='nota10to';}
	else if(parseInt(myform.nota10from.value)!=(parseInt(myform.nota9to.value)+1)){ err='Interval vid sau intersecţie! Nota 10 "De la" trebuie să fie egală cu '+(parseInt(myform.nota9to.value)+1)+' puncte.'  ; myfocus='nota10to';}	

	}//if(PROF)checked
	
	if(err.length>0)
	{
		alert(err);
	}
	else
	{
		myform.crit_is_ok.value='ok';
		myform.submit();
	}
	
}


///FLASH inserting...

function commitFlashObject(_obj, _container){
    _output=""
    _paramoutput=""
    _src=""
    _ver=""
    for(_cO in _obj){
        _output+=_cO+"=\""+_obj[_cO]+"\" "
        _paramoutput+="<param name="+_cO+" value=\""+_obj[_cO]+"\">";
        if(_cO=="movie")_src="src=\""+_obj[_cO]+"\"";
        if(_cO=="version")_ver=_obj[_cO];
    }
    if(_ver=="")_ver="8,0,0,0"
    ihtm="<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+_ver+" "+_output+">\n"
    ihtm+=_paramoutput+"\n"
    ihtm+="<embed "+_src+" pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash "+_output+">\n";
    ihtm+="</embed>\n";
    ihtm+="</object>\n";
    document.getElementById(_container).innerHTML=ihtm    
}
function makevisible(cur,which){
strength=(which==0)? 1 : 0.2

if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*100
}