var as = {};as.global = {};as.global.onclick = function() {};as.global.onmouseover = function() {};as.global.onmouseout = function() {};/* MODULE TYPE */ var CONST_MODULE_TYPE_MODULE = "MODULE"; var CONST_MODULE_TYPE_COMPONENT = "COMPONENT"; /* AJAX TYPE */ var CONST_AJAX_TYPE_READFILE = "1"; var CONST_AJAX_TYPE_SENDPOST = "2"; var CONST_AJAX_TYPE_SENDGET = "4"; /* EXECUTE COMMAND TYPE */ var CONST_COMMAND_SERVER_POST = "1"; var CONST_COMMAND_SERVER_GET = "2"; var CONST_COMMAND_SERVER_POST_SYNC = "4"; var CONST_COMMAND_SERVER_GET_SYNC = "8"; var CONST_COMMAND_LOCAL = "16"; var CONST_COMMAND_AUTHKEY = "32"; var CONST_COMMAND_SERVER_POST_UPLOAD = "64";/* COMMON UTILS */ var _onmouseover = function() {}; var _onmouseout = function() {}; var _onclick = function() {}; function a() {}; function $str_rev (str) { var l = str.length-1; var newStr = ""; for (var x=l; x>=0; x--) { newStr += str.charAt(x); }; return newStr; }; function $fixIE() { var newEl = document.createElement ("table"); document.body.appendChild (newEl); newEl.removeNode(true); }; function $getX (obj) { var curleft = 0; if (obj.offsetParent) { while (1) { curleft += obj.offsetLeft; if (!obj.offsetParent) break; obj = obj.offsetParent; }; } else if (obj.x) curleft += obj.x; return curleft; }; function $getY (obj) { var curtop = 0; if (obj.offsetParent) { while (1) { curtop += obj.offsetTop; if (!obj.offsetParent) break; obj = obj.offsetParent; }; } else if (obj.x) curtop += obj.x; return curtop; }; function $decodeURI (str, linebreak) { if (str) { str = str.replace(/##amp;/gi, "&"); str = str.replace(/%2520/gi, " "); str = str.replace(/'/gi, "'"); str = str.replace(/"/gi, '"'); str = str.replace(/</gi, "<"); str = str.replace(/>/gi, ">"); if (linebreak) str = str.replace(//gi, "\n"); } else str = ""; return str; }; function $encodeURI (str) { str = encodeURI(str); str = str.replace(/%0A/gi, ""); str = decodeURI(str); str = str.replace(/'/gi, "'"); str = str.replace(/"/gi, """); str = str.replace(//gi, ">"); str = str.replace(/&/gi, '##amp;'); return str; }; function $escChars(str) { var newstr = str; newstr = newstr.replace(//gi, ">"); newstr = newstr.replace(/%/gi, "%"); newstr = newstr.replace(/%/gi, "&"); newstr = newstr.replace(/'/gi, "'"); newstr = newstr.replace(/"/gi, """); return newstr; }; function $getCurrentHref() { var tmpHref = document.location.href; tmpData = tmpHref.split("/"); return tmpData[tmpData.length-1]; }; /* FORMAT PARAM TO JSON OBJECT */ function $A$F$JSON(params) { var result = null; try { result = $A$F$JSONMAP(params); } catch (e) { as.logs.addLog("util.js", "'$A$F$JSON' CANNOT GENERATE KEY VALUE PAIR CORRECTLY. CHECK YOUR FRONT END PARAMETERS! >> "+e.message); }; return result; }; function $A$F$JSONMAP(params) { var result = ""; if(params instanceof Array){ var innerCounter = 0; result += "["; for (var el in params) { if (innerCounter > 0) result += ","; if (typeof params[el] == 'object') result += $A$F$JSONMAP(params[el]); else result += $A$F$JSONMAP(params[el]); innerCounter++; }; result += "]"; } else if (typeof params == 'object') { var innerCounter = 0; result += "{"; for (var el in params){ if (innerCounter > 0) result += ","; result += '"'+el+'"'+":"; result +=$A$F$JSONMAP(params[el]); innerCounter++; }; result += "}"; } else { result += '"'+params+'"'; }; return result; }; function $executeCommand(requestType, url, params, process) { try { var sendParams = null; if (params) sendParams = $A$F$JSON(params); /* ?bustcache - To force refresh in IE when AJAX load the url page */ switch(requestType) { case CONST_COMMAND_SERVER_GET: requestMethod = "GET"; requestURL = "/"+url requestParams = "bustcache="+new Date().getTime(); break; case CONST_COMMAND_SERVER_GET_SYNC: requestMethod = "GET"; requestURL = "/executeServlet.php"; requestParams = "hub="+as.info.hub+"&command="+url+"&_auth="+$str_rev(as.info._AUTHKEY)+"&bustcache="+new Date().getTime() + "¶ms="+ sendParams; break; case CONST_COMMAND_AUTHKEY: requestMethod = "POST"; requestURL = "/checkAuthKey.php"; requestParams = "_auth="+$str_rev(as.info._AUTHKEY)+"&bustcache="+new Date().getTime() + "¶ms="+ sendParams; break; default: requestMethod = "POST"; switch(as.info.stage) { case "DEV": stage = "local."; break; case "BETA": stage = "beta-"; break; default: stage = ""; break; }; cache = new Date().getTime(); //"http://"+stage+"api."+as.info.namespace+ requestURL = "/servlet/send/json/"+$str_rev(as.info._AUTHKEY)+"/"+cache+"/"+url; requestParams = "params="+sendParams; break; }; //alert(requestParams); // cross-domain //var xdrCfg = { src:'/includes/js/libs/yui/io/io.swf' }; //as.yui.io.transport(xdrCfg); // Success Handler function handleSuccess(ioId, o, process, success) { if (o.responseText !== undefined) { var obj = null; try { if (success) { obj = as.yui.JSON.parse(o.responseText); as.logs.addLog("transaction id >> "+ioId+" >> success params >>"+o.responseText); } else { obj = {validation: false, error: "Cannot process call"}; }; } catch (e) { as.logs.addError(this.filename, url+" >> "+e.message); }; try { this._p = process; this._p(obj); as.yui.detach("io:complete"); as.yui.detach("io:failure"); } catch(e) { as.logs.addError(this.filename, url+" >> "+e.message); }; }; }; // subscribe io handlers as.yui.on('io:complete', handleSuccess, this, process, true); as.yui.on('io:failure', handleSuccess, this, process, false); // config data var cfg = { method: requestMethod, use: 'native', data: requestParams, timeout: 360000 }; // Upload Form if (requestType == CONST_COMMAND_SERVER_POST_UPLOAD) { cfg.form = { id: params._formid, upload: true }; }; as.logs.addLog(url + " using method >> "+requestMethod); as.logs.addLog(url + " params >> "+requestParams); as.yui.io.header('Content-Type', 'application/json'); as.yui.io(requestURL, cfg); } catch(e) { as.logs.addError(this.filename, requestURL + " using method >> "+requestMethod + " >> "+e.message); }; }; function $uploadFile(oForm, oCommand, oParams, callback) { try { var params = "hub="+$_HUB+"&_auth="+$str_rev(_AUTHKEY)+"&bustcache="+new Date().getTime()+"&command="+oCommand+"&"+oParams; YAHOO.util.Connect.setForm(oForm, true); YAHOO.util.Connect.asyncRequest('GET', "/executeServlet.php", callback, params); } catch (e) { $C.addLog("ERROR >> utils.js 'uploadFile()' >> "+e.message); }; }; function $timeoutMessage(obj, text) { obj.setStyle("display", ""); obj.set("innerHTML", text); self.setTimeout("$timeoutMessageAction('"+obj.get("id")+"')", 10000); }; function $timeoutMessageAction(id) { as.yui.one("#"+id).setStyle("display", "none"); }; function $buildImage(params) { var d = params.img.split("."); var img = "http://local.images.edoujinbooks.com/img/jpg/" + params.ws + "/"+params.type + "/"+params.w + "/"+params.id + "/"+d[0] + "/"+(params.name ? params.name : "thumb") +".jpg"; return img; }; function $handleErrors (error) { switch (error) { case "1001": return "Cannot connect to server."; break; case "1002": return "You do not have access to this area."; break; case "1003": return "Invalid captcha input."; break; case "1004": return "You already register to AschSocial's Network. Do you want to join this community?"; break; case "1005": return "Cannot retrieve user info."; break; case "1006": return "Cannot process action."; break; case "1011": return "Your session has timed out. Please relogin."; break; case "1012": return "Your user id does not match current session."; break; case "1013": return "SMTP Error. Cannot send out email."; break; case "1101": return "Cannot connect to Paypal server."; break; case "1102": return "Cannot connect to Amazon AWS server."; break; case "1103": return "Invalid call to Amazon server."; break; default: return error; }; }; function $checkValue(type, obj, text) { var v = true; switch(type) { case "null": var c = as.yui.Lang.isNull(obj); if ((!c) && (obj.get("value") == "")) v = false; break; }; // Load error message if (!v) { var eObj = as.yui.one("#"+obj.get("id")+"Error"); eObj.setStyle("display", ""); eObj.set("innerHTML", text+" is a required field."); } return v; }; // FIELDS CHECK function $checkEmpty(obj, text) { var v = true; text = text || ""; var eObj = YAHOO.util.Dom.get(obj.id+"Error"); eObj.style.display = "none"; if (parseInt(obj.value.length) == 0) { v = false; var eObj = YAHOO.util.Dom.get(obj.id+"Error"); eObj.style.display = ""; eObj.innerHTML = text+" is a required field."; } return v; }; function $checkNumber(obj, text) { var v = true; if (parseInt(obj.value.length) > 0) { var anum=/(^\d+$)|(^\d+\.\d+$)/; if (anum.test(obj.value)) { } else { var eObj = YAHOO.util.Dom.get(obj.id+"Error"); if (eObj && text) { eObj.style.display = ""; eObj.innerHTML = text; }; v = false; }; }; return v; }; function $checkLength(el, l, text) { var v = true; if ($checkEmpty(el, text)) { eObj = YAHOO.util.Dom.get(el.id+"Error"); if (parseInt(el.value.length) < l) { eObj.style.display = ""; eObj.innerHTML = text+" must be a minimum of "+l+" characters."; v = false; } else eObj.innerHTML = ""; } else v = false; return v; }; function $checkEmail(el, text) { var v = true; if ($checkEmpty(el, text)) { var orig_str = el.value; if (orig_str != "" ) { var regexp_Email = /^\w([\w\._\-\&']*)?@\w([\w\._\-]*)?\.\w{2}([\w\.]*)?$/; eObj = YAHOO.util.Dom.get(el.id+"Error"); if ( !regexp_Email.test( orig_str ) ) { eObj.style.display = ""; eObj.innerHTML = text+" is not a valid address."; v = false; } else eObj.innerHTML = ""; }; } else v = false; return v; }; function $checkDropdown(el, text) { var v = true; eObj = YAHOO.util.Dom.get(el.id+"Error"); if ((el.length > 0) && (el.selectedIndex < 1)) { v = false; eObj.innerHTML = text+" is a required field."; } else eObj.innerHTML = ""; return v; }; function $getRadioBoxValue (el) { var length = el.length; for (var x=0; x> "+filename+" - "+msg); }; errorsLogger.prototype.addWarning = function(filename, msg) { this.addLog("WARNING >> "+filename+" - "+msg); }; errorsLogger.prototype.addLog = function(value) { if (this.logsDiv) { var newDate = new Date(); var tmpYear = (newDate.getYear() < 1900) ? 1900 + newDate.getYear() : newDate.getYear(); var tmpHours = (newDate.getHours() < 10) ? "0"+newDate.getHours() : newDate.getHours(); var tmpMinutes = (newDate.getMinutes() < 10) ? "0"+newDate.getMinutes() : newDate.getMinutes(); var tmpSeconds = (newDate.getSeconds() < 10) ? "0"+newDate.getSeconds() : newDate.getSeconds(); var tmpMiliSeconds = newDate.getMilliseconds(); if (tmpMiliSeconds < 10) tmpMiliSeconds = "00" + tmpMiliSeconds; else if (tmpMiliSeconds < 100) tmpMiliSeconds = "0" + tmpMiliSeconds; var newObject = new Object(); newObject.timestamp = (newDate.getMonth()+1) + "/" + newDate.getDate() + "/" + tmpYear + " " + tmpHours + ":" + tmpMinutes + ":" + tmpSeconds + ":" + tmpMiliSeconds; newObject.logString = value; newObject.index = this.logsCounter; this.logsCounter++; this.logsList.add(newObject); this.displayLogs(); }; }; errorsLogger.prototype.deleteLog = function(index) { var deleteObj = this.findLog(index); this.logsList.remove(deleteObj); }; errorsLogger.prototype.clearLog = function() { delete this.logsList; this.logsList = new LinkedList(); this.displayLogs(); }; errorsLogger.prototype.findLog = function(index) { var logObj = this.logsList.getFirst(); var foundObj = null; while(logObj != null) { if (logObj.index == index) { foundObj = logObj; break; }; logObj = this.logsList.getNext(logObj); }; return foundObj; }; errorsLogger.prototype.displayLogs = function() { var htmlValue = ""; htmlValue += ""; htmlValue += "Debug Logger: [ Clear Log ]"; var logObj = this.logsList.getFirst(); while(logObj != null) { htmlValue += " - "+logObj.timestamp+" >> "+logObj.logString+""; logObj = this.logsList.getNext(logObj); }; htmlValue += "xx-- Close Debugger --xx"; htmlValue += ""; this.logsDiv.set('innerHTML', htmlValue); }; errorsLogger.prototype.displayNode = function() { this.logsDiv.setStyle("display", ""); this.displayLogs(); }; errorsLogger.prototype.hideNode = function() { this.logsDiv.setStyle("display", "none"); }; errorsLogger.prototype.keyCheck = function(e) { var KeyID = (window.event) ? event.keyCode : e.keyCode; if (KeyID == "123") { as.logs.displayNode(); }; }; errorsLogger.prototype.closeLog = function() { this.hideNode(); }; errorsLogger.prototype.showLog = function() { this.displayNode(); };function moduleDelegation_getContent() { return this.module.content; }; function moduleDelegation_getId() { return this.module.id; }; function moduleDelegation_getNodeObject() { return this.module.nodeObj; }; function moduleDelegation_setNodeObject(node) { this.module.setNodeObject(node); }; function moduleDelegation_readFile(filename) { return this.module.readFile(filename); }; function moduleDelegation_getHTMLReference() { return this.module.htmlReference; }; function moduleDelegation_setHTMLReference(htmlRef) { this.module.htmlReference = htmlRef; }; function moduleDelegation_bind(node) { this.module.bind(node); }; function moduleDelegation_storeObjectsID(content) { this.module.storeObjectsID(content); }; function moduleDelegation_storeObjectsFields(fields) { this.module.storeObjectsFields(fields); }; function moduleDelegation_displayNode() { this.module.nodeObj.setStyle("display", ""); }; function moduleDelegation_hideNode() { this.module.nodeObj.setStyle("display", "none"); }; function moduleDelegation_add(object, node, manualId, parentObj, paramsObj) { return this.module.add(object, node, manualId, parentObj, paramsObj); }; function moduleDelegation_remove(id) { this.module.remove(id); }; function moduleDelegation_executeCommand(type, command, params, callback) { return this.module.executeCommand(type, command, params, callback); }; function moduleDelegation_createButton(id, params, glow) { return this.module.createButton(id, params, glow); }; function moduleDelegation_setParent(obj) { this.module.parentObj = obj; }; function moduleDelegation_getParent() { return this.module.parentObj; }; function moduleDelegation_setParams(params) { this.module.paramsObj = params; }; function moduleDelegation_getParams() { return this.module.paramsObj; }; function moduleDelegation_setComponent(id, obj) { this.module.components[id] = obj; }; function moduleDelegation_getComponent(id) { return this.module.components[id]; }; function moduleDelegation_setField(id, obj) { this.module.fields[id] = obj; }; function moduleDelegation_getField(id) { return this.module.fields[id]; }; function moduleDelegation_setFilename(value) { this.module.filename = value; } function moduleDelegation_getFilename() { return this.module.filename; }; function moduleDelegation_getObject(id) { return as.yui.one("#"+this.module.id+id); }; function moduleDelegation_createOverlay(cfg, html) { var body = as.yui.one(document.body); height = parseInt(body.getStyle("height"))+20; var id = cfg.contentBox.replace("#", ""); var modal = new as.yui.Overlay({width:"100%", height:height+"px", zIndex:2000000, xy:[0,0], shim: true, visible: cfg.visible, bodyContent:""+html}); modal.render(); cfg.zIndex = 2000001; var overlay = new as.yui.Overlay(cfg); overlay.render(); overlay._modalId = id+"Modal"; overlay._modal = modal; overlay.hideOverlay = function() { this._modal.hide(); this.hide(); }; overlay.showOverlay = function() { this._modal.show(); this.show(); }; return overlay; };/* MODULE OBJECT */ function module(moduleType, keyid, callback, content) { try { this.id = keyid; this.callback = callback; this.htmlReference = null; this.moduleType = moduleType; this.filename = "'"+as.info.section+"/"+as.info.page+"/applet.js'" this.components = []; // list of components this.fields = []; // list of fields of module var randomid = "RANDOMID"+Math.floor(Math.random()*1000000000000); if (moduleType == CONST_MODULE_TYPE_COMPONENT) { this.id = randomid; if (keyid) this.content = this.readFile(keyid); else this.content = content; } else { this.id = keyid || randomid; }; this.attachDelegation(); return this; } catch(e) { // Error caught as.logs.addError("module.js", "error initializing module"); }; }; /* ADD - REMOVE MODULE */ module.prototype.add = function(object, node, manualId, parentObj, paramsObj) { try { var html = object.getBodyHTML ? object.getBodyHTML() : ""; object.module = new module(CONST_MODULE_TYPE_COMPONENT, null, object, html); manualId = (manualId) ? manualId : object.getId(); var name = manualId+"_"+CONST_MODULE_TYPE_COMPONENT; parentObj.setComponent(name, object); object.setHTMLReference(parentObj.getHTMLReference()+".getComponent('"+name+"')"); object.setParent(parentObj); if (paramsObj) object.setParams(paramsObj); object.bind(node); // Bind node object.init(); return object; } catch(e) { as.logs.addError("module.js", "'add()' >> "+e.message); return null; }; }; module.prototype.remove = function(id) { this.components.pop(id); }; /* MODULE - FUNCTIONS */ module.prototype.attachDelegation = function() { var obj = this.callback; obj.getId = moduleDelegation_getId; obj.getContent = moduleDelegation_getContent; obj.getNodeObject = moduleDelegation_getNodeObject; obj.setNodeObject = moduleDelegation_setNodeObject; obj.getHTMLReference = moduleDelegation_getHTMLReference; obj.setHTMLReference = moduleDelegation_setHTMLReference; obj.readFile = moduleDelegation_readFile; obj.bind = moduleDelegation_bind; obj.displayNode = moduleDelegation_displayNode; obj.hideNode = moduleDelegation_hideNode; obj.add = moduleDelegation_add; obj.remove = moduleDelegation_remove; obj.setComponent = moduleDelegation_setComponent; obj.getComponent = moduleDelegation_getComponent; obj.setField = moduleDelegation_setField; obj.getField = moduleDelegation_getField; obj.getObject = moduleDelegation_getObject; obj.storeObjectsFields = moduleDelegation_storeObjectsFields; obj.createButton = moduleDelegation_createButton; obj.getParent = moduleDelegation_getParent; obj.setParent = moduleDelegation_setParent; obj.getParams = moduleDelegation_getParams; obj.setParams = moduleDelegation_setParams; obj.getFilename = moduleDelegation_getFilename; obj.setFilename = moduleDelegation_setFilename; obj.createOverlay = moduleDelegation_createOverlay; obj.executeCommand = $executeCommand; obj.timeoutMessage = $timeoutMessage; obj.decodeURI = $decodeURI; obj.encodeURI = $encodeURI; obj.buildImage = $buildImage; obj.timeoutMessage = $timeoutMessage; obj.checkValue = $checkValue; obj.getX = $getX; obj.getY = $getY; }; module.prototype.bind = function(node) { try { if (this.content) { var newContent = this.content; newContent = newContent.replace(/##ID##/g, this.id); newContent = newContent.replace(/##OBJECT##/g, this.getHTMLReference()); newContent = newContent.replace(/##TEMPLATE##/g, as.info.templatefolder); newContent = newContent.replace(/##WEBFOLDER##/g, as.info.webfolder); if (node) { this.setNodeObject(node); node.insert(newContent, "insertAfter"); this.storeObjectsID(this.content); }; } else { as.logs.addWarning("module.js", "'bind()' >> Cannot bind! Content is empty!"); }; } catch(e){ as.logs.addError("module.js", "'bind()' >> "+e); }; }; module.prototype.getHTMLReference = function() { return this.htmlReference; }; module.prototype.setHTMLReference = function(htmlRef) { this.htmlReference = htmlRef; }; module.prototype.setNodeObject = function(node) { this.nodeObj = as.yui.one(node); }; module.prototype.storeObjectsFields = function(fields) { var l = fields.length; for (var x=0; x")) { break; } else { storedField += savedContent.charAt(y); if (savedContent.charAt(y) == ')') { /* PASSING PARAM VALUE, IGNORE THIS FIELD */ storeField = ""; break; }; storedCounter++; }; }; if (storedField) { /* STORE ANY FIELD THAT IS NOT EMPTY */ var fldObject = as.yui.one("#"+this.id+storedField); if (fldObject) { this.callback.setField(storedField, fldObject); }; }; x = savedPosition+storedCounter; }; }; }; }; // TODO: 10.15.2009, Need to fix ajax call module.prototype.readFile = function(filename) { var returnResponse = null; if (filename) returnResponse = $executeCommand(CONST_AJAX_TYPE_READFILE, filename, null, null, null, true); return returnResponse; };function corex(htmlReference) { this.module = new module(htmlReference, null, this, null); this.setHTMLReference(htmlReference); this.modulesList = []; this.readQuerystring(); this.filename = "'includes/js/corex.js'"; }; corex.prototype.deleteModule = function(name) { this.modulesList.pop(name); }; corex.prototype.getModule = function(name) { return this.modulesList[name].object; }; corex.prototype.addModule = function(obj, name, keys) { try { //Do we need this auth key? this.checkAUTHKEY(); /* CHECKING AUTH KEY*/ var keyid = keys ? keys._id : null; //var node = keyid+"_MODULE_"+name; obj.module = new module(CONST_MODULE_TYPE_MODULE, keyid, obj); obj.setParent(this); obj.setParams({}); obj.setHTMLReference(this.getHTMLReference()+".getModule('"+name+"')"); if (keys) obj.storeObjectsFields(keys._fields); obj.init(); /* INITIALIZING OBJECT */ /* STORING MODULE */ //alert("added module: "+name); this.modulesList[name] = { object: obj, name: name }; } catch (e) { as.logs.addLog("ERROR: "+this.filename+" 'addModule()' >> "+e.message); }; }; corex.prototype.readQuerystring = function() { var query = window.location.search.substring(1); var vars = query.split("&"); this.queryData = []; for (var i=0;i> 'js/application.js' getQuery("+q+") not found!"); }; return returnValue; }; corex.prototype.checkAUTHKEY = function() { this.executeCommand(CONST_COMMAND_AUTHKEY, CONST_COMMAND_AUTHKEY, null, this.checkAUTHKEYResponse); }; corex.prototype.checkAUTHKEYResponse = function(rObj) { if (rObj.validation == "success") { as.logs.addLog('LOG >> AUTH KEY CONFIRM... NO NEED REFRESH') } else { var sURL = unescape(window.location.pathname)+unescape(window.location.search); window.location.href = sURL; }; }; Warning: Invalid argument supplied for foreach() in /home/content/03/6563603/html/live/scriptinclude.php on line 36