// JavaScript Document

var exp_emailtxt = /^[_0-9a-z\-\.]+$/;
var exp_email = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var exp_num = /^\d+$/;
var exp_phone = /^[\d]{6,}$/;
var exp_addr = /^(.){6,}$/;
//var exp_pwd = /^.*(?=.{6,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$/;
var exp_pwd = /^[_0-9a-zA-Z\-\.@#$%\^&\+=]{6,}$/;

/*function check_empty(arr_inputs) {
    var notfilled = 0;
    for (i=0; i<arr_inputs.length; i++ ) {
        if (arr_inputs[i].value == '') {
            notfilled++;
        }
    }

    return notfilled;
}*/

function check_empty(arr_inputs) {
    var notfilled = Array();
    for (i=0; i<arr_inputs.length; i++ ) {
        if ($(arr_inputs[i]).attr('type') == 'checkbox') {
            if (arr_inputs[i].checked == false) {
                //notfilled++;
                notfilled[notfilled.length] = arr_inputs[i].id;
			}
		} else if (arr_inputs[i].value == '') {
            notfilled[notfilled.length] = arr_inputs[i].id;
        }
    }

    return notfilled;
}

function callAjax(phpstring, callback) {
    $.ajax({
        type: "POST",
        url: "aj_dialer.php",
        dataType: 'json',
        data: phpstring,
        //Evento di riuscita
        success: callback
    });
}

function getScreenSize() {
    var myWidth = 0, myHeight = 0;
    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;
    }
    /*window.alert( 'Width = ' + myWidth );
    window.alert( 'Height = ' + myHeight );*/

    ret = new Object();
    ret.w = myWidth;
    ret.h = myHeight;

    return ret;
}



