// custom-form-elements.js
var small_checkboxHeight="25";var small_radioHeight="25";var big_checkboxHeight="40";var big_radioHeight="25";var selectWidth="95";document.write('<style type="text/css">input.big_styled { display: none; } select.styled { position: relative; width: '+selectWidth+"px; opacity: 0; z-index: 5; }</style>");document.write('<style type="text/css">input.small_styled { display: none; } select.styled { position: relative; width: '+selectWidth+"px; opacity: 0; z-index: 5; }</style>");var Custom={init:function(){var inputs=document.getElementsByTagName("input"),span=Array(),textnode,option,active;for(a=0;a<inputs.length;a++){if((inputs[a].type=="checkbox"||inputs[a].type=="radio")&&(inputs[a].className=="big_styled"||inputs[a].className=="small_styled")){span[a]=document.createElement("span");if(inputs[a].className=="big_styled"){checkHeight=big_checkboxHeight;radioHeight=big_radioHeight;span[a].className="big_"+inputs[a].type}else{checkHeight=small_checkboxHeight;radioHeight=small_radioHeight;span[a].className="small_"+inputs[a].type}if(inputs[a].checked==true){if(inputs[a].type=="checkbox"){position="0 -"+(checkHeight*2)+"px";span[a].style.backgroundPosition=position}else{position="0 -"+(radioHeight*2)+"px";span[a].style.backgroundPosition=position}}inputs[a].parentNode.insertBefore(span[a],inputs[a]);span[a].onmousedown=Custom.pushed;span[a].onmouseup=Custom.check;document.onmouseup=Custom.clear}}inputs=document.getElementsByTagName("select");for(a=0;a<inputs.length;a++){if(inputs[a].className=="styled"||inputs[a].className=="styled"){option=inputs[a].getElementsByTagName("option");active=option[0].childNodes[0].nodeValue;textnode=document.createTextNode(active);for(b=0;b<option.length;b++){if(option[b].selected==true){textnode=document.createTextNode(option[b].childNodes[0].nodeValue)}}span[a]=document.createElement("span");span[a].className="select";span[a].id="select"+inputs[a].name;span[a].appendChild(textnode);inputs[a].parentNode.insertBefore(span[a],inputs[a]);inputs[a].onchange=Custom.choose}}},pushed:function(){element=this.nextSibling;if(element.className=="big_styled"){checkHeight=big_checkboxHeight;radioHeight=big_radioHeight}else{checkHeight=small_checkboxHeight;radioHeight=small_radioHeight}if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkHeight*3+"px"}else{if(element.checked==true&&element.type=="radio"){this.style.backgroundPosition="0 -"+radioHeight*3+"px"}else{if(element.checked!=true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkHeight+"px"}else{this.style.backgroundPosition="0 -"+radioHeight+"px"}}}},check:function(){element=this.nextSibling;if(element.className=="big_styled"){checkHeight=big_checkboxHeight;radioHeight=big_radioHeight}else{checkHeight=small_checkboxHeight;radioHeight=small_radioHeight}if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 0";element.checked=false}else{if(element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkHeight*2+"px"}else{this.style.backgroundPosition="0 -"+radioHeight*2+"px";group=this.nextSibling.name;inputs=document.getElementsByTagName("input");for(a=0;a<inputs.length;a++){if(inputs[a].name==group&&inputs[a]!=this.nextSibling){inputs[a].previousSibling.style.backgroundPosition="0 0"}}}element.checked=true}},clear:function(){inputs=document.getElementsByTagName("input");for(var b=0;b<inputs.length;b++){if(inputs[b].className=="big_styled"){checkHeight=big_checkboxHeight;radioHeight=big_radioHeight}else{checkHeight=small_checkboxHeight;radioHeight=small_radioHeight}if(inputs[b].type=="checkbox"&&inputs[b].checked==true&&inputs[b].className=="big_styled"||inputs[b].className=="small_styled"){inputs[b].previousSibling.style.backgroundPosition="0 -"+checkHeight*2+"px"}else{if(inputs[b].type=="checkbox"&&inputs[b].className=="big_styled"||inputs[b].className=="small_styled"){inputs[b].previousSibling.style.backgroundPosition="0 0"}else{if(inputs[b].type=="radio"&&inputs[b].checked==true&&inputs[b].className=="big_styled"||inputs[b].className=="small_styled"){inputs[b].previousSibling.style.backgroundPosition="0 -"+radioHeight*2+"px"}else{if(inputs[b].type=="radio"&&inputs[b].className=="big_styled"||inputs[b].className=="small_styled"){inputs[b].previousSibling.style.backgroundPosition="0 0"}}}}}},choose:function(){option=this.getElementsByTagName("option");for(d=0;d<option.length;d++){if(option[d].selected==true){document.getElementById("select"+this.name).childNodes[0].nodeValue=option[d].childNodes[0].nodeValue}}}};window.onload=Custom.init;

// global.js
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};(function($){$.fn.jTruncate=function(options){var defaults={length:300,minTrail:20,moreText:"MORE",lessText:"LESS",ellipsisText:"...",moreAni:"",lessAni:""};var options=$.extend(defaults,options);return this.each(function(){obj=$(this);var body=obj.html();if(body.length>options.length+options.minTrail){var splitLocation=body.indexOf(" ",options.length);if(splitLocation!=-1){var str1=body.substring(0,splitLocation);var str2=body.substring(splitLocation,body.length-1);obj.html(str1+'<span class="truncate_ellipsis">'+options.ellipsisText+'</span><span class="truncate_more">'+str2+"</span>");obj.find(".truncate_more").css("display","none");obj.append('<div class="clearboth"><a href="#" class="truncate_more_link">'+options.moreText+"</a></div>");var moreLink=$(".truncate_more_link",obj);var moreContent=$(".truncate_more",obj);var ellipsis=$(".truncate_ellipsis",obj);moreLink.click(function(){if(moreLink.text()==options.moreText){moreContent.show(options.moreAni);moreLink.text(options.lessText);ellipsis.css("display","none");$(this).addClass("less")}else{moreContent.hide(options.lessAni);moreLink.text(options.moreText);ellipsis.css("display","inline");$(this).removeClass("less")}return false})}}})}})(jQuery);(function($){$.fn.delay=function(time,callback){jQuery.fx.step.delay=function(){};return this.animate({delay:1},time,callback)}})(jQuery);(function($){$.fn.strokeme=function(){return this.each(function(){$this=$(this);content=$this.html();for(j=1;j<=8;j++){$span=$('<span class="stroke'+j+'"></span>');$span.html(content);$this.append($span)}this.removeChild(this.firstChild);$span=$('<span class="rawtext"></span>');$span.html(content);$this.append($span)})}})(jQuery);(function($){$.fn.suggestor=function(options){var opts=$.extend({},$.fn.suggestor.defaults,options);opts.listTotal=0;opts.listCurrent=-1;opts.searchField=$(this);$("body").append('<div id="'+opts.resultsId+'"></div>');opts.resultsDiv=$(opts.resultsId);var $this=$(this);repositionResultsDiv(opts);$this.blur(function(){setTimeout(function(){clearAutoComplete(opts)},200)});$this.bind("keyup",{opts:opts},function(e){var keyCode=e.keyCode||window.event.keyCode;var lastVal=$this.val();opts=e.data.opts;if(updownArrow(keyCode,opts)){return}if(keyCode==13||keyCode==27){clearAutoComplete(opts);return}setTimeout(function(){autoComplete(lastVal,opts)},opts.delay)})};$.fn.suggestor.format=function(json,opts){retval="";if(json.iconFileName.length>0){retval+='<div class="live-search-icon" style="background-image: url(http://static.myalganon.com/img/library/icons/'+json.iconFileName+');">'}else{retval+="<div>"}retval+='  <div>    <a href="'+json.href+'">      <em>'+json.objectType+"</em>";if(json.objectType=="Item"){retval+='<span class="ItemQuality_'+json.objectQuality_id+'">'}else{retval+="<span>"}retval+=json.objectName+"</span>    </a>  </div></div>";return retval};$.fn.suggestor.getValue=function(el,opts){return $($("span",opts.searchField).get()[0]).text()};$.fn.suggestor.defaults={resultsId:"suggestorResults",delay:250};function autoComplete(lastValue,opts){var part=opts.searchField.val();if(part===""){clearAutoComplete();return}if(lastValue!=part){return}$.getJSON(opts.url+part,function(json){var length=opts.listTotal=json.length;if(length>0){var data="";for(i=0;i<length;i++){data+=$.fn.suggestor.format(json[i])}opts.resultsDiv.html(data).show();var divs=$(opts.resultsId+" > div");divs.mouseover(function(){divs.each(function(){this.className="unselected"});this.className="selected"});divs.click(function(){opts.searchField.val($.fn.suggestor.getValue(this,opts));clearAutoComplete()})}else{clearAutoComplete()}})}function clearAutoComplete(opts){opts.resultsDiv.hide().html("")}function repositionResultsDiv(opts){var pos=opts.searchField.offset();var top=pos.top;var left=pos.left;var height=opts.searchField.height();var width=opts.searchField.width();opts.resultsDiv.css({position:"absolute",left:left+"px",top:top+height+5+"px",width:width-2+"px"})}function updownArrow(keyCode,opts){if(keyCode==40||keyCode==38){if(keyCode==38){if(opts.listCurrent===0||opts.listCurrent==-1){opts.listCurrent=opts.listTotal-1}else{opts.listCurrent--}}else{if(opts.listCurrent==opts.listTotal-1){opts.listCurrent=0}else{opts.listCurrent++}}opts.resultsDiv.children().each(function(i){if(i==opts.listCurrent){opts.searchField.val($.fn.suggestor.getValue(this));this.className="selected"}else{this.className="unselected"}});return true}else{opts.listCurrent=-1;return false}}function debug($msg){log=(window.console&&window.console.log)?window.console.log:alert;if(debug){log($msg)}}})(jQuery);MYALGANON={common:{setLargeHover:function(selector,hover,control){$(selector).hover(function(){$(this).toggleClass(hover).children(".mediaCONTROL").show()},function(){$(this).toggleClass(hover).children(".mediaCONTROL").hide()})},smallCARDHover:function(){$(".smallCARD").hover(function(){$(this).toggleClass("smallHover").children(".smallCARDcontrol").show()},function(){$(this).toggleClass("smallHover").children(".smallCARDcontrol").hide()})},setLargeCARDHover:function(){this.setLargeHover("div.largeCARD","hover_on",".largeCARDcontrol")},setLargeCARDPENDHover:function(){this.setLargeHover("div.largeCARDPEND","hover_pending",".largeCARDcontrolpending")},setMemberCARDHover:function(){this.setLargeHover("div.memberCARD","memberCARD_hover_on",".memberCARDcontrol")},setListenersGoogleFix:function(){var restoreStyles=function(){if(event.srcElement.style.backgroundColor!==""){event.srcElement.style.backgroundColor=""}};$("input").bind("propertychange",restoreStyles);$("input").css("backgroundColor","").bind("propertychange",restoreStyles);$("select").css("backgroundColor","").bind("propertychange",restoreStyles)},tabNav:function(){var $tabContainers=$("div.tabs > div");$("div.tabs ul.tabNavigation a").click(function(){$tabContainers.hide().filter(this.hash).show();$("div.tabs ul.tabNavigation a").removeClass("selected");$(this).addClass("selected");return false}).filter(":first").click()},flashMessage:function(){$(".flashClose").click(function(){var CLOSEME=$(this).attr("id");$("."+CLOSEME).slideToggle()});$(".flashTrialMessage").click(function(){window.location="/purchase"})},commentReply:function(){$(".respondBar").click(function(){$(this).next(".replyForm").slideToggle()})},populateAction:function(){var itemID=$("#itemID").val();var SOURCE=$("#SOURCE").val();if(itemID>=1){$.post("/tribute/index/action-box/",{tributeMarketListing_id:itemID,source:SOURCE},function(response){if(response.indexOf("#err")!=-1){$("#tributeAction").html("No details").show()}else{$("#tributeAction").html(unescape(response)).show();$(".tributeItemIcon").mouseover(MYALGANON.Tooltips.buildPackageItem).mousemove(MYALGANON.Tooltips.buildPackageItem).mouseout(function(){$("#libTOOLTIP").hide()});$("#btnYes").click(function(){var BUYME=$("#tributeMarketListing_id").val();var BUYNAME=$("#tributeBoxName").html();$("#tributeButtons").html("");$.post("/tribute/index/purchase-item/",{tributeMarketListing_id:$("#tributeMarketListing_id").val()},function(response){mySplitResult=response.split("#");if(mySplitResult[0].length==0){$(".flashMessageTribute").toggleClass("CLOSE");$("#flashMessageTributeText").html("Purchased "+BUYNAME+" Successfully");$("#tributeAction").html("")}else{$("#tributeActionBody").html(mySplitResult[0])}if(mySplitResult[1].length!=0){$("#MyBalance").html(mySplitResult[1]);$("#tributeAction").html("")}})});$("#btnNo").click(function(){$("#tributeAction").html("")});$("#btnPreview").click(function(){$.post("/tribute/index/preview/",{Category:$("#tributeMarketListing_category").val(),item_id:$("#tributeMarketProduct_data_id").val()})});$(".clickMe").click(function(){$(".level1").hide();$(this).next(".level2").show()});$(".returnMe").click(function(){$(".level1").show();$(".level2").hide()});$(".minMax").strokeme()}})}},placeAction:function(){$(".placeAction").click(function(){var PLACEME=$(this).attr("id");var SOURCE=$("#SOURCE").val();$.post("/tribute/index/action-box/source/",{tributeMarketListing_id:$(this).attr("id"),source:SOURCE},function(response){if(response.indexOf("#err")!=-1){$("#tributeAction").html("No details").show()}else{$("#tributeAction").html(unescape(response)).show();$(".tributeItemIcon").mouseover(MYALGANON.Tooltips.buildPackageItem).mousemove(MYALGANON.Tooltips.buildPackageItem).mouseout(function(){$("#libTOOLTIP").hide()});$("#btnYes").click(function(){var BUYME=$("#tributeMarketListing_id").val();var BUYNAME=$("#tributeBoxName").html();$("#tributeButtons").html("");$.post("/tribute/index/purchase-item/",{tributeMarketListing_id:$("#tributeMarketListing_id").val()},function(response){mySplitResult=response.split("#");if(mySplitResult[0].length==0){$(".flashMessageTribute").addClass("SHOW");$("#flashMessageTributeText").html("Purchased "+BUYNAME+" Successfully");$("#tributeAction").html("")}else{$("#tributeActionBody").html(mySplitResult[0])}if(mySplitResult[1].length!=0){$("#MyBalance").html(mySplitResult[1]);$("#tributeAction").html("")}})});$("#btnNo").click(function(){$("#tributeAction").html("")});$("#btnPreview").click(function(){$.post("/tribute/index/preview/",{Category:$("#tributeMarketListing_category").val(),item_id:$("#tributeMarketProduct_data_id").val()})});$(".clickMe").click(function(){$(".level1").hide();$(this).next(".level2").show()});$(".returnMe").click(function(){$(".level1").show();$(".level2").hide()});$(".minMax").strokeme()}})});$("td.VALUE:contains('-')").addClass("NEGATIVE");$("td.VALUE:contains('+')").addClass("POSTIVIE")},addTribute:function(){$("#submitPurchase").click(function(){$("#PROCESSING").removeClass("CLOSE");$("#BUTTONREPLACE").hide();$("#tributeError").addClass("CLOSE");$.post("/tribute/index/purchase-tribute",{sku:$("#sku").val()},function(response){mySplitResult=response.split("#");if(mySplitResult[0]==0||mySplitResult[0].length==4){$(".flashMessageTribute",top.document).toggleClass("CLOSE");$("#flashMessageTributeText",top.document).html("New Balance "+mySplitResult[1]+" Tribute");$("#MyBalance",top.document).html(mySplitResult[1]);self.parent.Shadowbox.close()}else{$("#tributeError").removeClass("CLOSE");$("#tributeError").html(mySplitResult[0]);$("#PROCESSING").addClass("CLOSE");$("#BUTTONREPLACE").show()}});return false})},marketClaims:function(){$(".CLAIMS").mouseover(MYALGANON.Tooltips.buildPackageItem).mousemove(MYALGANON.Tooltips.buildPackageItem).mouseout(function(){$("#libTOOLTIP").hide()})},init:function(){$("#toolbarfriend").click(function(){linka="/myprofile/friend/list-requests";window.location=linka});$("#toolbaremail").click(function(){linkb="/myprofile/message";window.location=linkb});$(".toolbarname").click(function(){$(".toolbarname").val("")});var sPath=window.location.pathname;var sPage=sPath.substring(sPath.lastIndexOf("/")+1)},finalize:function(){this.setListenersGoogleFix()}},default_module:{interval:10000,getStatusClass:function(serverCondition,server){var status="";if(serverCondition==100){status="status_green"}else{if(serverCondition>=50){status="status_blue"}else{if(serverCondition>=25){status="status_yellow"}else{if(serverCondition>=10){status="status_orange"}else{if(serverCondition>=0&&!server){status="status_flash"}else{if(serverCondition>=0&&server){status="status_red"}else{if(serverCondition==-1){status="status_pink"}else{if(serverCondition==-2){status="status_gray"}}}}}}}}return status},update:function(){timestamp=Number(new Date());statusURL=window.location.href;statusURL="http://www.myalganon.com/services/server/check-status/ts/"+timestamp;$.getJSON(statusURL,function(data){$("#status_adrios").removeClass().addClass(MYALGANON.default_module.getStatusClass(data.adrios.serverCondition,0)).addClass("server_status");$("#status_hokk").removeClass().addClass(MYALGANON.default_module.getStatusClass(data.hokk.serverCondition,0)).addClass("server_status");$("#status_matmael").removeClass().addClass(MYALGANON.default_module.getStatusClass(data.matmael.serverCondition,0)).addClass("server_status")})},restartTimer:function(){MYALGANON.default_module.update();setInterval("MYALGANON.default_module.update()",MYALGANON.default_module.interval)},index_members:function(){MYALGANON.common.setMemberCARDHover();MYALGANON.common.smallCARDHover();MYALGANON.common.flashMessage();UTIL.Tables.makeSortable();UTIL.Tables.makePageable();UTIL.Tables.makeFilterable()},index_beta_notes:function(){this.restartTimer();UTIL.Accordian();MYALGANON.common.flashMessage()},index_download:function(){this.restartTimer();UTIL.Accordian();MYALGANON.common.flashMessage()},stream_index:function(){UTIL.CommentControl();MYALGANON.common.flashMessage()},account_create:function(){pattern=/^[a-zA-Z0-9\.@\-_\+~!#%'*?`\{\}]{1,100}$/;$("#email").blur(function(){var username=$("#email").val();if(username.length<5){$("#emailResult").html("<img src='/img/system5/checkNameNo.png' title='Account Name MUST be at least 5 characters'></img>").show()}else{if(!$("#email").val().match(pattern)){$("#emailResult").html("<img src='/img/system5/checkNameNo.png' title='Invalid Character Used.  Only A-Z, 0-9 (no space)'/>").show()}else{if($("#screen_name").val()==$("#email").val()){$("#emailResult").html('<img src="/img/system5/checkNameNo.png" title="Account Name and Alias MUST be different"></img>')}else{$.post("/account/check-name",{email:$("#email").val()},function(response){$("#emailResult").html(unescape(response)).show()})}}}return false});$("#verify_email").blur(function(){var email1=$("#email").val();var email2=$("#verify_email").val();if(email1==email2){$("#emailConfirmResult").html('<img src="/img/system5/checkNameYes.png" title="Emails Match"/>')}else{$("#emailConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Emails MUST Match"/>')}if(email2==""){$("#emailConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Emails can not be blank"/>')}return false});$("#promo_code").blur(function(){var promo_code=$.trim($("#promo_code").val());if(promo_code){$.post("/account/check-promo/",{promo_code:$("#promo_code").val()},function(response){$("#promo_codeResult").html(unescape(response)).show()})}else{$("#promo_codeResult").html("")}return false})},account_key:function(){pattern=/^[a-zA-Z0-9\.@\-_\+~!#%'*?`\{\}]{1,100}$/;$("#email").blur(function(){var username=$("#email").val();if(username.length<5){$("#emailResult").html("<img src='/img/system5/checkNameNo.png' title='Account Name MUST be at least 5 characters'></img>").show()}else{if(!$("#email").val().match(pattern)){$("#emailResult").html("<img src='/img/system5/checkNameNo.png' title='Invalid Character Used.  Only A-Z, 0-9 (no space)'/>").show()}else{if($("#screen_name").val()==$("#email").val()){$("#emailResult").html('<img src="/img/system5/checkNameNo.png" title="Account Name and Alias MUST be different"></img>')}else{$.post("/account/check-name",{email:$("#email").val()},function(response){$("#emailResult").html(unescape(response)).show()})}}}return false});$("#verify_email").blur(function(){var email1=$("#email").val();var email2=$("#verify_email").val();if(email1==email2){$("#emailConfirmResult").html('<img src="/img/system5/checkNameYes.png" title="Emails Match"/>')}else{$("#emailConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Emails MUST Match"/>')}if(email2==""){$("#emailConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Emails can not be blank"/>')}return false})},account_purchase:function(){$("#mykey").keyup(function(){$('input[name="purchase_type"]')[1].checked=true});$("#purchase").click(function(){$("#mykey").val("")});var value=$("#country_code").val();var hiddenState=$("#hiddenSTATE").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state'></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html);hiddenState=$("#hiddenSTATE").val();$("#state option[value='"+hiddenState+"']").attr("selected","selected")}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text' name='state' value='"+hiddenState+"' readonly='readonly' class='OFF'>")}$("#country_code").change(function(){var value=$("#country_code").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state' ></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html)}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text'  name='state' value='' readonly='readonly' class='OFF'>")}});pattern=/^[a-zA-Z0-9\.@\-_\+~!#%'*?`\{\}]{1,100}$/;$("#referrer").blur(function(){if(!$("#referrer").val()==""){if(!$("#referrer").val().match(pattern)){$("#referrerResult").html("<img title='Invalid Character Used.  Only A-Z, 0-9 (no space)' src='/img/system5/checkNameNo.png'/>").show()}else{$.post("/account/check-screen-name/check_type/cp",{screen_name:$("#referrer").val(),check_type:"lookup"},function(response){var response=unescape(response);var referrer=$("#referrer").val();var screen_name=$("#screen_name_check").val();if(referrer==screen_name){response='<img title="You cannot refer yourself." src="/img/system5/checkNameNo.png"/>'}$("#referrerResult").html(response).show()})}return false}else{$("#referrerResult").html("").show()}})},account_create_purchase:function(){pattern=/^[a-zA-Z0-9\.@\-_\+~!#%'*?`\{\}]{1,100}$/;$("#email").blur(function(){var username=$("#email").val();if(username.length<5){$("#emailResult").html("<img src='/img/system5/checkNameNo.png' title='Account Name MUST be at least 5 characters'></img>").show()}else{if(!$("#email").val().match(pattern)){$("#emailResult").html("<img src='/img/system5/checkNameNo.png' title='Invalid Character Used.  Only A-Z, 0-9 (no space)'/>").show()}else{if($("#screen_name").val()==$("#email").val()){$("#emailResult").html('<img src="/img/system5/checkNameNo.png" title="Account Name and Alias MUST be different"></img>')}else{$.post("/account/check-name",{email:$("#email").val()},function(response){$("#emailResult").html(unescape(response)).show()})}}}return false});$("#verify_email").blur(function(){var email1=$("#email").val();var email2=$("#verify_email").val();if(email1==email2){$("#emailConfirmResult").html('<img src="/img/system5/checkNameYes.png" title="Emails Match"></img>')}else{$("#emailConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Emails MUST Match"></img>')}if(email2==""){$("#emailConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Emails can not be blank"></img>')}return false});var value=$("#country_code").val();var hiddenState=$("#hiddenSTATE").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state' ></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html);hiddenState=$("#hiddenSTATE").val();$("#state option[value='"+hiddenState+"']").attr("selected","selected")}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text' name='state' value='"+hiddenState+"' readonly='readonly' class='OFF'>")}$("#country_code").change(function(){var value=$("#country_code").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state' ></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html)}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text'  name='state' value='' readonly='readonly' class='OFF'>")}});$(".tableSelect").click(function(){var TagValue=$(this).attr("value");$(".calc").addClass("CLOSE");$("#package"+TagValue).removeClass("CLOSE")});pattern=/^[a-zA-Z0-9\.@\-_\+~!#%'*?`\{\}]{1,100}$/;$("#referrer").blur(function(){if(!$("#referrer").val()==""){if(!$("#referrer").val().match(pattern)){$("#referrerResult").html("Invalid Character Used.  Only A-Z, 0-9 (no space)").show()}else{$.post("/account/check-screen-name",{screen_name:$("#referrer").val(),check_type:"lookup"},function(response){var response=unescape(response);var referrer=$("#referrer").val();var screen_name=$("span.userName a")[0].text;if(referrer==screen_name){response='<span class="alert">You cannot refer yourself.</span>'}$("#referrerResult").html(response).show()})}return false}else{$("#referrerResult").html("").show()}})},account_confirm_purchase:function(){$("#submit").click(function(){$("#PROCESSING").removeClass("CLOSE");$("#BUTTONREPLACE").hide();return true})},account_confirm_package:function(){$("#submit").click(function(){$("#PROCESSING").removeClass("CLOSE");$("#BUTTONREPLACE").hide();return true})}},group_module:{init:function(){UTIL.Accordian();UTIL.Tables.makeSortable();UTIL.Tables.makePageable();UTIL.Tables.makeFilterable();UTIL.CommentPage();MYALGANON.common.flashMessage();$(".replyheader").click(function(){$(this).next(".replybody").slideToggle();$(this).toggleClass("replyactive");$(this).next(".replybody").toggleClass("active")})},member_index:function(){MYALGANON.common.setLargeCARDHover()},member_list_requests:function(){MYALGANON.common.setLargeCARDHover()},member_manage_members:function(){MYALGANON.common.setMemberCARDHover()}},guilds_module:{init:function(){UTIL.Accordian();UTIL.Tables.makeSortable();UTIL.Tables.makePageable();UTIL.Tables.makeFilterable();UTIL.ReplyForm();UTIL.DiscussionThread();MYALGANON.common.flashMessage();$(".secListNav").click(function(){$(".secListNav").removeClass("secON");$(this).addClass("secON");var section="#sec"+$(this).attr("id");$(".subSec").addClass("subSecClosed");$(section).removeClass("subSecClosed")})},index_privileges:function(){$(".subSecSelector").click(function(){$(this).next(".subSecChange").toggleClass("subSecClosed")})}},tribute_module:{init:function(){UTIL.Tables.makeSortable();UTIL.Tables.makePageable();UTIL.Tables.makeFilterable();MYALGANON.common.tabNav();MYALGANON.common.placeAction();MYALGANON.common.addTribute();MYALGANON.common.marketClaims();MYALGANON.common.flashMessage()},index_purchase:function(){var value=$("#country_code").val();var hiddenState=$("#hiddenSTATE").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state'></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html);hiddenState=$("#hiddenSTATE").val();$("#state option[value='"+hiddenState+"']").attr("selected","selected")}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text' name='state' value='"+hiddenState+"' readonly='readonly' class='OFF'>")}$("#country_code").change(function(){var value=$("#country_code").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state' ></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html)}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text'  name='state' value='' readonly='readonly' class='OFF'>")}})},index_confirm_purchase:function(){$("#submit").click(function(){$("#PROCESSING").removeClass("CLOSE");$("#BUTTONREPLACE").hide()})},index_items:function(){MYALGANON.common.populateAction()},index_boons:function(){MYALGANON.common.populateAction()},index_services:function(){MYALGANON.common.populateAction()}},characters_module:{init:function(){MYALGANON.common.flashMessage();UTIL.leftRight()},index_index:function(){$(".toggleSearch").click(function(){var name=$(this).attr("id");var showID=name.substring(3,name.length);if(showID=="archBTN"){$("#asearch").removeClass("hide");$("#characterSearch").addClass("hide")}else{$("#characterSearch").removeClass("hide");$("#asearch").addClass("hide")}});UTIL.Tables.makeSortable();UTIL.Tables.makePageable();UTIL.Tables.makeFilterable()},index_character:function(){$(".TOOLTIP").mouseover(MYALGANON.Tooltips.charHoverOn).mousemove(MYALGANON.Tooltips.charHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".centerStatsLabelwSub").click(function(){if($(this).hasClass(".less")){$(this).next(".statSub").addClass("hide");$(this).removeClass("less");$(".statSub").addClass("hide");$(".centerStatsLabelwSub").removeClass("less")}else{$(".statSub").addClass("hide");$(".centerStatsLabelwSub").removeClass("less");$(this).next(".statSub").removeClass("hide");$(this).addClass("less")}})},index_abilities:function(){$(".abilityTreeBranch").attr({scrollTop:$(".abilityTreeBranch").attr("scrollHeight")});$(".abilityTreeRoot").click(function(){var abilityTree="#tb"+$(this).attr("id");$(".abilityTreeBranch").hide();$(abilityTree).show();$(".abilityTreeRoot").removeClass("ACTIVE");$(this).addClass("ACTIVE");$(abilityTree).attr({scrollTop:$(abilityTree).attr("scrollHeight")})});$(".rank").strokeme()},index_studies:function(){$(".studyHeader").click(function(){$(this).toggleClass("studyClose");$(this).toggleClass("studyOpen");$(this).next(".subStudies").toggle()});$(".studiesHeader").click(function(){$(this).toggleClass("studyOpen");$(this).toggleClass("studyClose");$(this).next(".studiesBody").toggle()});$(".studyDetail").click(function(){$(".studyDetail").removeClass("selectedStudy");$(this).addClass("selectedStudy");var studyID=$(this).attr("id");var studyInspector=studyID;var study=MYALGANON.characters_module.studies[studyID];html='<div class="studiesIcon"><img src="/img/library/icons/'+study.iconFileName+'" alt="" /></div>';html+='<div class="studiesText">';html+="<p>"+study.name+"</p>";html+="<p>"+study.description+"</p>";html+="</div>";$(".studiesInspectorDetail").html(html)})},index_mail:function(){$(".emailSubject").click(function(){$(this).toggleClass("emailClose");$(this).toggleClass("emailOpen");$(this).next(".emailBody").toggle()})}},library_module:{mapZoom:function(){$(".MAPZOOM").click(function(){var FILENAME=$(this).attr("src");var CUTNAME=FILENAME.slice(0,-4);var CHECKER=FILENAME.slice(-5);var ZOOM="";if(CHECKER=="Z.jpg"){ZOOM=CUTNAME.slice(0,-1)+".jpg";$(this).removeClass("ZOOMED")}else{ZOOM=CUTNAME+"Z.jpg";$(this).addClass("ZOOMED")}$(this).attr("src",ZOOM);MYALGANON.library_module.plotPins();$(".pushpin").mouseover(MYALGANON.Tooltips.pushpinHoverOn).mousemove(MYALGANON.Tooltips.pushpinHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)})},plotPins:function(){$("#mappins > span").remove();$mappins=$("#mappins");scale_factor=$mappins.find("img").hasClass("ZOOMED")?0.5625:0.3125;area_id=$mappins.attr("class");for(i in MYALGANON.Tooltips.positions[area_id]){position=MYALGANON.Tooltips.positions[area_id][i];if(position.x!==undefined){$span=$("<span id="+(position.x)+"_"+(position.y)+' class="pushpin"></span>');$span.css({left:(position.x*scale_factor)+"px",top:((position.y*scale_factor)-10)+"px"});$mappins.append($span)}}},locationUpdate:function(){$(".libDETAILlocations > a").click(function(){id=this.id.split("_")[2];$("#mappins > img").attr("src","http://static.myalganon.com/img/library/maps/"+MYALGANON.Tooltips.positions[id].filename).removeClass("ZOOMED");$(this).addClass("MAPON").siblings().removeClass("MAPON");$("#mappins").removeClass().addClass(id);MYALGANON.library_module.plotPins();$(".pushpin").mouseover(MYALGANON.Tooltips.pushpinHoverOn).mousemove(MYALGANON.Tooltips.pushpinHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)})},init:function(){$(".asearchBTN").click(function(){$("#libASEARCH").toggle()});$(".addConsignment").click(function(){var value=$(this).attr("id");$.ajax({type:"GET",url:"/library/items/add-consignment/item_id/"+value});return false});UTIL.Tables.makeSortable();UTIL.Tables.makePageable();UTIL.Tables.makeFilterable();MYALGANON.common.flashMessage();$(".faqHeader").click(function(){$(".faqBody").addClass("CLOSE");$(".faqHeader").removeClass("faqSelected");$(this).addClass("faqSelected");$(this).next(".faqBody").removeClass("CLOSE")});$(".filterbox").val("Search within results...");$(".filterbox").click(function(){var name=$(this).attr("id");$(this).val("");$(this).blur(function(){$(this).val("Search within results...")})});$("#asearchreset").click(function(){$("#asearchtitle").val("");$("#asearchminlevel").val("");$("#asearchmaxlevel").val("");$("#asearchslottype").val("");$("#asearchitemquality").val("");$("#asearchnpcquality").val("");$("#asearchsubtype").val("");return false});$("#LIBquery").val("Search the database...");$("#LIBquery").focus(function(){$("#LIBquery").val("")});$("#LIBHOME").hover(function(){$("#libHEAD").addClass("LIBHOMEON")},function(){$("#libHEAD").removeClass("LIBHOMEON")});$("#asearchBTN").hover(function(){$("#asearchBTN").addClass("ASEARCHON")},function(){$("#asearchBTN").removeClass("ASEARCHON")});$(".abilityTreeBranch").attr({scrollTop:$(".abilityTreeBranch").attr("scrollHeight")});$(".abilityTreeRoot").click(function(){var abilityTree="#tb"+$(this).attr("id");$(".abilityTreeBranch").hide();$(abilityTree).show();$(".abilityTreeRoot").removeClass("ACTIVE");$(this).addClass("ACTIVE");$(abilityTree).attr({scrollTop:$(abilityTree).attr("scrollHeight")})})},objects_details:function(){MYALGANON.common.tabNav();MYALGANON.library_module.mapZoom();MYALGANON.library_module.plotPins();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".pushpin").mouseover(MYALGANON.Tooltips.pushpinHoverOn).mousemove(MYALGANON.Tooltips.pushpinHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},objects_object_details:function(){MYALGANON.common.tabNav();MYALGANON.library_module.mapZoom();MYALGANON.library_module.plotPins();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".pushpin").mouseover(MYALGANON.Tooltips.pushpinHoverOn).mousemove(MYALGANON.Tooltips.pushpinHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},objects_resource_details:function(){MYALGANON.common.tabNav();MYALGANON.library_module.mapZoom();MYALGANON.library_module.plotPins();MYALGANON.library_module.locationUpdate();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".pushpin").mouseover(MYALGANON.Tooltips.pushpinHoverOn).mousemove(MYALGANON.Tooltips.pushpinHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},areas_details:function(){MYALGANON.common.tabNav();MYALGANON.library_module.mapZoom();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},skills_details:function(){MYALGANON.common.tabNav();MYALGANON.library_module.mapZoom();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},items_list:function(){$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},items_details:function(){MYALGANON.common.tabNav();MYALGANON.common.commentReply();$(".reagent_amount").strokeme();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.recipeNAMELink").mouseover(MYALGANON.Tooltips.recipeHoverOn).mousemove(MYALGANON.Tooltips.recipeHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},npc_spawn_details:function(){MYALGANON.common.tabNav();MYALGANON.library_module.mapZoom();MYALGANON.library_module.plotPins();MYALGANON.library_module.locationUpdate();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".pushpin").mouseover(MYALGANON.Tooltips.pushpinHoverOn).mousemove(MYALGANON.Tooltips.pushpinHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},npc_instance_details:function(){MYALGANON.common.tabNav();MYALGANON.library_module.mapZoom();MYALGANON.library_module.plotPins();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("td .libSKILLICON").mouseover(MYALGANON.Tooltips.skillHoverOn).mousemove(MYALGANON.Tooltips.skillHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("td .libACTIONICON").mouseover(MYALGANON.Tooltips.actionHoverOn).mousemove(MYALGANON.Tooltips.actionHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("td .libSTUDYICON").mouseover(MYALGANON.Tooltips.studyHoverOn).mousemove(MYALGANON.Tooltips.studyHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.skillNAMELink").mouseover(MYALGANON.Tooltips.skillHoverOn).mousemove(MYALGANON.Tooltips.skillHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.recipeNAMELink").mouseover(MYALGANON.Tooltips.recipeHoverOn).mousemove(MYALGANON.Tooltips.recipeHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.actionNAMELink").mouseover(MYALGANON.Tooltips.actionHoverOn).mousemove(MYALGANON.Tooltips.actionHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.studyNAMELink").mouseover(MYALGANON.Tooltips.studyHoverOn).mousemove(MYALGANON.Tooltips.studyHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".pushpin").mouseover(MYALGANON.Tooltips.pushpinHoverOn).mousemove(MYALGANON.Tooltips.pushpinHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".reagent_amount").strokeme()},quests_list:function(){$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".itemRewardAmount").strokeme()},recipes_list:function(){$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.recipeNAMELink").mouseover(MYALGANON.Tooltips.recipeHoverOn).mousemove(MYALGANON.Tooltips.recipeHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".reagent_amount").strokeme()},recipes_details:function(){MYALGANON.common.tabNav();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff)},studies_details:function(){MYALGANON.common.tabNav();$(".itemRewardAmount").strokeme()},quests_details:function(){MYALGANON.common.tabNav();$("td .libICON").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("td .libSKILLICON").mouseover(MYALGANON.Tooltips.skillHoverOn).mousemove(MYALGANON.Tooltips.skillHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("td .libACTIONICON").mouseover(MYALGANON.Tooltips.actionHoverOn).mousemove(MYALGANON.Tooltips.actionHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("td .libSTUDYICON").mouseover(MYALGANON.Tooltips.studyHoverOn).mousemove(MYALGANON.Tooltips.studyHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.itemNAMELink").mouseover(MYALGANON.Tooltips.itemHoverOn).mousemove(MYALGANON.Tooltips.itemHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.skillNAMELink").mouseover(MYALGANON.Tooltips.skillHoverOn).mousemove(MYALGANON.Tooltips.skillHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.recipeNAMELink").mouseover(MYALGANON.Tooltips.recipeHoverOn).mousemove(MYALGANON.Tooltips.recipeHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.actionNAMELink").mouseover(MYALGANON.Tooltips.actionHoverOn).mousemove(MYALGANON.Tooltips.actionHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.studyNAMELink").mouseover(MYALGANON.Tooltips.studyHoverOn).mousemove(MYALGANON.Tooltips.studyHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$("a.questNAMELink").mouseover(MYALGANON.Tooltips.questHoverOn).mousemove(MYALGANON.Tooltips.questHoverOn).mouseout(MYALGANON.Tooltips.toolTipHoverOff);$(".itemRewardAmount").strokeme();$(".QUESTCARDHDR").click(function(){$(this).prev(".QUESTCARDSTATUS").toggleClass("open");$(this).next().next(".QUESTCARDBDY").toggle()})},index_index:function(){$(".cardMARK").mouseover(function(){var show="#card"+$(this).attr("id");$(show).addClass("tkShow")});$(".cardMARK").mousemove(function(){var show="#card"+$(this).attr("id");$(show).addClass("tkShow")});$(".cardMARK").mouseout(function(){var show="#card"+$(this).attr("id");$(show).removeClass("tkShow")})}},myprofile_module:{init:function(){UTIL.Accordian();UTIL.Tables.makeSortable();UTIL.Tables.makePageable();UTIL.Tables.makeFilterable();UTIL.ControlMenu();MYALGANON.common.tabNav();MYALGANON.common.flashMessage();UTIL.streamCommentSubmit();UTIL.showCommentForm();UTIL.showComments();$(".CHECKALL").click(function(){$("INPUT[type='checkbox']").attr("checked",$(".CHECKALL").is(":checked"))});$(".streamCommentBody").jTruncate()},index_purchase:function(){var value=$("#country_code").val();var hiddenState=$("#hiddenSTATE").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state' tabindex=8></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html);hiddenState=$("#hiddenSTATE").val();$("#state option[value='"+hiddenState+"']").attr("selected","selected")}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text' name='state' value='"+hiddenState+"' readonly='readonly' class='OFF'>")}$("#country_code").change(function(){var value=$("#country_code").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state' tabindex=8></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html)}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text'  name='state' value='' readonly='readonly' class='OFF'>")}});$(".tableSelect").click(function(){var TagValue=$(this).attr("value");$(".calc").addClass("CLOSE");$("#package"+TagValue).removeClass("CLOSE")});pattern=/^[a-zA-Z0-9\.@\-_\+~!#%'*?`\{\}]{1,100}$/;$("#referrer").blur(function(){if(!$("#referrer").val()==""){if(!$("#referrer").val().match(pattern)){$("#referrerResult").html("Invalid Character Used.  Only A-Z, 0-9 (no space)").show()}else{$.post("/account/check-screen-name",{screen_name:$("#referrer").val(),check_type:"lookup"},function(response){var response=unescape(response);var referrer=$("#referrer").val();var screen_name=$("span.userName a")[0].text;if(referrer==screen_name){response='<span class="alert">You cannot refer yourself.</span>'}$("#referrerResult").html(response).show()})}return false}else{$("#referrerResult").html("").show()}})},index_redeem:function(){pattern=/^[a-zA-Z0-9\.@\-_\+~!#%'*?`\{\}]{1,100}$/;$("#referrer").blur(function(){if(!$("#referrer").val()==""){if(!$("#referrer").val().match(pattern)){$("#referrerResult").html("Invalid Character Used.  Only A-Z, 0-9 (no space)").show()}else{$.post("/account/check-screen-name",{screen_name:$("#referrer").val(),check_type:"lookup"},function(response){var response=unescape(response);var referrer=$("#referrer").val();var screen_name=$("span.userName a")[0].text;if(referrer==screen_name){response='<span class="alert">You cannot refer yourself.</span>'}$("#referrerResult").html(response).show()})}return false}else{$("#referrerResult").html("").show()}})},index_subscribe:function(){var value=$("#country_code").val();var hiddenState=$("#hiddenSTATE").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state' tabindex=8></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html);hiddenState=$("#hiddenSTATE").val();$("#state option[value='"+hiddenState+"']").attr("selected","selected")}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text' name='state' value='"+hiddenState+"' readonly='readonly' class='OFF'>")}$(".tableSelect").click(function(){var TagValue=$(this).attr("value");$(".calc").addClass("CLOSE");$("#package"+TagValue).removeClass("CLOSE")});$("#country_code").change(function(){var value=$("#country_code").val();if(value=="US"){$("#state").remove();$("#STATEBOX").append("<select id='state' name='state' tabindex=8></select>");$.ajax({type:"GET",url:"/index/get-states/country_code/"+value,success:function(html){$("#state").html(html)}})}else{$("#state").remove();$("#STATEBOX").append("<input id='state' type='text'  name='state' value='' readonly='readonly' class='OFF'>")}})},index_promo_code:function(){$("#promo_code").blur(function(){var promo_code=$("#promo_code").val();if(promo_code){$.post("/account/check-promo/",{promo_code:$("#promo_code").val()},function(response){$("#promo_codeResult").html(unescape(response)).show()})}else{$("#promo_codeResult").html('<img src="/img/system5/checkNameNo.png" title="Invalid Promo Code"/>')}return false})},index_update_account_id:function(){pattern=/^[a-zA-Z0-9\.@\-_\+~!#%'*?`\{\}]{1,100}$/;$("#account_name").blur(function(){var username=$("#account_name").val();if(username.length<5){$("#account_nameResult").html("<img src='/img/system5/checkNameNo.png' title='Account Name MUST be at least 5 characters'></img>").show()}else{if(!$("#account_name").val().match(pattern)){$("#account_nameResult").html("<img src='/img/system5/checkNameNo.png' title='Invalid Character Used.  Only A-Z, 0-9 (no space)'/>").show()}else{if($("#account_name").val()==$("#alias").val()){$("#account_nameResult").html('<img src="/img/system5/checkNameNo.png" title="Account Name and Alias MUST be different"></img>')}else{$.post("/account/check-name",{email:$("#account_name").val()},function(response){$("#account_nameResult").html(unescape(response)).show()})}}}return false});$("#alias").blur(function(){var alias=$("#alias").val();if(alias.length<5){$("#aliasResult").html("<img src='/img/system5/checkNameNo.png' title='Screen Name MUST be at least 5 characters'></img>").show()}else{if(!$("#alias").val().match(pattern)){$("#aliasResult").html("<img src='/img/system5/checkNameNo.png' title='Invalid Character Used. Only A-Z, 0-9 (no space)'/>").show()}else{if($("#alias").val().toLowerCase()==$("#account_name").val().toLowerCase()){$("#aliasResult").html('<img src="/img/system5/checkNameNo.png" title="Account Name and Alias MUST be different"></img>')}else{$.post("/account/check-screen-name",{screen_name:$("#alias").val()},function(response){$("#aliasResult").html(unescape(response)).show()})}}}return false});$("#verify_alias").blur(function(){var alias1=$("#alias").val();var alias2=$("#verify_alias").val();if(alias1==alias2){$("#aliasConfirmResult").html('<img src="/img/system5/checkNameYes.png" title="Alias Match"/>')}else{$("#aliasConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Alias MUST Match"/>')}if(alias2==""){$("#aliasConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Alias can not be blank"/>')}return false});$("#verify_account_name").blur(function(){var account_name1=$("#account_name").val();var account_name2=$("#verify_account_name").val();if(account_name1==account_name2){$("#account_nameConfirmResult").html('<img src="/img/system5/checkNameYes.png" title="Account Names Match"/>')}else{$("#account_nameConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Account Names MUST Match"/>')}if(account_name2==""){$("#account_nameConfirmResult").html('<img src="/img/system5/checkNameNo.png" title="Account Names can not be blank"/>')}return false})},tickets_add_ticket:function(){$("#world_id").change(function(){var value=$("#world_id").val();$.ajax({type:"GET",url:"/myprofile/tickets/list-characters/world_id/"+value,success:function(html){$("#char_id").html(html)}})})},stream_index:function(){$(".statusButton").click(function(){var status=$("#myStatus").attr("value");var profile_id=$("#myStatusID").attr("value");if(status==""){alert("Please comment on your status");$("#myStatus").focus();return false}else{var dataString="profile_id="+profile_id+"&status="+status;$.ajax({type:"POST",url:"/myprofile/stream/add-status-update/",data:dataString,success:function(html){if(html.indexOf("streamComment")==-1){var errorText='<div class="error">Unable to process, please try again later.</div>';$("#myStatus").after(errorText)}else{$(".error").hide();$(".streamEntryLine").before(html)}}});return false}})},friend_index:function(){MYALGANON.common.setLargeCARDHover()},friend_list_requests:function(){MYALGANON.common.setLargeCARDHover()},friend_pending_friends:function(){MYALGANON.common.setLargeCARDHover()},index_comment:function(){$(".mypcomLINE .mypcomSUMMARY").hover(function(){$(this).css({height:"100%"})},function(){$(this).css({height:"20px"})})},index_groups:function(){MYALGANON.common.setLargeCARDHover()},index_select_group:function(){MYALGANON.common.setLargeCARDHover()},index_subscriptions:function(){$("#payment").css("listStyle","none");$("#payment_open").hide()},media_list_picture_albums:function(){MYALGANON.common.setLargeCARDHover()},media_list_pictures:function(){MYALGANON.common.setLargeCARDHover();MYALGANON.common.setLargeCARDPENDHover();UTIL.MediaRatings.init()},media_view_picture:function(){UTIL.MediaRatings.init()},message_compose:function(){$("#screen_names").autocomplete("/myprofile/message/friend-search");$("#body").each(function(){var length=$(this).val().length;$("#COUNTER").html(length);if(length>=2048){$("#charCount").addClass("ALERT")}else{$("#charCount").removeClass("ALERT")}});$("#body").keyup(function(){var length=$(this).val().length;$("#COUNTER").html(length);if(length>=2048){$("#charCount").addClass("ALERT")}else{$("#charCount").removeClass("ALERT")}})},index_character_transfer:function(){$("#world_id").change(function(){var value=$("#world_id").val();$.ajax({type:"GET",url:"/myprofile/tickets/list-characters/world_id/"+value,success:function(html){$("#char_id").html(html)}})});$("#destWorld_id").change(function(){var destWorld=$("#destWorld_id").val();if(destWorld=="-1"){$(".transferText").html("Copy To")}else{$(".transferText").html("Transfer To")}})},index_character_rename:function(){$("#world_id").change(function(){var value=$("#world_id").val();$.ajax({type:"GET",url:"/myprofile/tickets/list-characters/world_id/"+value,success:function(html){$("#char_id").html(html)}})})},subscription_payment_method:function(){$(".header").click(function(){if($(this).hasClass("headerClose")){$(".header").addClass("headerClose");$(".header").next(".content").slideUp();$(this).removeClass("headerClose");$(this).next(".content").slideDown()}})}},profile_module:{init:function(){UTIL.Tables.makeSortable();UTIL.Tables.makePageable();UTIL.Tables.makeFilterable();MYALGANON.common.flashMessage();UTIL.streamCommentSubmit();UTIL.showCommentForm();UTIL.showComments();$(".streamCommentBody").jTruncate()},friend_index:function(){MYALGANON.common.setLargeCARDHover()},index_groups:function(){MYALGANON.common.setLargeCARDHover()},media_list_picture_albums:function(){MYALGANON.common.setLargeCARDHover()},media_list_pictures:function(){MYALGANON.common.setLargeCARDHover();UTIL.MediaRatings.init()},media_view_picture:function(){UTIL.MediaRatings.init()}}};MYALGANON.Tooltips={items:null,quests:null,buildHeader:function(hasIcon,iconFileName){lines="";if(hasIcon===true){lines+='<div id="TOOLTIPICON">';lines+='  <span class="itemIcon"><img src="http://static.myalganon.com/img/library/icons/'+iconFileName+'" alt="" /></span>';lines+="</div>"}lines+='<div id="TOOLTIPHOLD">';lines+='  <div id="TOOLTIPHDR"></div>';lines+='  <div id="TOOLTIPBDY">';return lines},buildFooter:function(){lines="  </div>";lines+='  <div id="TOOLTIPFTR"></div>';lines+="</div>";return lines},buildNavHeader:function(){lines='<div id="NAVTOOLTIPHOLD">';lines+='  <div id="NAVTOOLTIPHDR"></div>';lines+='  <div id="NAVTOOLTIPBDY">';return lines},buildNavFooter:function(){lines="  </div>";lines+='  <div id="NAVTOOLTIPFTR"></div>';lines+="</div>";return lines},buildAction:function(action_id){tooltip=this.actions[action_id];lines=this.buildHeader(true,tooltip.iconFileName);lines+='  <span class="actionName">'+tooltip.name+"</span>";lines+='  <span class="rankName">'+tooltip.rankName+"</span>";lines+='  <span class="actionCost">'+tooltip.costValue+" "+tooltip.costPowerType+"</span>";lines+='  <span class="activationTime">';if(tooltip.activationTime===0){lines+="Instant"}else{lines+=tooltip.activationTime}lines+="</span>";lines+=' <span class="description">'+tooltip.description+"</span>";lines+=this.buildFooter();return lines},actionHoverOn:function(e){action_id=this.id.split("_")[1];$("#libTOOLTIP").html(MYALGANON.Tooltips.buildAction(action_id));MYALGANON.Tooltips.hoverOnHelper(e)},buildItem:function(item_id,buildHeaderFooter){tooltip=this.items[item_id];lines="";if(buildHeaderFooter!==false){lines+=this.buildHeader(true,tooltip.iconFileName)}lines+='  <div id="TOOLTIPDESC">';lines+='    <span class="ItemQuality_'+tooltip.itemQuality_id+'">'+tooltip.name+"</span>";if(tooltip.bindOn!="None"){lines+='    <span class="descColor">'+tooltip.bindOn+"</span>"}switch(tooltip.itemType){case"Armor":lines+='    <span class="typeColor">'+tooltip.isUnique===1?"Unique ":""+tooltip.armorType+" ("+tooltip.slotType+")</span>";if(tooltip.Res_Physical){lines+='    <span class="descColor">'+tooltip.Res_Physical+" Protection</span>"}if(tooltip.Res_Fire){lines+='    <span class="descColor">'+tooltip.Res_Fire+" Fire</span>"}if(tooltip.Res_Cold){lines+='    <span class="descColor">'+tooltip.Res_Cold+" Cold</span>"}if(tooltip.Res_Electrical){lines+='    <span class="descColor">'+tooltip.Res_Electrical+" Electrical</span>"}if(tooltip.Res_Essence){lines+='    <span class="descColor">'+tooltip.Res_Essence+" Essence</span>"}if(tooltip.Res_Wrath){lines+='    <span class="descColor">'+tooltip.Res_Wrath+" Wrath</span>"}if(tooltip.Durability){lines+='  <span class="descColor">Durability '+tooltip.Durability+"/"+tooltip.Durability+"</span>"}break;case"Weapon":$slotType=tooltip.slotType;if(tooltip.isTwoHanded==1){$slotType="Two Handed"}lines+='    <span class="typeColor">'+tooltip.isUnique===1?"Unique ":""+tooltip.weaponType+" ("+$slotType+")</span>";lines+='    <span class="descColor">'+tooltip.MinDamage+" - "+tooltip.MaxDamage+" Damage ("+tooltip.speed+" spd | "+tooltip.dps+" dps)</span>";if(tooltip.Durability){lines+='  <span class="descColor">Durability '+tooltip.Durability+"/"+tooltip.Durability+"</span>"}break;case"General Item":if(tooltip.StartsQuest){lines+='    <span class="descColor">This item begins a quest!</span>';lines+='    <span class="descColor">Requires level: '+tooltip.Quest_minLevel+"</span>"}break;case"Container":lines+='    <span class="descColor">Container</span>';lines+='    <span class="descColor">'+tooltip.numSlots+"</span>";break;case"Consumable":var temp=new Array();lines+='    <span class="descColor">';i=0;if(tooltip.Hits!==0){temp[i]=tooltip.Hits+" hits";i++}if(tooltip.Focus!==0){temp[i]=tooltip.Focus+" focus";i++}if(tooltip.Anger){temp[i]=tooltip.Anger+" anger";i++}if(tooltip.Sense!==0){temp[i]=tooltip.Sense+" sense";i++}temp=temp.join(",");if(tooltip.Duration){temp+=" over "+tooltip.Duration+" seconds"}lines+=temp+"</span>";break;default:break}if(tooltip.itemType=="Weapon"||tooltip.itemType=="Armor"){temp1=tooltip.ItemModifiers.split("|");temp2=tooltip.RequiredObjectsToolTip.split("|");for(i in temp1){lines+='    <span class="modifierColor">'+temp1[i]+"</span>"}if(tooltip.charLevel){lines+='    <span class="regColor">Requires Level '+tooltip.charLevel+"</span>"}for(i in temp2){lines+='    <span class="regColor">'+temp2[i]+"</span>"}}if(tooltip.set_id){lines+='    <span class="setNameColor">'+tooltip.setInfo[0].name+"(0/"+tooltip.setItems.length+")</span>";for(i in tooltip.setItems){lines+='    <span class="setMissingItemColor">'+tooltip.setItems[i].name+"</span>"}for(i in tooltip.setInfo){lines+='    <span class="setMissingItemColor">('+tooltip.setInfo[i].count+") Set: "+tooltip.setInfo[i].description+"</span>"}}lines+="  </div>";if(buildHeaderFooter!==false){lines+=this.buildFooter()}return lines},itemHoverOn:function(e){item_id=this.id.split("_")[1];$("#libTOOLTIP").html(MYALGANON.Tooltips.buildItem(item_id));MYALGANON.Tooltips.hoverOnHelper(e)},mouseoverHoverOn:function(e){message=$("#mouseOverMessage").attr("title");$("#libTOOLTIP").html(MYALGANON.Tooltips.buildMouseover(message));MYALGANON.Tooltips.mouseOnHelper(e)},buildMouseover:function(message){lines=this.buildNavHeader();lines+=(message);lines+=this.buildNavFooter();return lines},pushpinHoverOn:function(e){Plong=this.id.split("_")[0];Plat=this.id.split("_")[1];$("#libTOOLTIP").html(MYALGANON.Tooltips.buildPushpin(Plong,Plat));MYALGANON.Tooltips.hoverOnHelper(e)},buildPushpin:function(Plong,Plat){lines=this.buildNavHeader();lines+=(Plong+", "+Plat);lines+=this.buildNavFooter();return lines},buildQuest:function(quest_id){tooltip=this.quests[quest_id];lines="";needs="";lines=this.buildHeader();lines+='    <div id="TOOLTIPDESC">';lines+='      <span class="QUESTNAME">'+tooltip.name+"</span>";lines+='      <span class="QUESTLVL">Level '+tooltip.minLevel+"</span>";lines+="    </div>";lines+='    <span class="QUESTOBJECTIVE">'+tooltip.objectiveText+"</span>";if(tooltip.need_array!==""){lines+='    <span class="QUESTREQUIREMENTS">Requirements</span>';lines+="    <ul>";needs=UTIL.Functions.explode("|",tooltip.need_array);for(i in needs){lines+="      <li>"+needs[i]+"</li>"}lines+="    </ul>"}lines+=this.buildFooter();return lines},questHoverOn:function(e){quest_id=this.id.split("_")[1];$("#libTOOLTIP").html(MYALGANON.Tooltips.buildQuest(quest_id));MYALGANON.Tooltips.hoverOnHelper(e)},buildRecipe:function(recipe_id,item_id){tooltip=this.recipes[recipe_id];reagents=new Array();lines=this.buildHeader(true,tooltip.makesItemIconFileName);lines+='    <span class="ItemQuality_'+tooltip.makesItemItemQuality_id+'">'+tooltip.name+"</span>";lines+='    <span class="creationTime">'+tooltip.creationTime+" seconds to craft</span>";lines+="Reagents:";for(i in tooltip.ReagentArray){reagents[i]="      "+tooltip.ReagentArray[i].name+" ("+tooltip.ReagentArray[i].amount+")"}lines+='    <span class="reagents">'+reagents.join(", ")+"</span>";lines+=MYALGANON.Tooltips.buildItem(item_id,false);lines+=this.buildFooter();return lines},recipeHoverOn:function(e){recipe_id=this.id.split("_")[1];item_id=this.id.split("_")[2];$("#libTOOLTIP").html(MYALGANON.Tooltips.buildRecipe(recipe_id,item_id));MYALGANON.Tooltips.hoverOnHelper(e)},buildPackageItem:function(e){var HOVERME=$(this).attr("id");lines=$("#H"+HOVERME).html();$("#libTOOLTIP").html(lines);MYALGANON.Tooltips.hoverOnHelper(e)},buildSkill:function(skill_id){tooltip=this.skills[skill_id];lines=this.buildHeader(true,tooltip.iconFileName);lines+='    <span class="SKILLNAME">'+tooltip.name+"</span>";lines+='    <span class="SKILLDESCRIPTION">'+tooltip.description+"</span>";lines+=this.buildFooter();return lines},skillHoverOn:function(e){skill_id=this.id.split("_")[1];$("#libTOOLTIP").html(MYALGANON.Tooltips.buildSkill(skill_id));MYALGANON.Tooltips.hoverOnHelper(e)},buildStudy:function(study_id){tooltip=this.studies[study_id];lines=this.buildHeader(true,tooltip.iconFileName);lines+='    <span class="studyName">'+tooltip.name+"</span>";lines+='    <span class="studyDescription">'+tooltip.description+"</span>";lines+=this.buildFooter();return lines},studyHoverOn:function(e){study_id=this.id.split("_")[1];$("#libTOOLTIP").html(MYALGANON.Tooltips.buildStudy(study_id));MYALGANON.Tooltips.hoverOnHelper(e)},mouseOnHelper:function(e){var offsetX=15;var offsetY=-15;var viewX=window.innerWidth;var positionX=e.pageX;if(positionX+250>viewX){offsetX=-105}$("#libTOOLTIP").css({position:"absolute",top:(e.pageY+offsetY),left:(e.pageX+offsetX)});$("#libTOOLTIP").show()},hoverOnHelper:function(e){var offsetX=15;var offsetY=-100;var viewX=window.innerWidth;var positionX=e.pageX;if(positionX+250>viewX){offsetX=-215}$("#libTOOLTIP").css({position:"absolute",top:(e.pageY+offsetY),left:(e.pageX+offsetX)});$("#libTOOLTIP").show()},charHoverOn:function(e){item_id=this.id.split("_")[1];$("#libTOOLTIP").html(MYALGANON.Tooltips.buildItem(item_id));MYALGANON.Tooltips.hoverOnHelper(e)},toolTipHoverOff:function(){$("#libTOOLTIP").hide()}};UTIL={fire:function(func,funcname,args){var nameSpace=MYALGANON;funcname=(funcname===undefined)?"init":funcname;if(func!==""&&nameSpace[func]&&typeof nameSpace[func][funcname]=="function"){nameSpace[func][funcname](args)}},loadEvents:function(){var bodyId=document.body.id;UTIL.fire("common");UTIL.fire(bodyId);$.each(document.body.className.split(/\s+/),function(i,classnm){UTIL.fire(bodyId,classnm)});UTIL.fire("common","finalize");$(document).trigger("finalized")}};UTIL.Functions={basename:function(path,suffix){var b=path.replace(/^.*[\/\\]/g,"");if(typeof(suffix)=="string"&&b.substr(b.length-suffix.length)==suffix){b=b.substr(0,b.length-suffix.length)}return b},dirname:function(path){return path.replace(/\\/g,"/").replace(/\/[^\/]*\/?$/,"")},explode:function(delimiter,string,limit){var emptyArray={0:""};if(arguments.length<2||typeof arguments[0]=="undefined"||typeof arguments[1]=="undefined"){return null}if(delimiter===""||delimiter===false||delimiter===null){return false}if(typeof delimiter=="function"||typeof delimiter=="object"||typeof string=="function"||typeof string=="object"){return emptyArray}if(delimiter===true){delimiter="1"}if(!limit){return string.toString().split(delimiter.toString())}else{var splitted=string.toString().split(delimiter.toString());var partA=splitted.splice(0,limit-1);var partB=splitted.join(delimiter.toString());partA.push(partB);return partA}},floatval:function(mixed_var){return(parseFloat(mixed_var)||0)},implode:function(glue,pieces){return((pieces instanceof Array)?pieces.join(glue):pieces)},in_array:function(needle,haystack,argStrict){var found=false,key,strict=!!argStrict;for(key in haystack){if((strict&&haystack[key]===needle)||(!strict&&haystack[key]===needle)){found=true;break}}return found},intval:function(mixed_var,base){var tmp;if(typeof(mixed_var)=="string"){tmp=parseInt(mixed_var*1,10);if(isNaN(tmp)||!isFinite(tmp)){return 0}else{return tmp.toString(base||10)}}else{if(typeof(mixed_var)=="number"&&isFinite(mixed_var)){return Math.floor(mixed_var)}else{return 0}}},ip2long:function(ip_address){var output=false;if(ip_address.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)){var parts=ip_address.split(".");var retval=0;retval=(parts[0]*Math.pow(256,3))+(parts[1]*Math.pow(256,2))+(parts[2]*Math.pow(256,1))+(parts[3]*Math.pow(256,0))}return retval},ltrim:function(str,charlist){charlist=!charlist?" s\xA0":(charlist+"").replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,"$1");var re=new RegExp("^["+charlist+"]+","g");return(str+"").replace(re,"")},rtrim:function(str,charlist){charlist=!charlist?" s\xA0":(charlist+"").replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,"$1");var re=new RegExp("["+charlist+"]+$","g");return(str+"").replace(re,"")},trim:function(str,charlist){var whitespace;if(!charlist){whitespace=" \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000"}else{whitespace=charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,"$1")}for(var i=0;i<str.length;i++){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(i);break}}for(i=str.length-1;i>=0;i--){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(0,i+1);break}}return whitespace.indexOf(str.charAt(0))==-1?str:""}};UTIL.Filter={Alnum:{allowWhiteSpace:false,filter:function(value){whitespace=UTIL.Filter.Alnum.allowWhiteSpace?"s":"";pattern="/[^a-zA-Z0-9"+whitespace+"]/";return value.replace(pattern,"")}},Alpha:{allowWhiteSpace:false,filter:function(value){whitespace=UTIL.Filter.Alpha.allowWhiteSpace?"s":"";pattern="/[^a-zA-z"+whitespace+"]/";return value.replace(pattern,"")}},BaseName:{filter:function(value){return UTIL.Functions.basename(value)}},Digits:{filter:function(value){return value.replace(/[^0-9]/,"")}},Dir:{filter:function(value){return UTIL.Functions.dirname(value)}},HtmlEntities:{filter:function(value){var div=document.createElement("div");var text=document.createTextNode(value);div.appendChild(text);return div.innerHTML}},Int:{filter:function(value){return UTIL.Functions.intval(value)}},PregReplace:{matchPattern:null,replacement:"",filter:function(value){if(UTIL.Filter.PregReplace.matchPattern===null){return false}return value.replace(UTIL.Filter.matchPattern,UTIL.Filter.replacement)}},StringToLower:{filter:function(value){return value.toLowerCase()}},StringToUpper:{filter:function(value){return value.toUpperCase()}},StringTrim:{charList:null,filter:function(value){if(UTIL.Filter.StringTrim.charList===null){return UTIL.Functions.trim(value)}else{return UTIL.Functions.trim(value,UTIL.Filter.StringTrim.charList)}}}};UTIL.Form={isValid:function(form,valid,invalid){var c=form.elements;var formName=form.name?form.name:"form";var rules=Forms[formName];var formValidates=true;for(var key in rules){var element=form[key];var ruleset=rules[key];for(var i in ruleset){var nameParts=ruleset[i].name.split("_");var validator=window[nameParts[0]];for(var j=1,len=nameParts.length;j<len;j++){validator=validator[nameParts[j]]}try{var elementValidates=validator(element.value,ruleset[i].parameters);if(elementValidates){valid(element)}else{invalid(element);formValidates=false}}catch(exception){continue}}}return formValidates},wasValid:function(element){$(element).css("backgroundColor","LimeGreen")},wasInvalid:function(element){$(element).css("backgroundColor","Red")}};UTIL.Accordian=function(){$(".ACCORDHDR").click(function(){$(this).next(".ACCORDBDY").slideToggle();$(this).toggleClass("ACTIVE")})};UTIL.leftRight=function(){$(".leftSelector").click(function(){var selector="#right"+$(this).attr("id").substring(4);$(".rightSelector").hide();$(".leftSelector").removeClass("activeLeft");$(this).addClass("activeLeft");$(selector).show();$(selector).addClass("activeRight")})};UTIL.CommentControl=function(){$(".streamCommentControl").click(function(){$(this).next(".streamCommentForm").slideToggle()})};UTIL.ControlMenu=function(){$(".CMIHDR").click(function(){if($(this).hasClass("CMIHDRClose")){$(".CMIHDR").addClass("CMIHDRClose");$(".CMIHDR").next(".CMISUB").slideUp();$(this).removeClass("CMIHDRClose");$(this).next(".CMISUB").slideDown()}})};UTIL.streamCommentSubmit=function(){$(".button").click(function(){var submit_id=$(this).attr("id");var event_id=submit_id.substring(7,submit_id.length);var relative_id=$("#object_id-"+event_id).attr("value");var body=$("#streamComment-"+event_id).attr("value");var profile_id=$("#profile_id-"+event_id).attr("value");var eventType=$("#eventType-"+event_id).attr("value");if(body==""){alert("Please add a comment");$("#streamComment-"+event_id).focus();return false}else{var dataString="relative_id="+relative_id+"&profile_id="+profile_id+"&body="+body+"&event_type="+eventType;$.ajax({type:"POST",url:"/myprofile/stream/add-stream-comment/",data:dataString,success:function(html){if(html.indexOf("streamCommentEntry")==-1){var errorText='<div class="error">Unable to process, please try again later.</div>';$("#streamComments-"+event_id).after(errorText)}else{$(".error").hide();$("#streamComments-"+event_id).after(html)}}});return false}})};UTIL.showCommentForm=function(){$(".streamAddComment").click(function(){$(this).next(".streamCommentForm").slideDown();$(this).hide()})};UTIL.showComments=function(){$(".showComments").click(function(){var classValue=$(this).attr("class");var streamID=classValue.substring(13,classValue.length);$("."+streamID).show();$(this).hide()})};UTIL.CommentPage=function(){$(".clickForMore").click(function(){$(this).next(".commentpage").slideToggle();$(this).toggleClass("ACTIVE")})};UTIL.ReplyForm=function(){$(".respondBar").click(function(){var replyID=$(this).attr("id");var topicID=replyID.substring(1,replyID.length);$("input#parent_topic_id").val(topicID)})};UTIL.DiscussionThread=function(){$(".commentButton").click(function(){var submit_id=$(this).attr("id");var comment_id=submit_id.substring(4,submit_id.length);var guild_topic_id=$("#guild_topic_id").attr("value");var guild_id=$("#guild_id").attr("value");var world_id=$("#world_id").attr("value");var parent_topic_id=$("#parent_topic_id").attr("value");var root_topic_id=$("#root_topic_id").attr("value");var title=$("#title").attr("value");var body=$("#body").attr("value");if(body==""){alert("Please add a comment before submitting.");$("#comment"+comment_id).attr("value");return false}else{var dataString="&guild_topic_id="+guild_topic_id+"&guild_id="+guild_id+"&world_id="+world_id+"&parent_topic_id="+parent_topic_id+"&root_topic_id="+root_topic_id+"&title="+title+"&body="+body;$.ajax({type:"POST",url:"/guilds/index/discussions-add-reply/",data:dataString,success:function(html){if(html.indexOf("commentHold")==-1){var errorText='<div class="error">Unable to process, please try later.</div>';$("#hold"+hold).after(errorText)}else{$(".error").hide();location.reload(true)}}});return false}})};UTIL.MediaRatings={NUMBER_OF_STARS:5,init:function(){$("div.rating").each(function(i){rating=$(this).html();$(this).empty();MYALGANON.mediaRatings.addStars(this,rating)}).children().bind("click",this.submitRating)},addStars:function(div,rating){if(rating>this.NUMBER_OF_STARS||rating<0){return}for(j=0;j<this.NUMBER_OF_STARS;j++){if(rating>=1){$star=$('<img src="http://static.myalganon.com/img/system4/rating_on.png" class="on" />');rating--}else{if(rating==0.5){$star=$('<img src="http://static.myalganon.com/img/system4/rating_half.png" class="half" />');rating=0}else{$star=$('<img src="http://static.myalganon.com/img/system4/rating_off.png" class="off" />')}}widgetId=div.id.substr(7);$star.attr("id","star_"+widgetId+"_"+j);$star.bind("mouseover",{ratingId:widgetId,star:j},this.displayHover);$star.bind("mouseout",{ratingId:widgetId,star:j},this.displayNormal);$(div).append($star)}},displayHover:function(evt){star=evt.data.star;ratingId=evt.data.ratingId;for(var i=0;i<=star;i++){$("#star_"+ratingId+"_"+i).attr("src","http://static.myalganon.com/img/system4/rating_over.png")}},displayNormal:function(evt){star=evt.data.star;ratingId=evt.data.ratingId;for(var i=0;i<=star;i++){$img=$("#star_"+ratingId+"_"+i);status=$img.attr("class");$img.attr("src","http://static.myalganon.com/img/system4/rating_"+status+".png")}},refreshRating:function(div,rating){$(div).empty();this.addStars(div,rating);$(div).children().bind("click",this.submitRating)},submitRating:function(eventt){rating_div=$(this).parent().get(0);tmp=this.id.substr(5);widgetId=tmp.substr(0,tmp.indexOf("_"));starNbr=parseInt(tmp.substr(tmp.indexOf("_")+1),10)+1;screen_name=$("#snapshotHDR").text();screen_name=screen_name.substr(0,screen_name.indexOf("'s"));$.get("/profile/"+screen_name+"/media/rate-ajax/media_id/"+widgetId+"/rating_value/"+starNbr,function(data){if(parseInt(data,10)){MYALGANON.mediaRatings.refreshRating(rating_div,parseInt(data,10))}else{alert(data)}})}};UTIL.Tables={makeSortable:function(){$("table.sortable").each(function(){var $table=$(this);var calcMny=function($cell){gold=parseInt($cell.find(".mny_gold").text(),10);silver=parseInt($cell.find(".mny_silver").text(),10);copper=parseInt($cell.find(".mny_copper").text(),10);gold=isNaN(gold)?0:gold;silver=isNaN(silver)?0:silver;copper=isNaN(copper)?0:copper;retval=copper+(silver*100)+(gold*10000);return isNaN(retval)?0:retval};$table.find("th").each(function(column){var findSortKey;if($(this).is(".sort-alpha")){findSortKey=function($cell){return $cell.find(".sort-key").text().toUpperCase()+" "+$cell.text().toUpperCase()}}else{if($(this).is(".sort-numeric")){findSortKey=function($cell){var key=$cell.find(".sort-key").text();if(key!==""){key=parseFloat(key,10)}else{key=parseFloat($cell.text(),10)}return isNaN(key)?0:key}}else{if($(this).is(".sort-coin")){findSortKey=function($cell){return calcMny($cell)}}else{if($(this).is(".sort-rewards")){findSortKey=function($cell){mny=xp=items=0;mny=calcMny($cell);xp=parseInt($cell.find(".questXPRewardAmt").text(),10);xp=isNaN(xp)?0:xp;items=$cell.find(".questItemReward").length*1000000;items=isNaN(items)?0:items;return items+mny+xp}}else{if($(this).is(".sort-date")){findSortKey=function($cell){return Date.parse("1 "+$cell.text())}}}}}}if(findSortKey){$(this).addClass("clickable").hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).click(function(){var newDirection=1;if($(this).is(".sorted-asc")){newDirection=-1}rows=$table.find("tbody > tr").get();$.each(rows,function(index,row){row.sortKey=findSortKey($(row).children("td").eq(column))});rows.sort(function(a,b){if(a.sortKey<b.sortKey){return -newDirection}if(a.sortKey>b.sortKey){return newDirection}return 0});$.each(rows,function(index,row){$table.children("tbody").append(row);row.sortKey=null});$table.find("th").removeClass("sorted-asc").removeClass("sorted-desc");var $sortHead=$table.find("th").filter(":nth-child("+(column+1)+")");if(newDirection==1){$sortHead.addClass("sorted-asc")}else{$sortHead.addClass("sorted-desc")}$table.find("td").removeClass("sorted").filter(":nth-child("+(column+1)+")").addClass("sorted");$table.trigger("repaginate")})}})})},makePageable:function(){$("table.paginated").each(function(){var currentPage=0;var numPerPage=50;var $table=$(this);var $pager=$('<div class="pager"></div>').appendTo("#"+this.id+"-pagerHOLD");var $counter=$('<div class="pager-counter" id="'+this.id+'-pager-counter"></div>').appendTo("#"+this.id+"-pagercountHOLD");$table.bind("repaginate",function(event){var numRows=$table.find("tbody tr:not(.filtered)").length;var numPages=Math.ceil(numRows/numPerPage);if(currentPage>numPages-1){currentPage=numPages-1}else{if(currentPage<0){currentPage=numPages-1}}$table.find("tbody tr:not(.filtered)").show().slice(0,currentPage*numPerPage).hide().end().slice((currentPage+1)*numPerPage).hide().end();$pager.html("");for(var page=0;page<numPages;page++){$('<span class="page-number">'+(page+1)+"</span>").bind("click",{newPage:page},function(event){currentPage=event.data.newPage;$table.trigger("repaginate")}).appendTo($pager).addClass("clickable")}$pager.find("span:eq("+(currentPage)+")").addClass("active");counter_start=(currentPage*numPerPage+1)<0?0:(currentPage*numPerPage+1);counter_end=(currentPage+1)*numPerPage;$("#"+this.id+"-pager-counter").html(counter_start+" - "+(counter_end<numRows?counter_end:numRows)+" of "+numRows)});$table.trigger("repaginate");$pager.find("span.page-number:first").addClass("active")})},makeFilterable:function(){$("table.filterable").each(function(){var $table=$(this);$('<input type="text" name="'+this.id+'-filterbox" id="'+this.id+'-filterbox" class="filterbox"  />').click(function(){});$('<input type="text" name="'+this.id+'-filterbox" id="'+this.id+'-filterbox" class="filterbox"  />').keyup(function(){var filterText=$(this).val();$table.trigger("filter",[filterText])}).appendTo("#"+this.id+"-filterHOLD");$table.find("tbody tr").each(function(){this.filterText=$(this).find("td").text().trim().toUpperCase()});$table.bind("filter",function(event,filterText){$table.find("tbody tr").removeClass("filtered").each(function(){if(this.filterText.indexOf(filterText.toUpperCase())==-1){$(this).hide().addClass("filtered")}});$table.find("tbody tr:not(.filtered)").show();$table.trigger("repaginate")})})}};UTIL.Validate={Alnum:function(value,parameters){if(value===""){return false}UTIL.Filter.Alnum.allowWhiteSpace=parameters.allowWhiteSpace;if(value!=UTIL.Filter.Alnum.filter(value)){return false}return true},Alpha:function(value,parameters){if(value===""){return false}UTIL.Filter.Alpha.allowWhiteSpace=parameters.allowWhiteSpace;if(value!=UTIL.Filter.Alpha.filter(value)){return false}return true},Between:function(value,parameters){if(parameters.inclusive){if(parameters.min>value||value>parameters.max){return false}}else{if(parameters.min>=value||value>=parameters.max){return false}}return true},CCnum:function(value,parameters){valueFiltered=UTIL.Filter.Digits(value);length=valueFiltered.length;if(length<13||length>19){return false}sum=0;weight=2;for(i=length-2;i>=0;i--){digit=weight*valueFiltered[i];sum=Math.floor(digit/10)+digit%10;weight=weight%2+1}if((10-sum%10)%10!=valueFiltered[length-1]){return false}return true},Digits:function(value,parameters){if(value===""){return false}if(value!==UTIL.Filter.Digits(value)){return false}return true},EmailAddress:function(value,parameters){if(!(matches=value.match(/^(.+)@([^@]+)$/))){return false}localPart=matches[1];hostName=matches[2];localResult=false;if(localPart.match(/^[a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d]+(\x2e+[a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d]+)*$/)){return true}else{noWsCtl="x01-\x08\x0b\x0c\x0e-\x1f\x7f";qtext=noWsCtl+"\x21\x23-\x5b\x5d-\x7e";ws="\x20\x09";if(localPart.match("/^\x22(["+ws+qtext+"])*[$ws]?\x22$/")){return true}}return false},Float:function(value,parameters){if(UTIL.Functions.floatval(value)!=value){return false}return true},GreaterThan:function(value,parameters){if(parameters.min>=value){return false}return true},Identical:function(value,parameters){if(value!==parameters.token){return false}return true},InArray:function(value,parameters){if(!UTIL.Functions.in_array(value,parameters.haystack,parameters.strict)){return false}return true},Int:function(value,parameters){if(UTIL.Functions.intval(value)!=value){return false}return true},Ip:function(value,parameters){if(UTIL.Functions.ip2long(value)===false){return false}return true},LessThan:function(value,parameters){if(parameters.max<=value){return false}return true},NotEmpty:function(value,parameters){if(value!==""){return true}return false},PasswordConfirmation:function(value,parameters){if(value!=$("#confirm_password").val()){return false}return true},Regex:function(value,parameters){status=value.match(parameters.pattern);if(!status){return false}return true},StringLength:function(value,parameters){length=value.length;if(value.length<parameters.min){return false}if(parameters.max!==null&&parameters.max<length){return false}return true}};$(document).ready(UTIL.loadEvents);
