function afisez2(element) 
{
	sir=element.value;
	pos=sir.indexOf("#");
	txt_ron=sir.substr(0,pos);	
	nr_price=sir.substr(pos+1);
	document.getElementById('ron').innerHTML = txt_ron+" Lei";
	document.form1.nr_price.value = nr_price;
}

function afisez3(element, nr) {
    hex = element.value;
    document.getElementById('camera'+nr).bgColor=hex;
    hex = hex.substr(1);
    test = hex.substr(0,1)
    if (test>"c") culoare="negru"; else culoare="alb";	
	test = '<a href="#" onclick="w_h=window.open(\'./sticker_culoare.php?c=' + hex + '\',\'culoare\',\'resizable=1,location=0,status=0,menubar=0,toolbar=0,scrollbars=1,top=150,left=150,width=420,height=420\'); if (window.focus) {w_h.focus()}; return false;" class="' + culoare + '">click pentru test culoare</a>';
    document.getElementById('linc'+nr).innerHTML = test;
}

function reset_input(df_val,obj,header)
{
	if(typeof(header)!='undefined')
	{
		if($(obj).val()=="")
		{
			$(obj).css({"font-weight":"bold","color":"#9E9E9F"});
		}
		else
		{
			$(obj).css({"font-weight":"normal","color":"#000"});
		}
	}

	val=$(obj).val();
	
	if(df_val==val)
	{
		$(obj).val("");
	}

	if(val=='')
	{
		$(obj).val(df_val);
	}
}


function submit_form(frm_id){
    var message_nl = '';
    err = '';
    if ($('#box_nl_name').val() == 1 && ($('#fn_name').val() == '' || $('#fn_name').val() == 'nume...'))
        err += 'Nu ati completat numele!<br/>';
    
    if ($('#fn_email').val() == '' || $('#fn_email').val() == 'email...')
        err += 'Nu ati completat adresa de email!';
        
    if (err == '')
    {
        params = $('#' + frm_id).serialize();
        $.ajax({
            type: "POST",
            url: "/ajax_newsletter",
            data: params,
            success: function(response){
                if(response != ''){
                    $('#fn_email').val('email...');
                    $('#fn_name').val('nume...');
                    $("#message_nl").html(response); 
                }
            }
        });
    }
    else
    {
       $("#message_nl").html(err); 
    } 
    return false;
}
