var hostUrl='http://'+window.location.hostname+'/'; //***********************Chat************************************************************ /* var checkUpdate = (function() { var mTimer=''; // This is the private persistent value // The outer function returns a nested function that has access // to the persistent value. It is this nested function we're storing // in the variable uniqueID above. if (mTimer!='') { clearInterval(mTimer); mTimer=''; } else mTimer=setInterval('getChatText();',2000); return function() { return mTimer; }; })(); */ function requestChat(chatId,fromId,accept) { var xmlhttp; var param; param='?chatid='+chatId + '&fromid='+fromId + '&accept='+accept; //$hostUrl/process/chat/startChat.php?memberid=".$row2['id']."&channelid=1 if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { // alert(xmlhttp.responseText); if (fromId=='') //Group Chat { element=document.getElementById('groupChat'); element.setAttribute('style','padding:5px;border:2px #A4B9E8 solid;overflow:auto;position:absolute;right:150px;bottom:220px;background-color:#F9F9F9;min-height:20px;max-height:200px;width:120px;'); //alert(xmlhttp.responseText); element=document.getElementById('groupChatOnline'); element.setAttribute('style','float:right;'); } if (accept=='true') { expandChat(); } //alert(param+xmlhttp.responseText); } } // Send Method Which file to send to Parameters Asyncronous xmlhttp.open("GET", hostUrl + "process/chat/requestChat.php" + param, true); xmlhttp.send(null); //The actual send command*/ } function startChat(channelId,memberId) { var xmlhttp; var param; param='?channelid='+channelId + '&memberid='+memberId; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { //alert(xmlhttp.responseText); expandChat(); } } // Send Method Which file to send to Parameters Asyncronous xmlhttp.open("GET", hostUrl + "process/chat/startChat.php" + param, true); xmlhttp.send(null); //The actual send command*/ } function check() { var xmlhttp; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { var resp=xmlhttp.responseText; var splitArray; splitArray=resp.split("##split##"); statusBary=document.getElementById('statusBar'); statusBary.innerHTML=splitArray[0]; friendsListy=document.getElementById('friendsList'); friendsListy.innerHTML=splitArray[1]; noticeMax=document.getElementById('noticesMax') noticeMax.innerHTML=splitArray[2]; boxy=document.getElementById('box'); if ( boxy!=null) { boxy.innerHTML=splitArray[3]; boxy.scrollTop = boxy.scrollHeight; } groupChaty=document.getElementById('groupChat'); if ( groupChaty!=null) groupChaty.innerHTML=splitArray[4]; } } var nocache='?count'; // Send Method Which file to send to Parameters Asyncronous xmlhttp.open("GET", hostUrl + "process/common/check.php" + nocache, true); xmlhttp.send(null); //The actual send command*/ } function collapseChat(statusType) { element=document.getElementById('chatWindow'); grpOnline=document.getElementById('groupChat'); if (grpOnline!=null) grpOnline.setAttribute('style','display:none;bottom:0px;height:0px;width:0px;'); if (element!=null) element.setAttribute('style','display:none;bottom:25px;left:40%;height:0px;width:0px;background-color:#fff;position:absolute;border:1px #ccc solid;'); var xmlhttp; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { element=document.getElementById('chatWindow'); element.setAttribute('style','display:none;background-color:#A4B9E8;z-index:200;bottom:25px;right:20%;height:200px;width:300px;position:absolute;border:2px #A4B9E8 solid;'); } } // Send Method Which file to send to Parameters Asyncronous xmlhttp.open("GET", hostUrl + "process/chat/setState.php" + "?state="+statusType, true); xmlhttp.send(null); //The actual send command*/ } function expandFriendsList() { fList=document.getElementById('friendsList'); fList.setAttribute('style',"z-index:2000;font-size:12px;color:#536472;padding-bottom:5px;padding-left:10px;border:1px #536472 solid;position:absolute;right:400px;bottom:35px;background-color:#F9F9F9;min-height:20px;max-height:500px;width:120px"); } function collapseFriendsList() { fList=document.getElementById('friendsList'); fList.setAttribute('style',"display:none"); } function expandNotice() { nMax=document.getElementById('noticesMax'); nMax.setAttribute('style',"z-index:2000;color:#536472;padding-bottom:5px;padding-left:10px;border:1px #536472 solid;overflow-y:auto;overflow-x:none;position:absolute;right:50px;bottom:35px;background-color:#536472;min-height:50px;max-height:200px;width:340px;text-align:left"); } function collapseNotice() { nMax=document.getElementById('noticesMax'); nMax.setAttribute('style',"display:none"); } function expandChat() { var xmlhttp; collapseFriendsList(); if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { element=document.getElementById('chatWindow'); element.setAttribute('style','background-color:#A4B9E8;z-index:200;bottom:25px;right:320px;height:200px;width:300px;position:absolute;border:2px #A4B9E8 solid;'); } } // Send Method Which file to send to Parameters Asyncronous xmlhttp.open("GET", hostUrl +"process/chat/setState.php" + "?state=expand", true); xmlhttp.send(null); //The actual send command*/ } function leaveChat() { var xmlhttp; collapseChat('leave'); if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); if (xmlhttp.overrideMimeType) { xmlhttp.overrideMimeType('text/xml'); // See note below about this line } } else if (window.ActiveXObject) { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) { } } // Send Method Which file to send to Parameters Asyncronous xmlhttp.open("GET", hostUrl + "process/chat/leaveChat.php", true); xmlhttp.send(null); //The actual send command*/ } function sendChatText() { var xmlhttp; element=document.getElementById('inputChar'); var message=element.value; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("Your browser does not support XMLHTTP!"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4 && xmlhttp.status == 200) { element2=document.getElementById('box'); element2.innerHTML=xmlhttp.responseText; element2.scrollTop = element2.scrollHeight; element.value=""; } } var param="message=" + escape(message); xmlhttp.open("POST", hostUrl + "process/chat/updateText.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", param.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(param); //The actual send command*/ }