/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function talvegadaIdentificacio(xhr, status, args) {
    if(args.identificacio){
        if(!jQuery('#dlgIdentificacio').dialog('isOpen')){
            dlgIdenficiacio.hide();}
        alert("borram 2");
        dlgIdenficacio.show();
        alert("borram 3");
    }
}

/*
 * Mostra el dialeg corresponen al cistell només si no està buit
 */
function talvegadaMostrarCistell(xhr, status, args) {
    if(args.mostrarCistell){
        //jQuery('#dlgCistell').dialog("option","position",'center');
        dlgCistell.show();        
    }
}

/*function talvegaFaltaTallaColor(xhr, status, args) {
    if(args.errorFound) {
        dlgIndicarColorTalla.show();
        jQuery('#dlgIndicarColorTalla').effect('shake', {
            times:3
        }, 100);

    } 
}*/

function test(){

    dlgCistell.show();
//jQuery('#dlgCistell').dialog('option','position',[100,100]);

}

function popup(mylink, windowname)
{
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
        href=mylink;
    else
        href=mylink.href;
    window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
    return false;
}

function handleIdentificacio(xhr, status, args) {
    if(args.validationFailed || args.errorFound) {
        jQuery('#dlgIdentificacio').effect("shake", {
            times:3
        }, 100);
    } else {
        dlgIdentificacio.hide();
    }
}

function handleSolicitarContrasenya(xhr, status, args) {
    if(args.validationFailed || args.errorFound) {
        jQuery('#dlgSolicitarContrasenya').effect("shake", {
            times:3
        }, 100);
    } else {
        dlgSolicitarContrasenya.hide();
    }
}

function handleCrearCompte(xhr, status, args) {
    if(args.validationFailed || args.errorFound) {
        jQuery('#dlgCrearCompte').effect("shake", {
            times:3
        }, 100);
    } else {
        dlgCrearCompte.hide();
    }
}

function handleAdreca(xhr, status, args) {
    if(args.validationFailed || args.errorFound) {
        jQuery('#dlgAdreca').effect("shake", {
            times:3
        }, 100);
    } else {
        dlgAdreca.hide();
    }
}

function handleDadesAcces(xhr, status, args) {
    if(args.validationFailed || args.errorFound) {
        jQuery('#dlgDadesAcces').effect("shake", {
            times:3
        }, 100);
    } else {
        dlgDadesAcces.hide();
    }
}

