// JavaScript Document

function Init() {
	// Inizializzazione di procedure diverse
	
	// Bordi stondati
    $(".imgThumb a").corner("round 10px");

    // Orologio in tempo reale
	// PrintTime();
	
	// Dichiarazione delle finestre di Dialogo
	$("#Dialog").dialog({
        autoOpen: false,
        modal:true
    });
	$("#DialogIFrame").dialog({
        width: 630,
        autoOpen: false,
        modal:true
    });

}

function FormValidator(frm) {
    
    var msg = '';
    
    if (frm.page_type) {
        
        if (frm.page_type.value == 'general_contact') {
            if (frm.nome.value == '') {
                msg = GetText('msg_specificare_nome')
                frm.nome.focus();
            }
        
            if (frm.cognome.value == '' && msg =='') {
                msg = GetText('msg_specificare_cognome')
                frm.cognome.focus();
            }
        
            if (frm.telefono.value == '' && frm.email.value == '' && msg =='') {
                msg = GetText('msg_specificare_email')
                frm.telefono.focus();
            }

            if (frm.privacy.checked == false && msg =='') {
                msg = GetText('msg_autorizzare_privacy')
            }

        }

        if (frm.page_type.value == 'sent_to_friend') {
            if (frm.nomefrom.value == '') {
                msg = GetText('msg_specificare_tuo_nome')
                frm.nomefrom.focus();
            }
        
            if (frm.emailfrom.value == '' && msg =='') {
                msg = GetText('msg_specificare_tua_email')
                frm.emailfrom.focus();
            }
        
            if (frm.nometo.value == '' && msg =='') {
                msg = GetText('msg_specificare_nome_amico')
                frm.nometo.focus();
            }
        
            if (frm.emailto.value == '' && msg =='') {
                msg = GetText('msg_specificare_email_amico')
                frm.emailto.focus();
            }
        
            if (frm.privacy.checked == false && msg =='') {
                msg = GetText('msg_autorizzare_privacy')
            }

        }
        
        if (msg == '') {
            return true;
        } else {
            alert(msg);
            return false;
        }
            
    } else {
        return false;
        
    }

}

function chkUsernameBox(Mode, txtBox, string) {
    if (Mode == 1) {
        if (txtBox.value == string) { txtBox.value = ''; }        
    }
    if (Mode == 2) {
        if (txtBox.value == '') { txtBox.value = string; }
    }
}

