function mq_left() {
	//alert('---');
	var current=document.getElementById('promo_b').style.marginLeft;
	var current_length=current.length;
	//alert(current);
	x=current.substring(0, current_length-2);
	x=parseInt(x);
	x=x+2;
	if (x>0) { x=0;}
	var xpx=x+'px';
	//alert(xpx);
	document.getElementById('promo_b').style.marginLeft=xpx;
	timer_down=setTimeout('mq_left()',5);
	return (x);
}

function mq_right(minx) {
	//alert(minx);
	var current=document.getElementById('promo_b').style.marginLeft;
	var current_length=current.length;
	x=current.substring(0, current_length-2);
	x=parseInt(x);
	x=x-2;
	if (x<minx) { x=minx;}
	//alert(minx);
	var xpx=x+'px';
	document.getElementById('promo_b').style.marginLeft=xpx;
	//alert(minx);
	timer_up=setTimeout('mq_right('+minx+')',5);
	return (x);
}


function c_vote_out(cSet) {
	var current=document.getElementById('c_note').value;
	var cs1=''; var cs2=''; var cs3=''; var cs4=''; var cs5='';
	if (current>=1) { cs1=cSet;} 
	if (current>=2) { cs2=cSet;} 
	if (current>=3) { cs3=cSet;} 
	if (current>=4) { cs4=cSet;} 
	if (current>=5) { cs5=cSet;} 
	document.getElementById('star1').style.backgroundColor=cs1;
	document.getElementById('star2').style.backgroundColor=cs2;
	document.getElementById('star3').style.backgroundColor=cs3;
	document.getElementById('star4').style.backgroundColor=cs4;
	document.getElementById('star5').style.backgroundColor=cs5;
}

function c_vote_over(star, cOver) {
	var current=document.getElementById('c_note').value;
	if (!(document.getElementById('c_note').value>0)) {
		var cs1=''; var cs2=''; var cs3=''; var cs4=''; var cs5='';
		if (star>=1) { cs1=cOver;} 
		if (star>=2) { cs2=cOver;} 
		if (star>=3) { cs3=cOver;} 
		if (star>=4) { cs4=cOver;} 
		if (star>=5) { cs5=cOver;} 
		document.getElementById('star1').style.backgroundColor=cs1;
		document.getElementById('star2').style.backgroundColor=cs2;
		document.getElementById('star3').style.backgroundColor=cs3;
		document.getElementById('star4').style.backgroundColor=cs4;
		document.getElementById('star5').style.backgroundColor=cs5;
	}
}

function manEvAppl() {
	if (document.getElementById('appl').checked) {
		document.getElementById('appl_deadline_row').style.display='';
		document.getElementById('appl_places_row').style.display='';
	} else {
		document.getElementById('appl_deadline_row').style.display='none';
		document.getElementById('appl_places_row').style.display='none';
	}
}

function shop_favorites(IDitem) {
	var url = emd_adr_http+'_ajax/shop_favorites.php';
	var params = 'IDitem='+IDitem;
	var ajax = new Ajax.Updater(
	{success: 'shop_favorites_'+IDitem},
	url,
	{method: 'get', parameters: params, onFailure: domError});
}

function shop_cart (IDedit, IDdel, IDadd) {
	var url = emd_adr_http+'_ajax/shop_cart.php';
	var params;
	if (IDedit>0) {
		var cart_field='pcs'+IDedit;
		var cart_pcs=document.getElementById(cart_field).value;
		params = 'IDedit='+IDedit+'&pcs='+cart_pcs;
		//alert (params);
	} else if (IDdel>0) {
		params = 'IDdel='+IDdel;
		//alert (params);
	} else if (IDadd>0) {
		var shop_add_nr=document.getElementById('shop_add_nr_'+IDadd).value;
		params = 'IDadd='+IDadd+'&shop_add_nr='+shop_add_nr;
	}

	new Ajax.Request(url,
	  {
		method:'get', 
		parameters: params, 
		onSuccess: function(transport){
		  var response = transport.responseText || "";
		  var responses=response.split('<delimiter>');
		  if (document.getElementById('shop_main_cart')) { 
			document.getElementById('shop_main_cart').innerHTML=responses[1]; 
		  }
		  document.getElementById('shop_cart_container').innerHTML=responses[0]; 
		  if (IDadd>0) {
		  	document.getElementById('shop_add_containter_'+IDadd).innerHTML='Produsul a fost adaugat in <a href="'+emd_adr_http+'cos">cosul de cumparaturi</a>.';
			//
			GB_ESTD_OCC = true;
			GB_ESTD_RELOAD = false;
			GB_showCenter('Confirmare',emd_adr_sfs+'_includes/grey-cos-conf.php?IDadd='+IDadd,255,400);
		  }
		  //alert("Success! \n\n" + response);
		},
		onFailure: domError
	  });
}


