$(document).ready(function(){
$(".picZoom").colorbox({rel:'picZoom', slideshow:true, slideshowAuto:false,slideshowSpeed:2500});
$.colorbox.resize();
});


function boxLoginClient(){
var frxLG = document.frmLoginClient;
if(frxLG.login_email.value.length < 3 || frxLG.login_email.value.indexOf('@') < 1 || frxLG.login_email.value.indexOf('.') < 1){ alert('Login - Adresa Email !'); frxLG.login_email.focus(); return false; }
if(frxLG.login_pass.value.length < 4){  alert('Login - Parola !'); frxLG.login_pass.focus(); return false; }
$.post("./login_client.php",{e:frxLG.login_email.value,p:frxLG.login_pass.value},function(data){
$.colorbox({html:data,width:'400px',scrolling:false,title:'LOGIN CLIENT'});
setTimeout(hide_mesaj,5000);
return false;
});
return false;
}


function AboNL(xEmail){
if(xEmail.length < 3 || xEmail.indexOf('@') < 1 || xEmail.indexOf('.') < 1){
alert('Introduce-ti adresa de email corecta !'); return false;	
} else {
$.post("./abonare2newsletter.php",{email:xEmail},function(data){
alert(data);
window.location.reload();
return false;	
});
}
}

function hide_mesaj(){
$.colorbox.close();
window.location.reload(); 
}

function adauga2cos(idp,np){
$.post("./adauga2cos.php",{id:idp,n:np},function(data){
$.colorbox({html:"<br><center><h2>Produsul <font color='#006699'>"+np+"</font><br>a fost adaugat in cos !</h2><div><a href='./cosul-meu/' style='text-decoration:none;color:#aa0000;font-size:12px;'><b>Vezi - Cosul Meu</b></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:void(0);/' onclick='window.location.reload();' style='text-decoration:none;color:#aa0000;font-size:12px;'><b>Inchide fereastra</b></a></div></center><br><br>",width:'600px',scrolling:false,title:'ADAUGARE PRODUS IN COSUL MEU'});
setTimeout(hide_mesaj,5000);										  
});
}

function isNumberKey(evt){
 var charCode = ((evt.which) ? evt.which : event.keyCode);
 if (charCode > 31 && (charCode < 48 || charCode > 57)){ 
 	return false; 
 } else { 
    return true; 
 }
}

function UpdateCantCos(xID){
var xCant = $("#cant_"+xID).val();
$.post("./operatii2cos.php",{op:'update',id:xID,buc:xCant},function(data){
window.location.reload();									  
});	
}

function StergeDinCos(xID){
$.post("./operatii2cos.php",{op:'delete',id:xID},function(data){
window.location.reload();									  
});	
}

function CurataTotCosul(){
$.post("./operatii2cos.php",{op:'clearAll'},function(data){
window.location.href='./';									  
});	
}
