(function(){ var $j = window.$j = jQuery.noConflict(); var _$aa = window.$aa, undefined; var $aa = window.$aa = function(sel,context){ return $j(sel,context); } $aa.extend = function(){ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; if(target.constructor == Boolean){ deep = target; target = arguments[1] || {}; i = 2; } if(typeof(target)!= "object" && typeof(target) != "function") target = {}; if(length == i) { target = $aa; --i; } for( ; i < length; i++ ){ if((options = arguments[i]) != null){ for(var name in options) { var src = target[name], copy = options[name]; if(target === copy) continue; if(deep && copy && typeof copy == "object" && !copy.nodeType) target[ name ] = $aa.extend(deep, src || (copy.length != null ? [] : {}),copy); else if (copy !== undefined) target[name] = copy; } } } return target; }; $aa.extend({ init: function(){ $aa.uidcnt = 0; }, isElement: function(el){ return (el === undefined)? false : (typeof(el) != 'object' || el === null)? false : (el.tagName === undefined)? false : true; }, elementType: function(el){ return (el === undefined)? undefined : (el.tagName === undefined)? undefined : (typeof(el.tagName) != 'string')? undefined : el.tagName.toUpperCase(); }, isUsableNode: function(obj){ return (obj === null || obj === undefined)? false : ($aa.isElement(obj) || obj === window || obj === document || obj.document)? true : false; }, makeArray: function(arr) { var ret = new Array(); if(arr != null){ var i = arr.length; try{ while(i) { ret[--i] = arr[i]; } } catch(e){ ret[0] = arr; } } return ret; }, asArray: function(subj) { var arr = ($aa.isArray(subj)) ? subj : new Array(subj); var ret = $aa.makeArray(arr); return ret; }, random: function(nStart, nEnd){ if(nStart == 0){ return Math.floor(Math.random()*(nEnd+1)); } else { return Math.floor(Math.random()*nEnd-nStart+1)+nStart; } }, uid: function(){ return 0+($aa.uidcnt++); }, isArray: function(arr){ // PUBLIC return (arr === undefined) ? false : (typeof(arr.pop) == 'function' || arr.jquery !== undefined || arr.esVersion !== undefined) ? true : false; }, arrayRemove: function(needle, haystack){ var i=0; while(i < haystack.length){ if(haystack[i] === needle) haystack.splice(i,1); else i++; } return haystack; }, merge: function(arrFirst,arrSecond){ var i = 0, el, pos = arrFirst.length; if($aa.msie){ while(el = arrSecond[i++]){ if(el.nodeType != 8) arrFirst[pos++] = el; } } else { while(el = arrSecond[i++]){ arrFirst[pos++] = el; } } return arrFirst; }, inArray: function(needle, haystack){ for(var i = 0, length = haystack.length; i < length; i++ ){ if(haystack[i] === needle) return i; } return -1; }, px: function(val,fmt){ var pixel = /^\d+(px)?$/i; if(!pixel.test(val) && isNaN(parseInt(""+val))) return val; return (fmt == 'int')? (0+parseInt(""+val)) : (0+parseInt(""+val)) +'px'; }, trim: function(text) { return (text || "").replace( /^\s+|\s+$/g,""); }, nodeName: function(el,name) { return el.nodeName && el.nodeName.toUpperCase() == name.toUpperCase(); }, stripQuotes: function(val){ return val.replace(/"/g,"").replace(/'/g,""); }, id: function(el){ // PUBLIC // $aa.id(String elementId, [Boolean log]) : Element if($aa.isUsableNode(el)) return el; var ret = (el === undefined)? null : (el == null || typeof(el) != 'string' || el == "")? null : document.getElementById(el); return ret; } }); // NATIVE BROWSER WINDOWS $aa.browserWindow = function(){ var o = arguments[0] || {}; o.url = (o.url === undefined) ? 'about:blank' : o.url; o.name = (o.name === undefined) ? ('browserWindow'+$aa.uid()+$aa.random(0,100)) : o.name; o.width = (o.width === undefined) ? screen.availWidth-100 : o.width; o.height = (o.height === undefined) ? screen.availHeight-170 : o.height; o.x = (o.x === undefined) ? (screen.availWidth/2)-(o.width/2) : o.x; o.y = (o.y === undefined) ? (screen.availHeight/2)-(o.height/2) : o.y; o.location = (o.location === undefined) ? 'no' : (o.location === false || o.location == 'no') ? 'no' : 'yes'; o.status = (o.status === undefined) ? 'yes' : (o.status === false || o.status == 'no') ? 'no' : 'yes'; o.scrollbars = (o.scrollbars === undefined) ? 'yes' : (o.scrollbars === false || o.scrollbars == 'no') ? 'no' : 'yes'; o.resizable = (o.resizable === undefined) ? 'yes' : (o.resizable === false || o.resizable == 'no') ? 'no' : 'yes'; o.menubar = (o.menubar === undefined) ? 'no' : (o.menubar === false || o.menubar == 'no') ? 'no' : 'yes'; o.options = (o.options !== undefined) ? o.options : ' location='+o.location+ ',status='+o.status+ ',resizable='+o.resizable+ ',menubar='+o.menubar+ ',scrollbars='+o.scrollbars+ ',width='+o.width+ ',height='+o.height+ ',screenX='+o.x+ ',screenY='+o.y+ ',left='+o.x+ ',top='+o.y; return window.open(o.url,o.name,o.options); } $aa.browserWindow.isOpen = function(ref){ var ret = (!ref) ? false : (ref.closed) ? false : true; return ret; } // TAB MENU $aa.tabmenu = { menulist: function(){ $j('ul.menulist').not('ul.altMenu').find('li a').removeClass('current'); $j(this).addClass('current'); }, altList: function(){ $j('ul.altMenu a').removeClass('current'); $j(this).addClass('current'); }, setup: function(){ // menulist class menu var current = $j('ul.menulist').not('ul.altMenu').find('li a.current').get(0); // get current menulist element $j('ul.menulist').not('ul.altMenu').find('li a').unbind("click",$aa.tabmenu.menulist).bind("click",$aa.tabmenu.menulist); if($aa.isElement(current)) { $aa.tabmenu.menulist.apply(current); // sets the current element } // altMenu class menu current = $j('ul.altMenu a.current').get(0); // get current altMenu element $j('ul.altMenu a').unbind("click",$aa.tabmenu.altList).bind("click",$aa.tabmenu.altList); // attach listener if($aa.isElement(current)) { $aa.tabmenu.altList.apply(current); // sets the current element } } } $j().ready(function(){ $aa.tabmenu.setup(); }); // setup events on startup })();