function shop_delivery(cc) {
	var url = emd_adr_http+'_ajax/shop_delivery.php';
	var params = 'cc='+cc;
	
	if (cc>0) {
		//var cart_IDcounty=$('cart_IDcounty').serialize();
		if (document.getElementById('cart_IDcounty')) {
			var cart_IDcounty=$('cart_IDcounty').serialize();
		} else {
			var cart_IDcounty='cart_IDcounty=';
		}

		if (cc==1) {
			var cart_IDcity='cart_IDcity=0';
		} else {
			if (document.getElementById('cart_IDcity')) {
				var cart_IDcity=$('cart_IDcity').serialize();
			} else {
				var cart_IDcity='cart_IDcity=';
			}
		}
		params+='&'+cart_IDcounty+'&'+cart_IDcity;
	}

	var ajax = new Ajax.Updater(
	{success: 'shop_delivery'},
	url,
	{method: 'get', parameters: params, onFailure: domError});
}

function user_check() {
	
	var url = emd_adr_http+'_ajax/user_check.php';
	var ju=document.getElementById('join_user').value;
	var params = 'join_user='+ju;
	new Ajax.Request(url,
	  {
		method:'get', 
		parameters: params, 
		onSuccess: function(transport){
		  var response = transport.responseText || "";
		  var responses=response.split('|');
		  document.getElementById('join_user_ok').value=responses[1];
		  document.getElementById('user_check_answer').innerHTML=responses[0];
		},
		onFailure: domError
	  });
}

function email_check(jemail) {
	

	var url = emd_adr_http+'_ajax/email_check.php';
	//var je=document.getElementById('cart_u_email').value;
	var params = 'join_email='+jemail;
	new Ajax.Request(url,
	  {
		method:'get', 
		parameters: params, 
		onSuccess: function(transport){
		  var response = transport.responseText || "";
		  var responses=response.split('|');
		  document.getElementById('join_email_ok').value=responses[1];
		  document.getElementById('email_check_answer').innerHTML=responses[0];
		},
		onFailure: domError
	  });


}

function email_check2(uemail, IDuser) {
	
	var url = emd_adr_http+'_ajax/email_check2.php';
	//var je=document.getElementById('cart_u_email').value;
	var params = 'edit_email='+uemail+'&IDuser='+IDuser;
	new Ajax.Request(url,
	  {
		method:'get', 
		parameters: params, 
		onSuccess: function(transport){
		  var response = transport.responseText || "";
		  var responses=response.split('|');
		  document.getElementById('cart_u_email_ok').value=responses[1];
		  document.getElementById('email_check_answer').innerHTML=responses[0];
		},
		onFailure: domError
	  });
}
 
function email_check3(uemail, IDuser) {
	
	var url = emd_adr_http+'_ajax/email_check2.php';
	//var je=document.getElementById('cart_u_email').value;
	var params = 'edit_email='+uemail+'&IDuser='+IDuser;
	new Ajax.Request(url,
	  {
		method:'get', 
		parameters: params, 
		onSuccess: function(transport){
		  var response = transport.responseText || "";
		  var responses=response.split('|');
		  document.getElementById('edit_email_ok').value=responses[1];
		  document.getElementById('email_check_answer').innerHTML=responses[0];
		},
		onFailure: domError
	  });
}

function domError() {
	alert("eroare");
}

