var origOptions = null; var request = null; var request_second = null; var type = null; //messages_link //messages_nr function redirectToInform(theURL, theID) { if (window.opener) { window.opener.location = theURL + "TID=" + theID; window.close(); } else { window.location = theURL + "TID=" + theID; } } function setSoundManager(soundfile) { soundManager.url = 'http://www.bearforbear.com/bear/sound_system/soundmanager2.swf'; soundManager.debugMode = false; soundManager.consoleOnly = false; soundManager.onload = function() { soundManager.createSound('aDrumSound','http://www.bearforbear.com/bear/sound_system/' + soundfile); } } function playSound(soundfile) { soundManager._writeDebug('calling playSound() function generated errors.'); soundManager.createSound({id:'mySound1',url:'http://www.bearforbear.com/bear/sound_system/' + soundfile}); soundManager.play('mySound1'); } function checkForMessages() { setSoundManager('message.mp3'); setTimeout('getMessages()', 3000); } function getMessages() { var url = "new_messages.php?action=getMessages"; httpRequest("GET",url,true, 'getMessages'); } function countBannerViews() { //var url = "countBannerViews.php?check=yes"; //httpRequest_1("GET",url,true, 'countBannerViews'); } function handleResponseCountBannerViews() { try { if (request_1.readyState == 4) { if (request_1.status == 200) { var resp = request_1.responseText; //alert(resp); if(resp != null) { var objt = eval(resp); } } else { //alert("A problem occurred with communicating between the XMLHttpRequest object and the server program."); } } } catch (err) { //alert("It does not appear that the server is available for this application. Please try again very soon. \n Error: "+err.message); } } function handleResponseGetMessages() { try { if (request.readyState == 4) { if (request.status == 200) { var resp = request.responseText; //alert(resp); if(resp != null) { var objt = eval(resp); var o = objt+""; var recived = o.split(';'); var theLink = recived[0]; var theNr = recived[1]; if (theNr == '') { theNr = 0; } var theAlert = recived[2]; var messages_link = document.getElementById('messages_link'); var messages_nr = document.getElementById('messages_nr'); messages_link.value = theLink; messages_nr.innerHTML = theNr; if (theAlert == 'yes') { setTimeout("playSound('message.mp3')",5000); } else { } setTimeout('getMessages()', 3000); } } else { //alert("A problem occurred with communicating between the XMLHttpRequest object and the server program."); } } } catch (err) { //alert("It does not appear that the server is available for this application. Please try again very soon. \n Error: "+err.message); } } function initReq(reqType,url,bool, type) { try { if (type == 'getMessages') { request.onreadystatechange = handleResponseGetMessages; } if (type == 'countBannerViews') { request.onreadystatechange = handleResponseCountBannerViews; // i dont need to check } request.open(reqType,url,bool, initReq); request.setRequestHeader('Cache-control', 'no-cache');//here is the no cache control request.send(null); } catch (errv) { //alert("The application cannot contact the server "+"at the moment. "+"Please try again in a few seconds." ); } } function initReq_1(reqType,url,bool, type) { try { if (type == 'countBannerViews') { request_1.onreadystatechange = handleResponseCountBannerViews; // i dont need to check } request_1.open(reqType,url,bool, initReq); request_1.setRequestHeader('Cache-control', 'no-cache');//here is the no cache control request_1.send(null); } catch (errv) { //alert("The application cannot contact the server "+"at the moment. "+"Please try again in a few seconds." ); } } function httpRequest(reqType,url,asynch, type) { if(window.XMLHttpRequest) { request = new XMLHttpRequest( ); } else if (window.ActiveXObject) { request=new ActiveXObject("Msxml2.XMLHTTP"); if (! request) { request=new ActiveXObject("Microsoft.XMLHTTP"); } } if(request) { var addToUrl = '&sid=' + new Date().getTime(); url += addToUrl; initReq(reqType, url, asynch, type); } else { //alert("Your browser does not permit the use of all "+"of this application's features!"); } } function httpRequest_1(reqType,url,asynch, type) { if(window.XMLHttpRequest) { request_1 = new XMLHttpRequest( ); } else if (window.ActiveXObject) { request_1=new ActiveXObject("Msxml2.XMLHTTP"); if (! request_1) { request_1 = new ActiveXObject("Microsoft.XMLHTTP"); } } if(request_1) { var addToUrl = '&sid=' + new Date().getTime(); url += addToUrl; initReq_1(reqType, url, asynch, type); } else { //alert("Your browser does not permit the use of all "+"of this application's features!"); } } function goToParentPage(theURL) { if (theURL) { if (window.opener) { window.opener.location = theURL; } } } function goToChildPage(theURL) { if (theURL) { window.location = theURL; } } function launchChat() { var newURL = 'webchat/chat/chat.php'; var title = 'Bear for Bear Chat Window'; var chatWindow = window.open(newURL,'extrainfoChatWindow','width=800, height=800, toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1'); chatWindow.focus(); } function sendWoof(woofID) { var newURL = 'woof.php?to='+woofID; var newWindowc = window.open(newURL,'extrainfoc','width=550, height=505, scrollbars=no, resizable=no'); newWindowc.focus(); } function sendMessage(messID) { var newURL = 'im.php?to='+messID; var newWindowb = window.open(newURL,'extrainfob','width=550, height=505, scrollbars=no, resizable=no'); newWindowb.focus(); } function reportUser(userID) { var newURL = 'report.php?user='+userID; var newWindowa = window.open(newURL,'extrainfoa','width=550, height=530, scrollbars=no, resizable=no'); newWindowa.focus(); } function buddyList() { var newURL = 'friends.php'; var newWindowa = window.open(newURL,'myfriends','width=242, height=600, scrollbars=yes, resizable=no'); newWindowa.focus(); } function LTrim( value ) { var re = /\s*((\S+\s*)*)/; return value.replace(re, "$1"); } function RTrim( value ) { var re = /((\s*\S+)*)\s*/; return value.replace(re, "$1"); } function trim( value ) { return LTrim(RTrim(value)); } function check_string_notes(obj) { var str = obj.value; var str_len = obj.value.length; var str_code = obj.keyCode; var str_split = str.split('\r\n'); if (str_split.length > '11' ) { var trim_value = trim(obj.value); obj.value = trim_value.substring(0, str_len - 1); } } function checkKeycode(e) { var keycode; if (window.event) { keycode = window.event.keyCode; } else if (e) keycode = e.which; return keycode; } function addFriend(friend_id) { new Ajax.Request ( 'addFriend.php', { method: 'get', parameters: { id: friend_id }, onComplete: function(request) { var text = request.responseText; if (text == 'friend_added') { alert('This user has been added to your friend list.'); } else if (text == 'logged_equal_friend') { alert("Sorry, you can't add yourself to your buddy list!"); } else if (text == 'friend_exists') alert('This user has already been added to your buddy list.'); } } ); } function MM_jumpMenuGo(objId,targ,restore){ //v9.0 var selObj = null; with (document) { if (getElementById) selObj = getElementById(objId); if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } } function im(url, name) { var wwidth = '800'; var wheight = '800'; if (document.all) var xMax = screen.width, yMax = screen.height; else if (document.layers) var xMax = window.outerWidth, yMax = window.outerHeight; else var xMax = 640, yMax=480; var xOffset = (xMax - wwidth)/2, yOffset = (yMax - wheight)/2; popupWin = window.open(url,name,'WIDTH='+wwidth+',HEIGHT='+wheight+',scrollbars=yes,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+''); popupWin.focus(); } function checkIfLogin() { setSoundManager('buddylist.mp3'); displayBuddyList(); } function displayBuddyList() { new Ajax.Request ( 'checkIfLogin.php', { method: 'get', parameters: { action: 'check' }, onSuccess: function(request) { var text = request.responseText; var splitted = text.split('###'); var status = splitted[0]; var online = splitted[1]; var offline = splitted[2]; var onlineDIV = document.getElementById('display_online'); var offlineDIV = document.getElementById('display_offline'); var choose_option = document.getElementById('choose_option'); if (status == 'yes') { setTimeout('playSound("buddylist.mp3")', 5000); onlineDIV.innerHTML = ''; onlineDIV.innerHTML = online; offlineDIV.innerHTML = ''; offlineDIV.innerHTML = offline; } else { onlineDIV.innerHTML = ''; onlineDIV.innerHTML = online; offlineDIV.innerHTML = ''; offlineDIV.innerHTML = offline; } showByOption(choose_option.value); setTimeout('displayBuddyList()', 60000); } } ); } function addChatUser(action) { new Ajax.Request ( 'addchatuser.php', { method: 'get', parameters: { action: action } } ); } function OpenWindow(url) { var newURL = url; var nw = window.open(newURL,'newWindow','width=800, height=600, scrollbars=no, resizable=no'); nw.focus(); }