function show_starwars(){ window.setInterval(function() { goindex() }, 20000); window.location.href="starwars.php"; } function page_counter(email,page,width){ if(email===undefined){ email="new user"; } $.post("page_counter.php?email="+email+"&page="+page+"&width="+width, function(data) { }); } function lasttwodigitsInt(dig){ dig=dig.toString(); dig1=(parseInt(dig)+100).toString(); res=dig1.substring(1); return res; } function handleTouchStart(evt) { xDown = evt.touches[0].clientX; yDown = evt.touches[0].clientY; }; function handleTouchMove(evt) { if ( ! xDown || ! yDown ) { return; } var xUp = evt.touches[0].clientX; var yUp = evt.touches[0].clientY; var xDiff = xDown - xUp; var yDiff = yDown - yUp; if(Math.abs( xDiff )+Math.abs( yDiff )>150){ //to deal with to short swipes if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {/*most significant*/ if ( xDiff > 0 ) {/* left swipe */ swipe('l'); } else {/* right swipe */ swipe('r'); } } else { if ( yDiff > 0 ) {/* up swipe */ swipe('u'); } else { /* down swipe */ swipe('d'); } } /* reset values */ xDown = null; yDown = null; } }; function logoff(){ // alert(window.email); var txt="You want to logoff? ("+window.useremail+")"; var r = confirm(txt); if (r == true) { // alert(window.useremail); //var n = window.email.search("@"); //if (n > 0) { eraseCookie('username'); eraseCookie('useremail'); //} window.loggedin="no"; window.location.href="index.php"; } else { } } function setdates(date1, wtd, delta,endPicker) { window.echo=getCookie("echo"); if (window.echo==undefined){ window.echo='y'; } setCookie("fdat3", document.getElementById("fdat3").value); y1 = date1.substr(0, 4); m1 = date1.substr(5, 2); d1 = parseInt(date1.substr(8, 2)); wtd = getCookie("whattodo"); if (delta!=0){ if (wtd=='q'){ delta=delta*3; } km=parseInt(m1)+delta; kmm=km+100; kmm=kmm.toString(); m1=kmm.substr(1); if (km<=0){ ky=parseInt(y1)-1; y1=ky.toString(); km=12; m1="12"; } if (km>=13 ){ ky=parseInt(y1)+1; y1=ky.toString(); m1="01"; } delta=0; document.getElementById("fdat3").value=y1+"-"+m1+"-"+d1; } if (wtd == undefined) { wtd = 'w'; } if (wtd == 'p') { document.getElementById("aantalw").style.visibility = "visible"; } else { document.getElementById("aantalw").style.visibility = "hidden"; } if (wtd == 'w') { theweek = renderWeek(d1, m1 - 1, y1); thew = theweek; thew = thew + (delta * 1); if (thew == 0) { thew = 52; y1 = "" + (parseInt(y1) - 1); } if (thew == 53) { thew = 1; y1 = "" + (parseInt(y1) + 1); } theweek = thew; theday = getDateOfISOWeek(thew, y1); theday = moment(theday).format("YYYY-MM-DD"); document.getElementById("fdat4").value = "Week:" + theweek; document.getElementById("fdat3").value = theday; document.getElementById("fdat2").value = thew; prevy = parseInt(y1) - 1; theprevweek = getDateOfISOWeek(thew, prevy); theprevday = moment(theprevweek).format("YYYY-MM-DD"); document.getElementById("fdat1").value = theprevday; } if (wtd == 'p') { theweek = renderWeek(d1, m1 - 1, y1); thew = theweek; thew = thew + (delta * 1); if (thew == 0) { thew = 52; y1 = "" + (parseInt(y1) - 1); } if (thew == 53) { thew = 1; y1 = "" + (parseInt(y1) + 1); } theweek = thew; theday = getDateOfISOWeek(thew, y1); theday = moment(theday).format("YYYY-MM-DD"); document.getElementById("fdat4").value = "Week:" + theweek; document.getElementById("fdat3").value = theday; document.getElementById("fdat2").value = thew; prevy = parseInt(y1) - 1; theprevweek = getDateOfISOWeek(thew, prevy); theprevday = moment(theprevweek).format("YYYY-MM-DD"); document.getElementById("fdat1").value = theprevday; } if (wtd == 'm' || wtd=='r') { mm1 = parseInt(m1); mm1 = mm1 + (delta * 1); mm1 = ("" + (100 + mm1)).substr(1); theoldday = (parseInt(y1) - 1) + "-" + mm1 + "-01"; document.getElementById("fdat1").value = theoldday; theday = y1 + "-" + mm1 + "-01"; document.getElementById("fdat3").value = theday; document.getElementById("fdat4").value = "Maand:" + mm1; } if (wtd == 'q') { if (m1>0 && m1<4) { document.getElementById("fdat3").value = y1+"-01-01"; document.getElementById("fdat4").value = "Kwart: 1"; } if (m1>3 && m1<7) { document.getElementById("fdat3").value = y1+"-04-01"; document.getElementById("fdat4").value = "Kwart: 2"; } if (m1>6 && m1<10) { document.getElementById("fdat3").value = y1+"-07-01"; document.getElementById("fdat4").value = "Kwart: 3"; } if (m1>9 && m1<13) { document.getElementById("fdat3").value = y1+"-10-01"; document.getElementById("fdat4").value = "Kwart: 4"; } } if (wtd == 'd') { theday = moment(date1).format("YYYY-MM-DD"); document.getElementById("fdat3").value = theday; document.getElementById("fdat4").value = "Dag:" + d1; } www = document.getElementById("fdat1").value; setCookie("fdat3", document.getElementById("fdat3").value); setCookie("fdat4", document.getElementById("fdat4").value); setCookie("fdat1", document.getElementById("fdat1").value); setCookie("fdat2", document.getElementById("fdat2").value); } function renderWeek(d, m, y) { // Lifted from http://javascript.about.com/library/blweekyear.htm, lightly modified. var onejan = new Date(y, 0, 1), weekNum = Math.ceil((((new Date(y, m, d) - onejan) / 86400000) + onejan.getDay() + 1) / 7); return weekNum; } function getDateOfWeek(w, y) { var d = (1 + (w - 1) * 7); // 1st of January + 7 days for each week return new Date(y, 0, d); } function addzero(num) { numb = "" + (100 + num); return (numb.substr(1)); } function addzero2d(num) { numb = "" + (100 + num); return (numb.substr(1)); } //week=15 dayofweek=Mon Apr 10 2017 00:00:00 GMT+0200 (W. Europe Summer Time) function addDays(date, days) { var result = new Date(date); result.setDate(result.getDate() + days); var dd = result.getDate(); dd = addzero2d(dd); var mm = result.getMonth() + 1; mm = addzero2d(mm); var y = result.getFullYear(); var result1 = y + '-' + mm + '-' + dd; return result1; } function collectdatakw(whattodo) { $("#pr").val("0"); document.getElementById("progres").style.display = "block"; addition = document.getElementById("condfield").value; if (addition == "") {} else { addition = addition.replace('TSnum', 'and substr(_ApprovalID,1,11)'); addition = addition.replace('Vanaf=', 'and _from>='); addition = addition.replace('Tot=', 'and _till<'); addition = addition.replace('Stad=', 'and city='); } addition = addition + ";" if (whattodo == 'm') { freq = 18; } if (whattodo == 'q') { freq = 12; } if (whattodo == 'w') { freq = 35; } progrss(); if (whattodo == 'w') { nus = document.getElementById("fdat3").value; //datum nu theweek = document.getElementById("fdat2").value; // we stored the week here nus1 = new Date(nus); nue = new Date(nus1.setDate(nus1.getDate() + 7)); d = document.getElementById("fdat4").value; //datum nu setCookie("weeknu", d); toens = document.getElementById("fdat1").value; //datum toe toens1 = new Date(toens); toene = new Date(toens1.setDate(toens1.getDate() + 7)); setCookie('toen', d); var Start_myDate = new Date(nue); nue = Start_myDate.getFullYear() + "-" + Start_myDate.getMonth() + 1 + "-" + Start_myDate.getDate(); var Start_myDate = new Date(toene); toene = Start_myDate.getFullYear() + "-" + Start_myDate.getMonth() + 1 + "-" + Start_myDate.getDate(); document.title = 'Vergelijk week ' + nus + ' met jaar geleden'; } if (whattodo == 'm') { nus = document.getElementById("fdat3").value; //datum nu nue = nus.substr(0, 7) + "-32"; toens = '2016-' + nus.substr(5); toene = toens.substr(0, 7) + "-32"; document.title = 'Vergelijk maand ' + nus + ' met jaar geleden'; theweek = "mnd 1"; } if (whattodo == 'q') { nus = document.getElementById("fdat3").value; //datum nu mn = parseInt(nus.substr(5, 2)) + 2; nue = nus.substr(0, 4) + "-" + mn + "-32"; toens = '2016-' + nus.substr(5); toene = toens.substr(0, 4) + "-" + mn + "-32"; document.title = 'Vergelijk kwartaal ' + nus + ' met jaar geleden'; theweek = "mnd 1"; } $params = "gettable1.php?nus=" + nus + "&nue=" + nue + "&toens=" + toens + "&toene=" + toene + "&wtd=" + whattodo + "&week=" + theweek + "&addition=" + addition; $params = $params + "&soort==0&city=<>'we'"; $.post($params, function(data) { document.getElementById("progres").style.display = "none"; Overall = data.split("&&"); kanww = Overall[1]; arr1 = initx(1); arr2 = initx(3); arr3 = initx(5); arr4 = initx(7); arr5 = initx(9); arr6 = initx(11); arr7 = initx(13); arr8 = initx(15); arr9 = initx(17); arra = initx(19); arrb = initx(21); arrc = initx(23); }); } function initx(index) { ll = Overall[index - 1].length; if (ll == 2) { return (index); } var x = new Array(0); for (var i = 0; i < 1; i++) { x[i] = new Array(15); } datb = Overall[index].split("||"); x[0] = datb[0].split(" , "); x[1] = datb[1].split(" , "); x[2] = datb[2].split(" , "); x[3] = maketotal(x); unhide = Overall[index - 1].substr(0, ll - 1) + "V"; document.getElementById(unhide).style.display = "block"; readit1(x, '#' + Overall[index - 1]); return (x); } function maketotal(x) { x[3] = Array(); for (var i = 0; i < 18; i++) { x[3].push(""); } x[3][0] = "Totaal"; x[3][1] = ""; x[3][2] = ""; x[3][3] = ""; x[3][4] = parseInt(x[0][4]) + parseInt(x[1][4]) + parseInt(x[2][4]); x[3][5] = parseInt(x[0][5]) + parseInt(x[1][5]) + parseInt(x[2][5]); x[3][13] = parseInt(x[0][13]) + parseInt(x[1][13]) + parseInt(x[2][13]); x[3][10] = parseInt(x[0][10]) + parseInt(x[1][10]) + parseInt(x[2][10]); x[3][14] = parseInt(x[0][14]) + parseInt(x[1][14]) + parseInt(x[2][14]); x[3][15] = parseInt(x[0][15]) + parseInt(x[1][15]) + parseInt(x[2][15]); x[3][16] = parseInt(x[0][16]) + parseInt(x[1][16]) + parseInt(x[2][16]); x[3][6] = parseFloat((parseInt(x[3][5]) / parseInt(x[3][4])) * 100).toFixed(2); // x[3][7]=parseFloat((parseInt(x[3][8])/parseInt(x[3][4]))*100).toFixed(2); // x[3][10]=parseInt(x[3][4])-parseInt(x[3][5]); return (x[3]); } function initx_y(x, index) { //for totals x-y datb = Overall[index].split("||"); readit1(x, '#' + Overall[index - 1]); } function readit1(a, b) { whattodisplay = document.getElementById('fdat4').value.substr(0, 5); $(document).ready(function() { $(b).DataTable({ "responsive": true, "bSort": false, "paging": false, "info": false, "autoWidth": false, "searching": false, "bDestroy": true, data: a, columns: [{ title: "Jaar" }, { title: whattodisplay }, { title: "Soort" }, { title: "Mach #" }, { title: "Tot In", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "Tot Out", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "Out/ In %" }, { title: "Win/ Bet %" }, { title: "Tot Play", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "Tot Win %", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "Over", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "Bez Gr %", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "Hand Pays", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "Count", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "Fill", render: $.fn.dataTable.render.number(',', '.', 2, '') }, { title: "JP Hits" }, { title: "JP Totaal", render: $.fn.dataTable.render.number(',', '.', 2, '') }, ], "columnDefs": [ { "className": "dt-right", "targets": [0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] }, { "className": "dt-center", "targets": [0, 1, 3] }, { "className": "[-head|-body]-center", "targets": [6, 7, 9] }, { "width": "4%", "targets": [0, 1] }, { "width": "10%", "targets": [4, 5, 8, 12, 14, 16] }, { "visible": true, "targets": [10, 12] }, { targets: [6, 7], createdCell: function(td, cellData, rowData, row, col) { $(td).css('color', 'orange'); if (cellData < 70) { $(td).css('color', 'darkgreen'); } if (cellData > 80) { $(td).css('color', 'red'); } } } ] }); var table = $(b).DataTable(); c = b + ' tbody'; $(b).off('click.rowClick').on('click.rowClick', 'td', function() { }); }); } function dashboard() { document.location.href = 'index.php'; } function doweek() { $('#startlabel').text("Week 1:"); $('#endlabel').text("Week 2:"); document.getElementById("gobut1").style.backgroundColor = "lightgreen"; document.getElementById("gobut2").style.backgroundColor = "ivory"; document.getElementById("gobut3").style.backgroundColor = "ivory"; window.whattodo = "w"; } function domaand() { $('#startlabel').text("Maand 1:"); $('#endlabel').text("Maand 2:"); document.getElementById("gobut1").style.backgroundColor = "ivory"; document.getElementById("gobut2").style.backgroundColor = "lightgreen"; document.getElementById("gobut3").style.backgroundColor = "ivory"; window.whattodo = "m"; } function doflex() { window.flexclicks++; $('#startlabel').text("Periode start:"); $('#endlabel').text("Periode end:"); document.getElementById("gobut1").style.backgroundColor = "ivory"; document.getElementById("gobut2").style.backgroundColor = "ivory"; document.getElementById("gobut3").style.backgroundColor = "lightgreen"; window.whattodo = "p"; } function getDateOfISOWeek(w, y) { var simple = new Date(y, 0, 1 + (w - 1) * 7); var dow = simple.getDay(); var ISOweekStart = simple; ISOweekStart.setDate(simple.getDate() - simple.getDay() + 1); return ISOweekStart; } function progrss() { $(document).ready(function() { var interval = 2, //How much to increase the progressbar per frame updatesPerSecond = 1000 / 18, //Set the nr of updates per second (fps) progress = $('progress'), animator = function() { progress.val(progress.val() + interval); //$('#val').text(progress.val()); if (progress.val() + interval < progress.attr('max')) { setTimeout(animator, updatesPerSecond); } else { //$('#val').text('Done'); progress.val(progress.attr('max')); } } setTimeout(animator, updatesPerSecond); }); } function setCookiexxx(c_name, value) {} function setCookie(c_name, value){ /* exdays = 7; var exdate = new Date(); exdate.setDate(exdate.getDate() + 7); var c_value = escape(value) + ((exdays == null) ? "" : ("; expires=" + exdate.toUTCString())); document.cookie = c_name + "=" + c_value; */ var today = new Date(); today.setHours(today.getMinutes() + 60); var c_value = escape(value) + ((today == null) ? "" : ("; expires=" + today.toUTCString())); document.cookie = c_name + "=" + c_value; } function setCookiesxxx(c_name,value) {} function setCookies(c_name,value) { var today = new Date(); today.setHours(today.getMinutes() + 60); var c_value = escape(value) + ((today == null) ? "" : ("; expires=" + today.toUTCString())); document.cookie = c_name + "=" + c_value; } function getCookie(c_name) { var i, x, y, ARRcookies = document.cookie.split(";"); for (i = 0; i < ARRcookies.length; i++) { x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")); y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1); x = x.replace(/^\s+|\s+$/g, ""); if (x == c_name) { return unescape(y); } } } function eraseCookie(c_name) { document.cookie = c_name+'=; Max-Age=-99999999;'; } function printDiv(divName) { //alert(divName); var printContents ="a"; var printContents = document.getElementById(divName).innerHTML; var originalContents = document.body.innerHTML; document.body.innerHTML = printContents; window.print(); document.body.innerHTML = originalContents; } function GetURLParameter(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } function htmlload(caller){ un=getCookie("un"); setCookies("un",un); eigenaar=getCookie("eigenaar"); content="html_templates\\casdemo\\"+caller; switch (eigenaar){ case 'cas': content="html_templates\\casdemo\\"+caller; break; case 'merkur': content="html_templates\\merkur\\"+caller; break; } // alert('in htmlload'); } function SetSessionVar(session_name,session_value) { } function GetSessionVar(session_name) { json=""; $.post("getsession.php?nam="+session_name, function(json) { return(json); }); }