function chFormEditAccount(join_form)
{
	if (join_form.edit_email_ok.value==-1) {
		join_form.edit_submit.focus();
		return false;
	}

    if(join_form.join_name.value=="") {
        join_form.join_name.focus();
        join_form.join_name.style.borderColor='#F2797C';
        alert ("Introdu numele tau!");
        return false;
    }
    
    if(join_form.join_fname.value=="") {
        join_form.join_fname.focus();
        join_form.join_fname.style.borderColor='#F2797C';
        alert ("Introdu prenumele tau!");
        return false;
    }

    if(join_form.edit_email.value==""){
        join_form.edit_email.focus();
        join_form.edit_email.style.borderColor='#F2797C';
        alert ("Introdu adresa ta de email!");
    return false;}

    if(join_form.edit_email.value!=""){
        if(join_form.edit_email.value.length < 6){
            join_form.edit_email.focus();
            join_form.edit_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(join_form.edit_email.value.length > 49){
            join_form.edit_email.focus();
            join_form.edit_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(join_form.edit_email.value))){
            join_form.edit_email.focus();
            join_form.edit_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(join_form.edit_email_ok.value!="1"){
            join_form.edit_email.focus();
            join_form.edit_email.style.borderColor='#F2797C';
            alert ("Emailul introdus este deja in uz!");
        return false;}
    }
    
    if(join_form.join_status.value=="0"){
        join_form.join_status.focus();
        join_form.join_status.style.borderColor='#F2797C';
        alert ("Alege un statut ocupational!");
    return false;}

    if(join_form.join_status.value=="1"){
		if(join_form.join_prof.value==""){
			join_form.join_prof.focus();
			join_form.join_prof.style.borderColor='#F2797C';
			alert ("Introdu ocupatia!");
		return false;}
	}

    if(join_form.join_status.value=="2"){
		if(join_form.join_employer_name.value==""){
			join_form.join_employer_name.focus();
			join_form.join_employer_name.style.borderColor='#F2797C';
			alert ("Introdu denumirea companiei / institutiei / organizatiei!");
		return false;}
	}

    if(join_form.join_status.value=="3"){
		if(join_form.join_org_name.value==""){
			join_form.join_org_name.focus();
			join_form.join_org_name.style.borderColor='#F2797C';
			alert ("Introdu denumirea organizatiei!");
		return false;}
	}
}


function chFormCartDet(join_form)

{

    if (join_form.cart_u_email_ok.value==-1) {
        join_form.cart_submit.focus();
        return false;

    }


   if(join_form.cart_u_name.value=="") {

        join_form.cart_u_name.focus();

        join_form.cart_u_name.style.borderColor='#F2797C';

        alert ("Introdu numele tau!");

        return false;

    }
    

    if(join_form.cart_u_phone.value=="") {

        join_form.cart_u_phone.focus();

        join_form.cart_u_phone.style.borderColor='#F2797C';

        alert ("Introdu numarul tau de telefon!");

        return false;

    }



    if(join_form.cart_u_email.value==""){

        join_form.cart_u_email.focus();

        join_form.cart_u_email.style.borderColor='#F2797C';

        alert ("Introdu adresa ta de email!");

    return false;}
    

    if(join_form.cart_u_email.value!=""){

        if(join_form.cart_u_email.value.length < 6){

            join_form.cart_u_email.focus();

            join_form.cart_u_email.style.borderColor='#F2797C';

            alert ("Adresa de email introdusa nu e valida!");

            return false;}


        if(join_form.cart_u_email.value.length > 49){

            join_form.cart_u_email.focus();

            join_form.cart_u_email.style.borderColor='#F2797C';

            alert ("Adresa de email introdusa nu e valida!");

            return false;}

 

        if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(join_form.cart_u_email.value))){

            join_form.cart_u_email.focus();

            join_form.cart_u_email.style.borderColor='#F2797C';

            alert ("Adresa de email introdusa nu e valida!");

            return false;}


        if(join_form.cart_u_email_ok.value=="0") {

            join_form.cart_u_email.focus();

            join_form.cart_u_email.style.borderColor='#F2797C';

            alert ("Emailul introdus este deja in uz!");

        return false;}
    }


    //alert(join_form.join_user_ok);

    if (join_form.cart_it[0].checked) {

        if(join_form.cart_p_cnp.value==""){

            join_form.cart_p_cnp.focus();

            join_form.cart_p_cnp.style.borderColor='#F2797C';

            alert ("Introdu codul numeric personal!");

        return false;}

        if(join_form.cart_p_ids.value==""){

            join_form.cart_p_ids.focus();

            join_form.cart_p_ids.style.borderColor='#F2797C';

            alert ("Introdu seria actului de identitate!");

        return false;}

        if(join_form.cart_p_idn.value==""){

            join_form.cart_p_idn.focus();

            join_form.cart_p_idn.style.borderColor='#F2797C';

            alert ("Introdu numarul actului de identitate!");

        return false;}

    }

    if (join_form.cart_it[1].checked) {

        if(join_form.cart_c_name.value==""){

            join_form.cart_c_name.focus();

            join_form.cart_c_name.style.borderColor='#F2797C';

            alert ("Introdu numele persoanei juridice!");

        return false;}

        if(join_form.cart_c_cui.value==""){

            join_form.cart_c_cui.focus();

            join_form.cart_c_cui.style.borderColor='#F2797C';

            alert ("Introdu codul unic de inregistrare (codul fiscal)!");

        return false;}

    }


    if (join_form.cart_delpay[2].checked || join_form.cart_delpay[3].checked) {

        if (join_form.cart_IDcounty.value==0) {

            join_form.cart_IDcounty.focus();

            join_form.cart_IDcounty.style.borderColor='#F2797C';

            alert ("Alege judetul pentru livrare!");

            return false;

        }

        if (join_form.cart_IDcity) {

            if (join_form.cart_IDcity.value==0) {

                join_form.cart_IDcity.focus();

                join_form.cart_IDcity.style.borderColor='#F2797C';

                alert ("Alege localitatea pentru livrare!");

                return false;

            }

            if (join_form.cart_IDcity.value==-1 && join_form.cart_other_city.value=="") {

                join_form.cart_other_city.focus();

                join_form.cart_other_city.style.borderColor='#F2797C';

                alert ("Ai ales pentru livrare o localitate care nu este in lista.\nIntrodu numele localitatii pentru livrare!");

                return false;

            }

        }


        if (join_form.cart_address.value=="") {

            join_form.cart_address.focus();

            join_form.cart_address.style.borderColor='#F2797C';

            alert ("Introdu detaliile adresei de livrare - strada, numar, bloc, apartament!");

            return false;

        }

    }


    if ( ((join_form.cart_delpay[2].checked || join_form.cart_delpay[3].checked) && join_form.cart_dia[1].checked) ||  (join_form.cart_delpay[0].checked || join_form.cart_delpay[1].checked)   )  {

        if (join_form.cart_invoice_address.value=="") {

            join_form.cart_invoice_address.focus();

            join_form.cart_invoice_address.style.borderColor='#F2797C';

            alert ("Introdu adresa completa de facturare - judet, localitate, strada, numar, bloc, apartament!");

            return false;

        }

    }

    //return false;

}

