// (c) SmartBlue 2011 function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=510,height=510,left = 465,top = 195');"); } function md5 ( str ) { var RotateLeft = function(lValue, iShiftBits) { return (lValue<>>(32-iShiftBits)); }; var AddUnsigned = function(lX,lY) { var lX4,lY4,lX8,lY8,lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF); if (lX4 & lY4) { return (lResult ^ 0x80000000 ^ lX8 ^ lY8); } if (lX4 | lY4) { if (lResult & 0x40000000) { return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); } else { return (lResult ^ 0x40000000 ^ lX8 ^ lY8); } } else { return (lResult ^ lX8 ^ lY8); } }; var F = function(x,y,z) { return (x & y) | ((~x) & z); }; var G = function(x,y,z) { return (x & z) | (y & (~z)); }; var H = function(x,y,z) { return (x ^ y ^ z); }; var I = function(x,y,z) { return (y ^ (x | (~z))); }; var FF = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var GG = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var HH = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var II = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var ConvertToWordArray = function(str) { var lWordCount; var lMessageLength = str.length; var lNumberOfWords_temp1=lMessageLength + 8; var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64; var lNumberOfWords = (lNumberOfWords_temp2+1)*16; var lWordArray=Array(lNumberOfWords-1); var lBytePosition = 0; var lByteCount = 0; while ( lByteCount < lMessageLength ) { lWordCount = (lByteCount-(lByteCount % 4))/4; lBytePosition = (lByteCount % 4)*8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (str.charCodeAt(lByteCount)<>>29; return lWordArray; }; var WordToHex = function(lValue) { var WordToHexValue="",WordToHexValue_temp="",lByte,lCount; for (lCount = 0;lCount<=3;lCount++) { lByte = (lValue>>>(lCount*8)) & 255; WordToHexValue_temp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2); } return WordToHexValue; }; var x=Array(); var k,AA,BB,CC,DD,a,b,c,d; var S11=7, S12=12, S13=17, S14=22; var S21=5, S22=9 , S23=14, S24=20; var S31=4, S32=11, S33=16, S34=23; var S41=6, S42=10, S43=15, S44=21; str = utf8_encode(str); x = ConvertToWordArray(str); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; xl = x.length; for (k=0;k 127) && (c1 < 2048)) { enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128); } else { enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128); } if (enc != null) { if (end > start) { utftext += string.substring(start, end); } utftext += enc; start = end = n+1; } } if (end > start) { utftext += string.substring(start, string.length); } return utftext; } function VenueChange(onChangeOption){ $.ajax({url: '/ajax/set_venue.php?venue=' + $('#select_venue').val(), success: function(){ if(onChangeOption == 'refresh'){ location.reload(true); }else if(onChangeOption != ''){ eval(onChangeOption); } }}); } AliveAttempts = 0; AliveCount = 1; AliveXY = 0; MouseXY = 0; MouseX = 0; AlivePage = ""; AliveCheckTime = 60000; AliveMinsTimeout = 60; AlivePageTitle = ""; AliveLocked = false; function startAlive(page){ AlivePage = page; AliveXY = MouseXY; setTimeout('KeepAlive()',AliveCheckTime); } function KeepAlive(){ if(AliveXY == MouseXY){ AliveCount ++; }else{ AliveXY = MouseXY; AliveCount = 0; } if(AliveCount >= AliveMinsTimeout){ $('#alivelivemanual').hide(); $('#aliveliveauto').show(); AliveSetLock(); }else{ $('#online').load('/ajax/maintain_login.php',{'p':AlivePage, type: 'GET'}); setTimeout('KeepAlive()',AliveCheckTime); } } function SetMousePos(e) { if (!e) var e = window.event; if (e.pageX || e.pageY) { MouseXY = e.pageX + '#' + e.pageY; MouseX = e.pageX; } else if (e.clientX || e.clientY) { MouseXY = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft + '#' + e.clientY + document.body.scrollTop + document.documentElement.scrollTop; MouseX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; } } document.onmousemove = function (event) { if (!event) { event = window.event; } MouseXY = event.clientX + '#' + event.clientY; MouseX = event.clientX; } window.onresize = function () { $('#alivelock').css("height",0); $('#alivelock').css("width",0); $('#alivelock').css("height",document.body.parentNode.scrollHeight+ 'px'); $('#alivelock').css("width",document.body.parentNode.scrollWidth+ 'px'); } function alivecheck(){ $('#loginform').hide(); $('#loginmsg').show(); pwd = $('#alivecheckpassword').val(); usr = $('#alivecheckuser').val(); god = $('#alivecheckgod').val(); key = $('#alivelockkey').val(); pwd = md5(pwd); params = 'u=' + usr + '&p=' + pwd + '&g=' + god + '&k=' + key; $('#alivecheckpassword').val(""); AliveAttempts ++; $.ajax({type: 'POST', url:'/ajax/alive_login.php?' + params, success: function(transportData) { if(transportData == "CONFIRMED"){ setTimeout('KeepAlive()',AliveCheckTime); AliveCount = 0; document.title = AlivePageTitle; $('#alivelock').fadeOut(); AliveAttempts = 0; $('#loginmsg').html('Account Verified'); AliveLocked = false; }else if(transportData == "KEY"){ alert("One or more of our security checks have failed. For your security, this session will now terminate."); window.location.replace("http://" + document.domain + "/logout.php"); }else if(transportData == "FAIL"){ if(AliveAttempts >= 2){ window.location.replace("http://" + document.domain + "/logout.php"); }else{ $('#loginmsg').html('Account Verification Failed.'); alert("Your password is incorrect. You have one attempt left."); $('#loginform').show(); $('#loginmsg').hide(); } }else{ alert(transportData); $('#loginform').show() $('#loginmsg').hide(); } }} ); } function alivelocknow(){ AliveCount = AliveMinsTimeout; $('#alivelivemanual').show(); $('#aliveliveauto').hide(); AliveSetLock(); } function AliveSetLock(){ $.ajax({url:'/ajax/alive_kill.php'}); $('#alivelock').css('height', document.body.parentNode.scrollHeight + 'px'); $('#alivelock').css('width', document.body.parentNode.scrollWidth + 'px'); document.body.parentNode.scrollTop = 0; $('#loginform').show(); $('#loginmsg').hide(); $('#loginmsg').html('Verifing...'); AlivePageTitle = document.title; document.title = "Security Shield"; $('#alivelock').fadeIn(); AliveLocked = true; } function OnlineOpen(){ $('#online-list').fadeIn(); $('#OnlineOpen').hide(); $('#OnlineClose').show(); } function OnlineClose(){ $('#online-list').fadeOut(); $('#OnlineOpen').show(); $('#OnlineClose').hide(); } function menuLibToggle(id){ if($('menu_lib_mnu_' + id).css('display') == 'block'){ $('menu_lib_mnu_' + id).hide(); }else{ $('menu_lib_mnu_' + id).show(); } } function SoundNewsAlarm(){ /*setTimeout("SoundNewsAlarm()",5000); if($('#news-alarm-sound').html() == "1"){ $('#news-alarm').effect("shake",{distance: 7, speed: 400, times: 1}); }*/ } function toggleHelpbox(){ $('#helpbox').css('cursor','pointer'); $('#helpboxtext').slideUp(function() { $('#helpbox').animate({left: '911px'},800); }); $.ajax({url:'/ajax/set_showhelp.php?show=n'}); } function toggleHelpboxRestore(){ if($('#helpbox').css('cursor')=='pointer'){ $('#helpbox').css('cursor','auto'); $('#helpbox').animate({left: '206px'},800,function() { $('#helpboxtext').slideDown(); }); $.ajax({url:'/ajax/set_showhelp.php?show=y'}); } } function minsToTime(mins, useAMPM){ var Hours = Math.floor(mins/60); var AMPM = 'am'; if(Hours >= 24 && useAMPM){ Hours = Hours - 24; AMPM = 'am'; }else if(Hours >= 12 && useAMPM){ Hours = Hours - 12; AMPM = 'pm'; } var Minutes = mins%60; if(Minutes == 0){ Minutes = Minutes + '0'; } var Time = Hours + ":" + Minutes; if(useAMPM){ Time = Time + AMPM; } return Time; } function minsToHoursMins(mins){ var Hours = Math.floor(mins/60); var Minutes = mins%60; var Text = ""; if(Hours > 0){ if(Hours > 24){ Hours = Hours - 24; } if(Hours == 1){ Text = " 1 hour"; }else{ Text = Hours + " hours"; } if(Minutes > 0){ Text += " and "; } } if(Minutes > 0){ Text += Minutes + " mins"; } return Text; } function setButtons(){ $("input:submit, a.abtn").button(); $(".btnset").buttonset(); $(".multi").dropdownchecklist({ maxDropHeight: 150}); $("div.sb-help").hover( function () { $(this).addClass("hover"); }, function () { $(this).removeClass("hover"); } ); $("div.sb-help-right").hover( function () { $(this).addClass("hover"); }, function () { $(this).removeClass("hover"); } ); $(".sb-tooltip").hover( function () { $(this).children('span').addClass("hover"); }, function () { $(this).children('span').removeClass("hover"); } ); $(".sb-tooltip-right").hover( function () { $(this).children('span').addClass("hover"); }, function () { $(this).children('span').removeClass("hover"); } ); } function setEditors(){ $('.edit-normal').tinymce({ // Location of TinyMCE script script_url : '/scripts/tinymce/tiny_mce.js', file_browser_callback : "filebrowser", // General options theme : "advanced", plugins : "style,emotions,spellchecker,inlinepopups,searchreplace,contextmenu,paste,directionality", // Theme options theme_advanced_buttons1 : "undo,redo,|,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,outdent,indent,|,link,unlink,emotions,spellchecker", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_buttons4 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "none", theme_advanced_resizing : true, relative_urls : false }); $('textarea.edit-full').tinymce({ // Location of TinyMCE script script_url : '/scripts/tinymce/tiny_mce.js', file_browser_callback : "filebrowser", // General options theme : "advanced", plugins : "table,autoresize,advlink,emotions,inlinepopups,searchreplace,contextmenu,paste,directionality,fullscreen,advlist", // Theme options theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect", theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,|,sub,sup,|,charmap,emotions", theme_advanced_buttons4 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "none", theme_advanced_resizing : true, relative_urls : false // Example content CSS (should be your site CSS) //content_css : "css/content.css" // Drop lists for link/image/media/template dialogs }); $('textarea.edit-bbcode').tinymce({ script_url : '/scripts/tinymce/tiny_mce.js', theme : "advanced", mode : "none", plugins : "inlinepopups,emotions", theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,forecolor,emotions", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "bottom", theme_advanced_toolbar_align : "center", theme_advanced_styles : "", entity_encoding : "raw", add_unload_trigger : false, remove_linebreaks : false, inline_styles : false, convert_fonts_to_spans : false, relative_urls : false }); $('textarea.edit-cv').tinymce({ script_url : '/scripts/tinymce/tiny_mce.js', theme : "advanced", mode : "none", plugins : "inlinepopups", theme_advanced_buttons1 : "bold,italic,underline,undo,redo, cut,copy,paste,pastetext,pasteword,bullist,numlist", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "center", theme_advanced_styles : "", entity_encoding : "raw", add_unload_trigger : false, remove_linebreaks : false, inline_styles : false, convert_fonts_to_spans : false, relative_urls : false }); } function pagingDroplist(page){ $('#p-form').attr('action',page.replace('#p#',$('#p').val())).submit(); } function filebrowser_old(field_name, url, type, win) { FileWindow=win; window.open('/modal/image_browser.php','Image Uploader','width=600,height=600'); } function filebrowser(field_name, url, type, win) { cmsURL = '/modal/image_browser.php'; tinyMCE.activeEditor.windowManager.open({ file : cmsURL, title : 'My File Browser', width : 600, height : 600, resizable : "yes", inline : "yes", close_previous : "no" }, { window : win, input : field_name }); return false; } function CallBackReturn(field_name, url){ FileWindow.document.forms[0].elements[field_name].value =url; } function toggleMenu(menuItem){ if($('#m' + menuItem).is(":hidden")){ $('#m' + menuItem).slideDown(); $('#t' + menuItem).removeClass("close").addClass("open"); $.ajax({url:'ajax/menu_settings.php', data:{'menu' : menuItem, 'mode':1}}); }else{ $('#m' + menuItem).slideUp(); $('#t' + menuItem).addClass("close"); $.ajax({url:'ajax/menu_settings.php', data:{'menu' : menuItem, 'mode':0}}); } } function quickCheck(cssClass, makeChecked, executeAfter){ $('.' + cssClass).attr('checked', makeChecked); if(executeAfter != ""){ eval(executeAfter); } } function updateLiveChatSummary(){ $('#liveChatSummary').load('/ajax/list_contacts_online.php', function(){ setButtons(); }); } function closeChatAlert(){ $('#chatalert').hide(); $.ajax({url:'/ajax/set_close_chat_alert.php'}); } function showOfferDetails(id){ $('#dialog').html("Loading...").load('modal/offer_details.php', {'id':id}, function(){setButtons();}).dialog({title: 'Offer Details', modal:true, width: 700, buttons: { 'Close': function() { $(this).dialog('destroy'); } } }); } function offerVote(offer,liked){ $('#vote' + offer).load('ajax/set_offer_vote.php',{'offer':offer,'liked':liked}); } function pollVote(poll,vote){ $.ajax({type: 'POST', url:'/ajax/set_poll_vote.php', data:{'poll':poll,'vote':vote},dataType:'html', success: function(transportData) { $('#pollbox').html(transportData); } }); } function setValidation(){ jQuery.extend(jQuery.validator.messages, { required: "This field is required.", remote: "Please fix this field.", email: "Please enter a valid email address.", url: "Please enter a valid URL.", date: "Please enter a valid date.", dateISO: "Please enter a valid date (ISO).", number: "Please enter a valid number.", digits: "Please enter only digits.", creditcard: "Please enter a valid credit card number.", equalTo: "Please enter the same value again.", accept: "Please enter a value with a valid extension.", maxlength: jQuery.validator.format("Please enter no more than {0} characters."), minlength: jQuery.validator.format("Please enter at least {0} characters."), rangelength: jQuery.validator.format("Please enter a value between {0} and {1} characters long."), range: jQuery.validator.format("Please enter a value between {0} and {1}."), max: jQuery.validator.format("Please enter a value less than or equal to {0}."), min: jQuery.validator.format("Please enter a value greater than or equal to {0}.") }); $('input, textarea, select').live('mouseenter', function() {$(this).siblings(".sb-error").children("span").show();}).live('mouseout', function() {$(this).siblings(".sb-error").children("span").hide();}); $(".validate").validate({ onfocusout: function(element) { $(element).valid(); }, errorElement: "div", errorPlacement: function(error, element) { error.appendTo(element.parent("td")); }, validPlacement: function(error, element) { error.appendTo(element.parent("td")); }, success: "sb-valid", errorClass: "sb-error", invalidHandler: function(form, validator) { $(".sb-errornotice").show(); $(".sb-details").html(""); $(".sb-errornotice strong").hide(); if(validator.numberOfInvalids() == 1){$(".sb-errornotice strong.single").show();}else{$(".sb-errornotice strong.plural").show();} validator.defaultShowErrors(); $(".sb-error:visible strong").each(function(){$(".sb-details").append("
  • " + $(this).html() + "
  • ");}); } }); } var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i