var oTable;
function fnFormatDetails ( nTr ) {
var aData = oTable.fnGetData( nTr );
var sOut = '
';
sOut += 'Recapiti: | Fisso - Mobile |
';
sOut += '
';
return sOut;
}
function RefreshTable(tableId, urlData) {
$.getJSON(urlData, null, function( json ) {
table = $(tableId).dataTable();
oSettings = table.fnSettings();
table.fnClearTable(this);
for (var i=0; i 0) {
oTable = $('#dt_users').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "res/data/dt_users.php",
"aoColumns": [
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false },
{ "sClass": "center", "bSortable": false},
{ "sClass": "center", "bSortable": false }
]
} );
$('#dt_users tbody td img').live( 'click', function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_close') )
{
/* This row is already open - close it */
this.src = "res/img/datatables/details_open.png";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "res/img/datatables/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
//AutoReload
setTimeout(function(){ AutoReload('#dt_users', 'res/data/dt_users.php'); }, 30000);
}
//Uniform
//$("input:checkbox, input:text, input:file, input:number, textarea, button").not(".disabled").uniform();
//$("select").not(".disabled").uniform();
$("input:file").not(".disabled").uniform();
$("input:checkbox").not(".disabled").uniform();
//Toggle input value
swapValue = [];
$(".togglekey").each(function(i){
swapValue[i] = $(this).val();
$(this).focus(function(){
if ($(this).val() == swapValue[i]) {
$(this).val("");
}
$(this).addClass("focus");
}).blur(function(){
if ($.trim($(this).val()) == "") {
$(this).val(swapValue[i]);
$(this).removeClass("focus");
}
});
});
//Fadeimg
$(".pimg").fadeTo("slow", 1.0); //Opacity on load
$(".pimg").hover(
function(){ $(this).fadeTo("fast", 0.45); }, //Opacity on hover
function(){ $(this).fadeTo("fast", 1.0); //Opacity on mouseout
});
//FadeDiv
$(".pdiv").fadeTo("slow", 1.0); //Opacity on load
$(".pdiv").hover(
function(){ $(this).fadeTo("fast", 0.80); }, //Opacity on hover
function(){ $(this).fadeTo("fast", 1.0); //Opacity on mouseout
});
//DivHover
if ($("#account").length > 0) {
width = ($("#account").width()) - 40;
lmargin = (960 - width) - 40;
$("#account").hover(
function(){ $(this).css({"background":"#069", "cursor":"pointer"}); $("#mnaccount").css({"display":"block","width":width,"margin-left":lmargin}); },
function(){ $(this).css({"background":"#134F7B"}); $("#mnaccount").css({"display":"none"});
});
$("#mnaccount").hover(
function(){ $(this).css({"display":"block"}); $("#account").css({"background":"#069", "cursor":"pointer"}); },
function(){ $(this).css({"display":"none"}); $("#account").css({"background":"#134F7B"});
});
$("#account").click(function(){ window.location=$(this).find("a").attr("href"); return false; });
}
if ($(".tbl").length > 0) {
$(".tbl tr").hover(
function(){ $(this).css({"background":"#f5f5f5"}); },
function(){ $(this).css({"background":"transparent"});
});
}
if ($(".rightel").length > 0) {
$(".rightel p").hover(
function(){ $(this).css({"background":"#f5f5f5"}); },
function(){ $(this).css({"background":"transparent"});
});
}
if ($(".divh").length > 0) {
$(".divh").hover(
function(){ $(this).css({"background":"#eee"}); },
function(){ $(this).css({"background":"transparent"});
});
}
//Toggle
if ($("h2").length > 0) { $("h2").toggle( function () { $(this).css({"display":"block"}); }); }
//Notice
if ($(".notice").length > 0) { $('.notice').fadeIn().delay(4000).slideUp('slow'); }
//Validate Form
if( $("#contact_form").length > 0) {
$("#contact_form").click(function() {
if ($("#nome").val() == "") { $(".lnome").addClass('error_red'); $("#nome").focus(); return false; } else { $(".lnome").removeClass('error_red'); }
if ($("#cognome").val() == "") { $(".lcognome").addClass('error_red'); $("#cognome").focus(); return false; } else { $(".lcognome").removeClass('error_red'); }
if ($("#email").val() == "") { $(".lemail").addClass('error_red'); $("#email").focus(); return false; } else { $(".lemail").removeClass('error_red'); }
if ($("#telefono").val() == "") { $(".ltel").addClass('error_red'); $("#telefono").focus(); return false; } else { $(".ltel").removeClass('error_red'); }
if ($("#ogg").val() == "") { $(".logg").addClass('error_red'); $("#ogg").focus(); return false; } else { $(".logg").removeClass('error_red'); }
if ($("#mess").val() == "") { $(".lmess").addClass('error_red'); $("#mess").focus(); return false; } else { $(".lmess").removeClass('error_red'); }
if ($("#scode").val() == "") { $(".lscode").addClass('error_red'); $("#scode").focus(); return false; } else { $(".lscode").removeClass('error_red'); }
return true;
});
}
//ClickableDiv
/*
if ($(".ciliege").length > 0) {
$(".ciliege").click(function(){
var url = $(this).find("a").attr("href");
Shadowbox.open({player:'iframe', title:'Video', content:url, width:'485', height:'390'});
//window.location=$(this).find("a").attr("href");
return false;
});
}
*/
//Tooltips
if ($(".tiptip").length > 0) { $(".tiptip").tipTip({edgeOffset: 5, defaultPosition: "top", delay: 0, fadeIn: 0, maxWidth: "400px"}); }
});
//ShadowBox
Shadowbox.init({
skipSetup: false,
overlayColor: '#333333',
overlayOpacity: '0.8',
language: 'it',
players: ['img', 'html', 'iframe', 'gdoc']
});
//Only Numbers
if ($(".onlynum").length > 0) {
$(".onlynum").keydown(function (event) {
if (event.shiftKey == true) {
event.preventDefault();
}
var ctrlDown = false,
ctrlKey = 17,
cmdKey = 91,
vKey = 86,
cKey = 67;
if ( (event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) || event.keyCode == 8 || event.keyCode == 9 ||
event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 46 || event.keyCode == 188 ||
( event.keyCode == vKey || event.keyCode == cKey ) ) {
} else {
event.preventDefault();
}
if($(this).val().indexOf('.') !== -1 && event.keyCode == 188) event.preventDefault();
});
}
/**/
//Spinner
$(document).ready(function() {
$("a").click(function(e){
var url = $(this).attr("href");
var ur = (typeof url !== typeof undefined && url !== false) ? 1 : 0;
var rel = $(this).attr("rel");
var rl = (typeof rel !== typeof undefined && rel !== false) ? 1 : 0;
var target = $(this).attr("target");
var trg = (typeof target !== typeof undefined && target !== false) ? 1 : 0;
if ( (!url.includes("#")) && (!url.includes("void")) && (!url.includes("download")) && (!url.includes("docs")) && (ur == 1) && (rl == 0) && (trg == 0) ) {
e.preventDefault();
$("#spinner").show();
setTimeout(function(){ location.href = url; }, 300);
}
});
//Search on press Enter
$(document).on('keypress',function(e) {
if(e.which == 13) {
var srch = 0
$(".small").each(function() {
srch = 1
if ($(this).val() != "") $(this).blur()
})
if (srch == 1) {
setTimeout(function() {
document.contractsearch.submit();
}, 300)
}
}
});
});
/**/