function chFormJoin(join_form)
{
	if (join_form.join_email_ok.value==-1 || join_form.join_user_ok.value==-1) {
		join_form.join_submit.focus();
		return false;
	}

    if(join_form.join_name.value=="") {
        join_form.join_name.focus();
        join_form.join_name.style.borderColor='#F2797C';
        alert ("Introdu numele tau!");
        return false;
    }
    
    if(join_form.join_fname.value=="") {
        join_form.join_fname.focus();
        join_form.join_fname.style.borderColor='#F2797C';
        alert ("Introdu prenumele tau!");
        return false;
    }
    
    if(join_form.join_email.value==""){
        join_form.join_email.focus();
        join_form.join_email.style.borderColor='#F2797C';
        alert ("Introdu adresa ta de email!");
    return false;}
    
    if(join_form.join_email.value!=""){
	    if(join_form.join_email.value.length < 6){
            join_form.join_email.focus();
            join_form.join_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(join_form.join_email.value.length > 49){
            join_form.join_email.focus();
            join_form.join_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(join_form.join_email.value))){
            join_form.join_email.focus();
            join_form.join_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}
    
        if(join_form.join_email_ok.value!="1"){
            join_form.join_email.focus();
            join_form.join_email.style.borderColor='#F2797C';
            alert ("Emailul introdus este deja in uz!");
        return false;}

    }

    if(join_form.join_user.value==""){
        join_form.join_user.focus();
        join_form.join_user.style.borderColor='#F2797C';
        alert ("Introdu utilizatorul dorit!");
    return false;}

    //alert(join_form.join_user_ok);
    
    if(join_form.join_user_ok.value!="1"){
        join_form.join_user.focus();
        join_form.join_user.style.borderColor='#F2797C';
        alert ("Utilizatorul dorit nu este disponibil!");
    return false;}

    if(join_form.join_pass.value==""){
        join_form.join_pass.focus();
        join_form.join_pass.style.borderColor='#F2797C';
        alert ("Introdu parola dorita!");
    return false;}

    if(join_form.join_pass2.value==""){
        join_form.join_pass2.focus();
        join_form.join_pass2.style.borderColor='#F2797C';
        alert ("Introdu confirmarea parolei!");
    return false;}

    if(join_form.join_pass.value!=join_form.join_pass2.value){
        join_form.join_pass2.focus();
        join_form.join_pass2.style.borderColor='#F2797C';
        alert ("Parola nu este corect confirmata!");
    return false;}

    if(join_form.join_status.value=="0"){
        join_form.join_status.focus();
        join_form.join_status.style.borderColor='#F2797C';
        alert ("Alege un statut ocupational!");
    return false;}

    if(join_form.join_status.value=="1"){
		if(join_form.join_prof.value==""){
			join_form.join_prof.focus();
			join_form.join_prof.style.borderColor='#F2797C';
			alert ("Introdu ocupatia!");
		return false;}
	}

    if(join_form.join_status.value=="2"){
		if(join_form.join_employer_name.value==""){
			join_form.join_employer_name.focus();
			join_form.join_employer_name.style.borderColor='#F2797C';
			alert ("Introdu denumirea companiei / institutiei / organizatiei!");
		return false;}
	}

    if(join_form.join_status.value=="3"){
		if(join_form.join_org_name.value==""){
			join_form.join_org_name.focus();
			join_form.join_org_name.style.borderColor='#F2797C';
			alert ("Introdu denumirea organizatiei!");
		return false;}
	}

}

    function chFormRecUser(form)
    {
        if(form.recovery_user.value=="") {
            form.recovery_user.focus();
            form.recovery_user.style.borderColor='#F2797C';
            alert ("Introdu numele de utilizator!");
            return false;
        }
   
        if(form.recovery_pass.value==""){
            form.recovery_pass.focus();
            form.recovery_pass.style.borderColor='#F2797C';
            alert ("Introdu parola dorita!");
        return false;}
    
        if(form.recovery_pass2.value==""){
            form.recovery_pass2.focus();
            form.recovery_pass2.style.borderColor='#F2797C';
            alert ("Introdu confirmarea parolei!");
        return false;}

        if(form.recovery_pass.value!=form.recovery_pass2.value){
           form.recovery_pass2.focus();
            form.recovery_pass2.style.borderColor='#F2797C';
            alert ("Parola nu este corect confirmata!");
        return false;}
    }

    function chFormRecEmail(form)
    {
        if(form.recovery_email.value=="") {
            form.recovery_email.focus();
            form.recovery_email.style.borderColor='#F2797C';
            alert ("Introdu adresa de email!");
            return false;
        }

        if(form.recovery_pass.value==""){
            form.recovery_pass.focus();
            form.recovery_pass.style.borderColor='#F2797C';
            alert ("Introdu parola dorita!");
        return false;}
    
        if(form.recovery_pass2.value==""){
            form.recovery_pass2.focus();
            form.recovery_pass2.style.borderColor='#F2797C';
            alert ("Introdu confirmarea parolei!");
        return false;}
 
        if(form.recovery_pass.value!=form.recovery_pass2.value){
            form.recovery_pass2.focus();
            form.recovery_pass2.style.borderColor='#F2797C';
            alert ("Parola nu este corect confirmata!");
        return false;}
    }

