function Trim(TRIM_VALUE){

    if(TRIM_VALUE.length < 1){

    return"";

    }

    TRIM_VALUE = RTrim(TRIM_VALUE);

    TRIM_VALUE = LTrim(TRIM_VALUE);

      	if(TRIM_VALUE==""){

      		return "";

      	}else{

      		return TRIM_VALUE;

      	}

}



function RTrim(VALUE){

	var w_space = String.fromCharCode(32);

	var v_length = VALUE.length;

	var strTemp = "";

   if(v_length < 0){

    return"";

   }

   var iTemp = v_length -1;

      	while(iTemp > -1){

      		if(VALUE.charAt(iTemp) == w_space){}

          		else{

          			strTemp = VALUE.substring(0,iTemp +1);

          			break;

          		}

          		iTemp = iTemp-1;

          	}

          	return strTemp;

}



function LTrim(VALUE){

	var w_space = String.fromCharCode(32);

    	if(v_length < 1){

    		return"";

    	}

    	var v_length = VALUE.length;

    	var strTemp = "";

    	var iTemp = 0;

        	while(iTemp < v_length){

        		if(VALUE.charAt(iTemp) == w_space){}

            		else{

            			strTemp = VALUE.substring(iTemp,v_length);

            			break;

            		}

            		iTemp = iTemp + 1;

            	}

            	return strTemp;

        }



function validare_struct(frm,campuri){

		return_value=true;

		split_array=campuri.split("|");

		for(i=0;i<split_array.length;i++){

				temp=frm.elements[split_array[i]].value;

				if (!Trim(temp.toString())) return_value=false;

		}

		if (!return_value) alert('Va rugam sa completati toate campurile marcate cu *!');

		return return_value;

}





function fctazi()

{

 		d=new Date();

		f=document.forms[0];

		day="";

		day=day+d.getDate();

		if(day.length==1) day="0"+day;

		for(i=0;i<f.zi.length;i++){

		  if(f.zi[i].value==day) f.zi[i].selected=true;

			}

		month="";

		i=d.getMonth()+1;

		month=month+i;

		if(month.length==1) month="0"+month;

		for(i=0;i<f.luna.length;i++)

		  if(f.luna[i].value==month) f.luna[i].selected=true;

		year="";

		year=year+d.getFullYear();

		for(i=0;i<f.an.length;i++)

		  if(f.an[i].value==year) f.an[i].selected=true;

}



function confirmSubmit(){

    var agree=confirm("Sunteti sigur ca vreti sa stergeti inregistrarea?");

    if (agree)

    	return true ;

    else

    	return false ;

}

function confirmSend(msg){
    var agree=confirm(msg);
    if (agree)
    	return true ;
    else
    	return false ;
}


function unlk(valsel,frm){

    if (valsel == 'Altul') {

        eval("document."+frm+".alttip.style.display='block'");

    }else{

    	eval("document."+frm+".alttip.style.display='none'");

    }

}



window.name='cv';



var EDIT='';

if (navigator.appName.match(/netscape/ig)) {

				if(parseInt(navigator.appVersion) > 4){

				//Netscape 6

							EDIT+='editors/editor3.htm';

				}else{

				//Netscape 4

							EDIT+='editors/editor3.htm';

				}

} else if(navigator.appName.match(/explorer/ig)){

//Internet Explorer

							EDIT+='editors/editorie.htm';

} else if(navigator.appName.match(/opera/ig)){

//Internet Explorer

							EDIT+='editors/editorop.htm';

} else {

//alt browser

							EDIT+='editors/view.htm';

}



function showHide(section)

{

if (document.getElementById(section).style.display == 'none')

{

document.getElementById(section).style.display = 'block';

}

else

{

document.getElementById(section).style.display = 'none';

}

}



function TrackCount(fieldObj,countFieldName,maxChars)

{

	var countField = eval("fieldObj.form."+countFieldName);

	var diff = maxChars - fieldObj.value.length;

	

	// Need to check & enforce limit here also in case user pastes data

	if (diff < 0)

	{

		fieldObj.value = fieldObj.value.substring(0,maxChars);

		diff = maxChars - fieldObj.value.length;

	}

	countField.value = diff;

}



function LimitText(fieldObj,maxChars)

{

	var result = true;

	if (fieldObj.value.length >= maxChars)

		result = false;

	

	if (window.event)

		window.event.returnValue = result;

	return result;

}



function goto(combo)

{

location=combo.options[combo.selectedIndex].value

}





function validate_email(field){

with (field){

    apos=value.indexOf("@")

    dotpos=value.lastIndexOf(".")

      if (apos<1||dotpos-apos<2) 

        {alert("Va rugam sa introduceti o adresa de email valida!");

				return false}

      else {return true}

    }

}

function showHideTxt(showHideDiv, switchTextDiv, txtShow, txtHide) {
	var ele = document.getElementById(showHideDiv);
	var text = document.getElementById(switchTextDiv);
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = txtShow;
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = txtHide;
	}
}
