function createRequestObject() { var xmlHttp; /* if (navigator.appName == "Microsoft Internet Explorer") { ro = new ActiveXObject("Microsoft.XMLHTTP"); } else { ro = new XMLHttpRequest(); } return ro; */ try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } return xmlHttp; } function syncTime(){ try{ httpclock.open('get', 'https://www.dreamcarclub.nl/chatbox/interface.php?action=setonline'); httpclock.onreadystatechange = handleSyncResponse; httpclock.send(null); }catch(e){ } now = new Date(); //alert(now-load); if(now - load > ((600)*1000)){ if(!firsttime){ firsttime = true; document.getElementById('chatstatus').innerHTML = "Offline"; } }else{ window.setTimeout('syncTime();', 15050); } } function setUserOnline(){ firsttime = false; load = new Date(); syncTime(); document.getElementById('chatstatus').innerHTML = "Online"; } function handleSyncResponse(){ if (httpclock.readyState == 4) { thisTime = parseInt(httpclock.responseText); isSynced = true; } } function checkInvite(){ try{ httpinv.open('get', 'https://www.dreamcarclub.nl/chatbox/interface.php?action=checkinvite'); httpinv.onreadystatechange = handleInviteResponse; httpinv.send(null); }catch(e){ } window.setTimeout('checkInvite();', 4000); } function handleInviteResponse(){ if (httpinv.readyState == 4) { invID = parseInt(httpinv.responseText); if(!isNaN(invID)){ joinChat(invID); } } } function expandRecent(kind) { try{ http.open('get', 'https://www.dreamcarclub.nl/ajax/ajax_newest.php?field=recentregs&soort=' + encodeURIComponent(kind)); http.onreadystatechange = handleExpandRecentResponse; http.send(null); }catch(exception){ } } function expandRecent2(kind) { try{ http2.open('get', 'https://www.dreamcarclub.nl/ajax/ajax_newest.php?field=onlineUsers&soort=' + encodeURIComponent(kind)); http2.onreadystatechange = handleExpandRecentResponse2; http2.send(null); }catch(exception){ } } function toggleRecent(){ if(!http_busy){ http_busy = true; if(expand_kind == "big"){ expand_kind = "small"; }else{ expand_kind = "big"; } expandRecent(expand_kind); } } function toggleRecent2(){ if(!http2_busy){ http2_busy = true; if(expand_kind2 == "big"){ expand_kind2 = "small"; }else{ expand_kind2 = "big"; } expandRecent2(expand_kind2); } } function handleExpandRecentResponse() { try{ if (http.readyState == 4) { document.getElementById('recentregs').innerHTML = http.responseText; } }catch(exception){ } http_busy = false; } function handleExpandRecentResponse2() { try{ if (http2.readyState == 4) { document.getElementById('onlineUsers').innerHTML = http2.responseText; } }catch(exception){ } http2_busy = false; } var http; var http_busy; var expand_kind; var http2; var http2_busy; var expand_kind2; var target_field; var httpclock; var httpinv; //initialize(); var load; var now; var firsttime; function startAjax(){ /*httpclock = createRequestObject(); httpinv = createRequestObject(); window.setTimeout('syncTime();', 1000); window.setTimeout('checkInvite();', 1100);*/ load = new Date(); now = new Date(); firsttime = false; /*specific coding for this page*/ http2_busy = false; http2 = createRequestObject(); expand_kind2 = "big"; http_busy = false; target_field = 'recentregs'; http = createRequestObject(); expand_kind = "big"; toggleRecent(); toggleRecent2(); } function startChat(targetID){ var newUrl ="https://www.dreamcarclub.nl/chatbox/startChat.php?target="+targetID; var sname = "Chatbox"+targetID; window.open(newUrl,sname,"width=650,height=600,scrollbars=no,location=no"); } function joinChat(channelID){ var newUrl ='https://www.dreamcarclub.nl/chatbox/chatbox.php?invite=yes&cid='+channelID; var sname = "Chatbox"+channelID; window.open(newUrl,sname,"width=650,height=600,scrollbars=no,location=no"); } function confirmAction(outputMessage,acceptUrl){ if(confirm(outputMessage)){ location.href = acceptUrl; } } function showSearchBox(formName2,fieldName2){ var newUrl ='https://www.dreamcarclub.nl/includes/selectUser.php?formName='+formName2+'&fieldName='+fieldName2+'&keyword='+document.forms[formName2].elements[fieldName2].value; // alert(newUrl); window.open(newUrl,'jevensternaam','width=450,height=350,scrollbars=yes,location=yes'); } function showPop(newUrl){ // alert(newUrl); window.open(newUrl,'vensternaam','width=350,height=350,scrollbars=yes,location=yes'); }