function chFormEditPass(pass_form)
{
	
        if(pass_form.old_pass.value==""){
            pass_form.old_pass.focus();
            pass_form.old_pass.style.borderColor='#F2797C';
            alert ("Introdu parola veche!");
        return false;}

        if(pass_form.new_pass.value==""){
            pass_form.new_pass.focus();
            pass_form.new_pass.style.borderColor='#F2797C';
            alert ("Introdu parola noua!");
        return false;}

        if(pass_form.new_pass2.value==""){
            pass_form.new_pass2.focus();
            pass_form.new_pass2.style.borderColor='#F2797C';
            alert ("Introdu confirmarea parolei!");
        return false;}
    
        if(pass_form.new_pass.value!=pass_form.new_pass2.value){
            pass_form.new_pass2.focus();
            pass_form.new_pass2.style.borderColor='#F2797C';
            alert ("Parola nu este corect confirmata!");
        return false;}

}

function estd_open_gb (caption, url) {
	
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

	GB_showCenter(caption,url,myHeight-100,940);
}


// enable/disable <select id="join_prof">
function enableProf(value) {
	var el_1 = document.getElementById('join_prof_tr');
	var el_2 = document.getElementById('join_employer_name_tr');
	var el_3 = document.getElementById('join_org_name_tr');
	el_1.style.display = 'none';
	el_2.style.display = 'none';
	el_3.style.display = 'none';
	switch ( value ) {
		case '1':
			el_1.style.display = 'table-row';
			break;
		case '2':
			el_2.style.display = 'table-row';
			break;
		case '3':
			el_3.style.display = 'table-row';
			document.getElementById('star_mandatory').style.display="";
			break;
		case '4':
			el_3.style.display = 'table-row';
			document.getElementById('star_mandatory').style.display="none";
			break;
	}
}


