function send_recomandate(itemId){
    var formId = 'addBook_' + itemId;
    document.forms[formId].submit();
    //window.location.href = "http://www.invata-germana.com/comanda.php";
    //window.location.href = "http://www.indispensabil.com/comanda.php";
}

function send_detalii(itemId){
    var formId = 'addThisBook_' + itemId;
    document.forms[formId].submit();
    //window.location.href = "http://www.invata-germana.com/comanda.php";
    //window.location.href = "http://www.indispensabil.com/comanda.php";
}

function remove_item(itemId){
    var formId = 'removeBook_' + itemId;
    document.forms[formId].submit();
}

function send_book(){
    var formId = 'addOtherBook';
    if(document.getElementById('bookID').value != 0){
        document.forms[formId].submit();
    }
}

function check_card_form(){
    var corect = true;
    var msg = '';
    
    if($("#idFirstName").val() == ''){corect=false; msg+="Nu ati introdus prenumele!\n";}
    if($("#idLastName").val() == ''){corect=false; msg+="Nu ati introdus numele!\n";}
    if($("#billing_country").val() == ''){corect=false; msg+="Nu ati introdus tara!\n";}
    if($("#billing_county").val() == ''){corect=false; msg+="Nu ati introdus judetul/sectorul!\n";}
    if($("#billing_city").val() == ''){corect=false; msg+="Nu ati introdus orasul!\n";}
    if($("#billing_zip_code").val() == ''){corect=false; msg+="Nu ati introdus codul postal!\n";}
    if($("#billing_address").val() == ''){corect=false; msg+="Nu ati introdus adresa!\n";}
    if($("#billing_email").val() == ''){corect=false; msg+="Nu ati introdus adresa de email!\n";}
    else{
        if(checkEmail($("#billing_email").val()) == false){corect=false; msg+="Adresa de email este invalida!\n";}
    }
    if($("#billing_mobile_phone").val() == ''){corect=false; msg+="Nu ati introdus numarul de telefon!\n";}
    
    if(corect == false){
        alert(msg);
    }else{
        $("#frmPaymentRedirect").submit();
    }
}

function checkEmail(emailStr){
	var regex = /^([a-z0-9._-](\+[a-z0-9])*)+@[a-z0-9.-]+\.[a-z]{2,6}$/i;

	if (regex.test(emailStr)) return true;
	else return false;
}
