image1 = new Image; image2 = new Image; image1.src = 'http://www.sagoingtonz.co.nz/forum/sachat/themes/default/images/x_inactive.png'; image2.src = 'http://www.sagoingtonz.co.nz/forum/sachat/themes/default/images/x_hover.png'; var msgArray = new Array(); var state = 'none'; var ie=document.all; var nn6=document.getElementById&&!document.all; var isIE = /*@cc_on!@*/false; var isdrag=false; var cSession; var x,y; var dobj; var cwh; var cww; var zdex = 100; zdex = zdex * 1; var aelem = 'none'; var css=document.createElement("link"); css.setAttribute("rel", "stylesheet"); css.setAttribute("type", "text/css"); css.setAttribute("href", "http://www.sagoingtonz.co.nz/forum/sachat/themes/default/style.css"); document.documentElement.getElementsByTagName("HEAD")[0].appendChild(css); var div = document.createElement('div'); div.setAttribute('id','chat_containter'); div.setAttribute('dir','ltr'); div.style.zIndex = 1000; div.innerHTML = '
\"Home\" \"Messages\" \"MySpace\"\"Tweet\"\"Facebook\"
Welcome, Guest. Please login or register.
'; document.body.appendChild(div); function movemouse(e){ if (isdrag){ style1 = nn6 ? tx + e.clientX - x : tx + event.clientX - x; style2 = nn6 ? ty + e.clientY - y : ty + event.clientY - y; style3 = nn6 ? dh - e.clientY + y : dh - event.clientY + y; style4 = nn6 ? dw - e.clientX + x : dw - event.clientX + x; dobj.style.left = style1+'px'; dobj.style.top = style2+'px'; dobj.style.bottom = style3+'px'; dobj.style.right = style4+'px'; gadFix = dobj.id.substr(0, 6); if (gadFix != 'Gadget') { var session = new setCookieArray('msg_win'+dobj.id, '2sichat', dobj.id, style1, style2); } if (gadFix == 'Gadget') { var session = new setCookieArray(dobj.id, '2sichat_gadget', dobj.id, style1, style2); } return false; } } function selectmouse(e){ var fobj = nn6 ? e.target : event.srcElement; while (fobj.tagName != "HTML" && fobj.className != "msg_win" && fobj.className != "msg_container"){ fobj = nn6 ? fobj.parentNode : fobj.parentElement; } if (fobj.className=="msg_win"){ jQuery.noConflict()(function($){ var dpos = $('#'+fobj.id).viewportOffset(); var vwidth = $(window).width(); var vheight = $(window).height(); dobj = fobj; tx = parseInt(dobj.style.left+dpos.left); ty = parseInt(dobj.style.top+dpos.top); th = parseInt(dpos.top+cwh); dh = parseInt(vheight - th); tw = parseInt(dpos.left+cww); dw = parseInt(vwidth - tw); }); isdrag = true; zdex = (zdex+1); dobj.style.zIndex = zdex; x = nn6 ? e.clientX : event.clientX; y = nn6 ? e.clientY : event.clientY; document.onmousemove=movemouse; document.body.onselectstart = function (){if (isdrag){return false;} else {return true;}} } } document.onmousedown=selectmouse; document.onmouseup=new Function("isdrag=false"); document.body.onresize = function (){} function openGadget(id) { if (document.getElementById('Gadget'+id) == undefined) { var div = document.createElement('div'); div.setAttribute('id','Gadget'+id); div.setAttribute('dir','ltr'); div.setAttribute('class','msg_win'); div.style.position = 'fixed'; zdex = (zdex+1); div.style.zIndex = zdex; //if (isIE) { ////document.documentElement.appendChild(div); //} //else{ document.body.appendChild(div); //} jQuery.noConflict()(function($){ $.ajax({ url: 'http://www.sagoingtonz.co.nz/forum/sachat/index.php', data: 'theme=default&gid='+id, dataType: "json", cache: false, success: function(data){ if (data.DATA != null){ div.innerHTML = data.DATA } if (data != null && data.ONLINE != null) { document.getElementById('friends').innerHTML = data.ONLINE; } } }); }); if (cSession == undefined) { var session = new setCookieArray('Gadget'+id, '2sichat_gadget', 'Gadget'+id); }else{ var session = new setCookieArray('Gadget'+id, '2sichat_gadget', 'Gadget'+id, cSession[3], cSession[4]); } //document.body.appendChild(div); jQuery.noConflict()(function($){ cwh = $('#Gadget'+id).height(); cww = $('#Gadget'+id).width(); }); } } function closeGadget(id) { var div = document.getElementById('Gadget'+id); div.parentNode.removeChild(div); delCookieArray('Gadget' + arguments[0]); } function doScripts(e){ if (e.nodeType != 1) { return; } if (e.tagName.toLowerCase() == 'script') { var s = document.createElement('script'); s.setAttribute('type', 'text/javascript'); if (e.src != null) { s.setAttribute('src', e.src); } if (e.text != null) { s.text= e.text; } e.parentNode.insertBefore(s, e); } else { var n = e.firstChild; while(n) { doScripts(n); n = n.nextSibling; } } } doCookies(); function doCookies() { jQuery.noConflict()(function($){ $.each(document.cookie.split(';'), function(i, cookie) { var c = $.trim(cookie), name = c.split('=')[0], value = c.split('=')[1]; var cname = name.substring(0, name.length - 1); var cSession = new getCookieArray(cname); if (cSession[1] == '2sichat') { chatTo(cSession[2]); document.getElementById(cSession[2]).style.left = cSession[3]+'px'; document.getElementById(cSession[2]).style.top = cSession[4]+'px'; } if (cSession[1] == '2sichat_gadget') { openGadget(cSession[2].substr(6)); document.getElementById(cSession[2]).style.left = cSession[3]+'px'; document.getElementById(cSession[2]).style.top = cSession[4]+'px'; } }); }); } function getCookieArray(name){ var i = 0; while (getCookie(name + i) != null) { this[i + 1] = getCookie(name + i); i++; this.length = i; } } function setCookieArray(name){ this.length = setCookieArray.arguments.length - 1; for (var i = 0; i < this.length; i++) { data = setCookieArray.arguments[i + 1]; setCookie(name + i, data, expdate); } } function delCookieArray(name){ var i = 0; while (getCookie(name + i) != null) { var expireNow = new Date(); document.cookie = name + i + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/"; i++; } } function getCookie(name) { var dcookie = document.cookie; var cname = name + "="; var clen = dcookie.length; var cbegin = 0; while (cbegin < clen) { var vbegin = cbegin + cname.length; if (dcookie.substring(cbegin, vbegin) == cname) { var vend = dcookie.indexOf (";", vbegin); if (vend == -1) vend = clen; return unescape(dcookie.substring(vbegin, vend)); } cbegin = dcookie.indexOf(" ", cbegin) + 1; if (cbegin == 0) break; } return null; } function setCookie(name, value, expires) { if (!expires) expires = new Date(); document.cookie = name + "=" + escape (value) + "; expires=" + expires.toGMTString() + "; path=/"; } function delCookie(name) { var expireNow = new Date(); document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/"; } var expdate = new Date(); expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365)); /*function showhide(layer_ref) { jQuery.noConflict()(function($){ $(document.getElementById(layer_ref)).toggle(); }); }*/ function showhide(layer_ref) { if(document.getElementById(layer_ref).style.display == 'none') { document.getElementById(layer_ref).style.display = 'block'; } else { document.getElementById(layer_ref).style.display = 'none'; } } function getSocial (social) { if (social == 'myspace') { pupUP("http://www.myspace.com/Modules/PostTo/Pages/default.aspx?c="+window.location+"&t="+document.documentElement.getElementsByTagName("TITLE")[0].innerHTML); } if (social == 'twitter') { pupUP("http://twitter.com/home?status="+document.documentElement.getElementsByTagName("TITLE")[0].innerHTML+" @ "+window.location); } if (social == 'facebook') { pupUP("http://www.facebook.com/sharer.php?t="+document.documentElement.getElementsByTagName("TITLE")[0].innerHTML+"&u="+window.location); } } function pupUP(url) { newwindow=window.open(url,'pupUP','height=400,width=550,top=200,left=200,toolbar=0,location=0,directories=0,status=0,menubar=0,statusbar=0'); if (window.focus) {newwindow.focus()} return false; }