// check data when manage events
function chEventManage() {
	
	var el = document.getElementById('name');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu denumirea!");
		return false;
	}
	el = document.getElementById('location');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu locatia!");
		return false;
	}
	el = document.getElementById('date_start_d');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza ziua inceput eveniment!");
		return false;
	}
	el = document.getElementById('date_start_m');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza luna inceput eveniment!");
		return false;
	}
	el = document.getElementById('date_start_y');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza anul inceput eveniment!");
		return false;
	}
	el = document.getElementById('time_start_h');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu ora de inceput eveniment!");
		return false;
	}
	el = document.getElementById('time_start_m');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu minutul de inceput eveniment!");
		return false;
	}
	el = document.getElementById('duration');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza durata eveniment!");
		return false;
	}
	
	if (document.getElementById('appl')) {
		if (document.getElementById('appl').checked) {
			el = document.getElementById('date_start_appl_d');
			if (el.value=="" || el.value=="0") {
				el.focus();
				//el.style.borderColor='#F2797C';
				alert ("Selecteaza ziua datei limita de inscriere la eveniment!");
				return false;
			}
			el = document.getElementById('date_start_appl_m');
			if (el.value=="" || el.value=="0") {
				el.focus();
				//el.style.borderColor='#F2797C';
				alert ("Selecteaza luna datei limita de inscriere la eveniment!");
				return false;
			}
			el = document.getElementById('date_start_appl_y');
			if (el.value=="" || el.value=="0") {
				el.focus();
				//el.style.borderColor='#F2797C';
				alert ("Selecteaza anul datei limita de inscriere la eveniment!");
				return false;
			}
			
			el = document.getElementById('places');
			if (!parseInt(el.value)>0) {
				alert('Introdu numarul de locuri la eveniment!');
				return false;
			} 
			
		}
	}
	
	el = document.getElementById('contact_email');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu adresa de email pentru contact!");
		return false;
	}
	
	el = document.getElementById('contact_phone');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu telefonul de contact!");
		return false;
	}

	el = document.getElementById('short_descr');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu descriere eveniment!");
		return false;
	}
}


function chCourseManage() {
	var el = document.getElementById('name');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu denumirea!");
		return false;
	}
	/*
	el = document.getElementById('location');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu locatia!");
		return false;
	}
	*/
	el = document.getElementById('IDdomain');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Alege domeniul cursului!");
		return false;
	}
	el = document.getElementById('date_start_d');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza ziua inceput eveniment!");
		return false;
	}
	el = document.getElementById('date_start_m');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza luna inceput eveniment!");
		return false;
	}
	el = document.getElementById('date_start_y');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza anul inceput eveniment!");
		return false;
	}
	el = document.getElementById('duration');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza durata eveniment!");
		return false;
	}

	/*
	el = document.getElementById('supplier');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu furnizorul!");
		return false;
	}
	*/

	el = document.getElementById('date_start_appl_d');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza ziua datei limita de inscriere la curs!");
		return false;
	}
	el = document.getElementById('date_start_appl_m');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza luna datei limita de inscriere la curs!");
		return false;
	}
	el = document.getElementById('date_start_appl_y');
	if (el.value=="" || el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Selecteaza anul datei limita de inscriere la curs!");
		return false;
	}
	
	/*
	el = document.getElementById('cost');
	if (el.value=="" || el.value==0) {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu costul cursului!");
		return false;
	}
	
	el = document.getElementById('contact_info');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu datele de contact!");
		return false;
	}
	

	el = document.getElementById('short_descr');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu descriere eveniment!");
		return false;
	}
	
	if (document.getElementById('acred_1').checked) {
		el = document.getElementById('acred_det');
		if (el.value=="") {
			el.focus();
			//el.style.borderColor='#F2797C';
			alert ("Introdu detalii despre acreditare!");
			return false;
		}
	}
	*/
}

function chEventAppl() {
	var el;
	var el2;
	var el3;
	var el4;
	var i;
	var okch;
	
	el = document.getElementById('name');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu numele!");
		return false;
	}

	el = document.getElementById('cnp');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu codul numeric personal!");
		return false;
	}

	el = document.getElementById('address');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu adresa!");
		return false;
	}

	el = document.getElementById('phone');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu numarul de telefon!");
		return false;
	}

	el = document.getElementById('email');
	if (el.value=="") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu adresa de email!");
		return false;
	}


	if (!document.getElementById('gender_1').checked && !document.getElementById('gender_2').checked) {
		alert("Alege genul - masculin / feminin!");
		return false;
	}
	
	if (!document.getElementById('nationality_1').checked && !document.getElementById('nationality_2').checked) {
		alert("Alege nationalitatea!");
		return false;
	}
	
	if (document.getElementById('nationality_2').checked && document.getElementById('nationality_det').value=="") {
		document.getElementById('nationality_det').focus();
		alert("Specifica nationalitatea!");
		return false;
	}
	
	el = document.getElementById('age');
	if (el.value=="0") {
		el.focus();
		//el.style.borderColor='#F2797C';
		alert ("Alege intervalul de varsta!");
		return false;
	}

	if (!document.getElementById('residence_1').checked && !document.getElementById('residence_2').checked) {
		alert("Alege mediul de rezidenta - rural/urban!");
		return false;
	}
	
	

	if (!document.getElementById('edu_1').checked && !document.getElementById('edu_2').checked && !document.getElementById('edu_3').checked && !document.getElementById('edu_4').checked && !document.getElementById('edu_5').checked) {
		alert("Alege un nivel de instruire!");
		return false;
	}
	
	el = document.getElementById('edu_1');
	if (el.checked) {
		okch=0;
		for (i=1; i<=4; i++) {
			el2=document.getElementById('edub_'+i);
			//alert (i+' '+el2.checked);
			if (el2.checked) {
				okch=1;	
			}
		}
		if (okch==0) {
			el.focus();
			alert("Alege una din variantele de invatamant superior!");
			return false;
		} 
	}
	
	
	el = document.getElementById('edu_2');
	if (el.checked) {
		okch=0;
		for (i=5; i<=6; i++) {
			el2=document.getElementById('edub_'+i);
			//alert (i+' '+el2.checked);
			if (el2.checked) {
				okch=1;	
			}
		}
		if (okch==0) {
			el.focus();
			alert("Alege una din variantele de invatamant tertiar non-universitar!");
			return false;
		} 
	}

	el = document.getElementById('edu_3');
	if (el.checked) {
		okch=0;
		for (i=7; i<=15; i++) {
			el2=document.getElementById('edub_'+i);
			//alert (i+' '+el2.checked);
			if (el2.checked) {
				okch=1;	
			}
		}
		if (okch==0) {
			el.focus();
			alert("Alege una din variantele de invatamant secundar!");
			return false;
		} 
	}



	if (!document.getElementById('work_1').checked && !document.getElementById('work_2').checked) {
		alert("Alege un statut pe piata muncii!");
		return false;
	}
	
	el = document.getElementById('work_1');
	if (el.checked) {
		okch=0;
		for (i=1; i<=10; i++) {
			el2=document.getElementById('workb_'+i);
			//alert (i+' '+el2.checked);
			if (el2.checked) {
				okch=1;	
			}
		}
		if (okch==0) {
			el.focus();
			alert("Alege una din variantele de persoana activa!");
			return false;
		} else {
			el3=document.getElementById('workb_6'); 
			el4=document.getElementById('workb6_det');
			if (el3.checked && el4.value=="") {
				el4.focus();
				alert("Completeaza campul detalii pentru alta situatie de persoana ocupata!");
				return false;
			}
		}
	}


	el = document.getElementById('work_2');
	if (el.checked) {
		okch=0;
		for (i=11; i<=16; i++) {
			el2=document.getElementById('workb_'+i);
			//alert (i+' '+el2.checked);
			if (el2.checked) {
				okch=1;	
			}
		}
		if (okch==0) {
			el.focus();
			alert("Alege una din variantele de persoana inactiva!");
			return false;
		} else {
			el3=document.getElementById('workb_16'); 
			el4=document.getElementById('workb16_det');
			if (el3.checked && el4.value=="") {
				el4.focus();
				alert("Completeaza campul detalii pentru alta situatie de persoana inactiva!");
				return false;
			}
		}
	} 


	el = document.getElementById('vuln_gr');
	el2 = document.getElementById('vuln_gr_det');
	if (el.value=="100" && el2.value=="") {
		el2.focus();
		//el.style.borderColor='#F2797C';
		alert ("Introdu grupul vulnerabil alternativ!");
		return false;
	}
	



}




function chFormComment(join_form)
{

    if(join_form.c_name.value=="") {
        join_form.c_name.focus();
        join_form.c_name.style.borderColor='#F2797C';
        alert ("Introdu numele tau!");
        return false;
    }
    
    if(join_form.c_email.value==""){
        join_form.c_email.focus();
        join_form.c_email.style.borderColor='#F2797C';
        alert ("Introdu adresa ta de email!");
    return false;}

    if(join_form.c_email.value!=""){
        if(join_form.c_email.value.length < 6){
            join_form.c_email.focus();
            join_form.c_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(join_form.c_email.value.length > 49){
            join_form.c_email.focus();
            join_form.c_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

        if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(join_form.c_email.value))){
            join_form.c_email.focus();
            join_form.c_email.style.borderColor='#F2797C';
            alert ("Adresa de email introdusa nu e valida!");
            return false;}

    }
    
    if(join_form.c_comment.value==""){
        join_form.c_comment.focus();
        join_form.c_comment.style.borderColor='#F2797C';
        alert ("Introdu comentariul dorit!");
    return false;}
	
	if (document.getElementById('c_cp_a')) {
		if(join_form.c_cp_a.value==""){
			join_form.c_cp_a.focus();
			join_form.c_cp_a.style.borderColor='#F2797C';
			alert ("Introdu raspunsul la intrebarea de securitate!");
		return false;}
	}

}



function txt_click(ths, val) {
	if ( ths.value==val ) {
		ths.value = '';
	}
}

function txt_blur(ths, val) {
	if ( ths.value=='' ) {
		ths.value = val;
	}
}


