/***********************************************************************************************************************************
* mindshelf Framework                                                                                                              *
* ================================================================================================================================ *
* http://www.mindshelf.com                                                                                                         *
* Copyright (C) mindshelf - Matt Hallam. All rights reserved.                                                                      *
* The software, this file and its contents are subject to the mindshelf Framework License.                                         *
* Please read the license.txt file before using, installing, copying, modifying or distributing this file or part of its contents. *
* The contents of this file is part of the Source Code of mindshelf Framework.                                                     *
***********************************************************************************************************************************/
(function(){try{}catch(e){};if(typeof mJS=='undefined')mJS={};mJS.business='mOS';mJS.id=mJS.business.replace(/[^a-zA-z0-9]/gi,'').toLowerCase();mJS.wwwroot='http://'+document.location.hostname+((document.location.hostname=='localhost'||document.location.hostname=='172.168.1.18'||document.location.hostname=='82.19.98.210')?'/os.mindshelf.com':'')+'/';mJS.imgroot=mJS.wwwroot+'_img/';mJS.processing=false;mJS.monitor=true;mJS.debug=function(a){if(mJS.monitor&&a.indexOf('ckeditor')<0)alert(a);return true};mJS.Apple={};mJS.Apple.UA=navigator.userAgent;mJS.Apple.Device=false;mJS.Apple.Types=["iPhone","iPod","iPad"];for(var d=0;d<mJS.Apple.Types.length;d++){var t=mJS.Apple.Types[d];mJS.Apple[t]=!!mJS.Apple.UA.match(new RegExp(t,"i"));mJS.Apple.Device=mJS.Apple.Device||mJS.Apple[t]};mJS.error=function(m,u,l){if(m.toLowerCase().indexOf('ckeditor')<0)mJS.debug(m+' '+u+' '+l);return true};mJS.hash=[];mJS.process=function(a){if(a){$('body, body *').addClass('processing').css({cursor:'wait'});$('input,select,textarea').attr('disabled','disabled')}else{$('body,body *').removeClass('processing').css({cursor:''});$('input,select,textarea').removeAttr('disabled')};return mJS.processing=$('body').hasClass('processing')};mJS.plugins={};mJS.check={type:function(a){if(!a)return false;return eval("typeof(a)").toLowerCase()},exists:function(a){if(!a)return false;try{return((this.type(a)!='undefined')?true:false)}catch(e){return false}},obj:function(a){return((this.type(a)=='object')?true:false)},fn:function(a){return((this.type(a)=='function')?true:false)},arr:function(a){return((this.type(a)=='object')?true:false)},int:function(a){return((this.type(a)=='number')?true:false)},str:function(a){return((this.type(a)=='string')?true:false)},bool:function(a){return((this.type(a)=='boolean')?true:false)}};mJS.int2d=function(i){return((i<10)?'0'+i:i)};mJS.datetime=function(){d=new Date;$('.datetime').html(mJS.int2d(d.getHours())+':'+mJS.int2d(d.getMinutes())+':'+mJS.int2d(d.getSeconds())+' '+mJS.int2d(d.getDate())+'/'+mJS.int2d(d.getMonth()+1)+'/'+d.getFullYear());setTimeout(mJS.datetime,1000)};mJS.string={ajax:function(a){if(a){return'./javascript/library/'+a+'.mJS'}},verify:{email:function(a){return((a.match(/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/))?true:false)}},filesafe:function(a){return'mJS'+a.replace(/[^\d\w]/gi,'')},classsafe:function(a){return a.replace(/[^\d\w]/gi,'').toLowerCase()},fileextension:function(a){return a.substr(a.lastIndexOf('.')+1,a.length)},jsondo:function(a){return JSON.stringify(a)},jsonend:function(a){try{a=JSON.parse(a)}catch(e){mJS.debug(e);delete a,e;return false}return a},jsonattr:function(a){return mJS.string.jsondo(a).replace(/"/gi,'\'')},jsonrttr:function(a){return mJS.string.jsonend(a.replace(/'/gi,'"'))}};mJS.in_array=function(a,b){for(i in b){if(b[i]==a)return true}return false};mJS.js=mJS.ext=mJS.css={};mJS.reg=function(a,b){eval('mJS.'+a+'.'+b+'="'+b+'";')};mJS.__load=function(s,f){if(s==''){return false};var a=mJS.string.fileextension(s);if(a=='js'){var a=document.createElement('script');var b=mJS.string.filesafe(s);a.src=s;a.type='text/javascript';a.id=b;a.onreadystatechange=function(){if((this.readyState=='loaded'||this.readyState=='complete')){$(this).removeAttr('onload').removeAttr('onreadystatechange');if(mJS.check.fn(f))f()}};a.onload=function(){$(this).removeAttr('onload').removeAttr('onreadystatechange');if(mJS.check.fn(f))f()};document.getElementsByTagName('head')[0].appendChild(a);mJS.reg('js',b);if($)return $('#'+b);else return document.getElementById(b)}else if(a=='css'){$.get(s,function(d){var a=mJS.string.fileextension(s);var b=new String();var c=mJS.string.filesafe(s);if(a=='js')var b='<scr'+'ipt type="text/javascript" id="'+c+'" src="'+s+'"></scr'+'ipt>';else if(a=='css')var b='<sty'+'le type="text/css" rel="stylesheet" id="'+c+'">'+d+'</sty'+'le>';if(typeof b!='undefined'){$('head').append(b);mJS.reg(a,c);if(mJS.check&&mJS.check.fn(f))f();return $('#'+c)}})}};mJS.preload=function(a,b){var c=new Image;c.onload=b;c.src=a};if(typeof $=='undefined'){$=false;mJS.__load('http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js',function(){mJS.__load('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js',function(){jQuery.each(("drag dragenter dragleave dragover dragend drop dragstart").split(" "),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name)};if(jQuery.attrFn){jQuery.attrFn[name]=true}});$(document).ready(function(){$('.datepicker').datepicker({dateFormat:'d MM yy'})})});$(document).ready(function(){mJS.process(1);$('link').each(function(){var a=mJS.string.filesafe($(this).attr('href'));$(this).attr('id',a);mJS.reg('css',a);delete a});$('input[type="checkbox"][value="0"]').click(function(){$(this).closest('td,p').find('input:gt(0)').attr('checked',$(this).is(':checked'))}).closest('label').css({fontWeight:'600'}).closest('td,p').find('input[type="checkbox"][value!="0"]').click(function(){if(!$(this).is(':checked')){$(this).closest('td,p').find('input[type="checkbox"][value="0"]').removeAttr('checked');return true}var a=$(this).closest('td,p').find('input[type="checkbox"]').length,b=$(this).closest('td,p').find('input[type="checkbox"]:checked').length;if(b>=a-1)$(this).closest('td,p').find('input[type="checkbox"][value="0"]').attr('checked','checked')});$('script').each(function(){if(!$(this).attr('src')||$(this).attr('src')!='')return false;var a=mJS.string.filesafe($(this).attr('src'));$(this).attr('id',a);mJS.reg('js',a);delete a});window.onerror=mJS.error;mJS.process();mJS.ini()})})};mJS.ini=function(){mJS.datetime();$.fn.extend({scrollingtables:function(settings){settings=$.extend({width:false,height:'200px'},settings);var j=0,header=tablecontent='';return this.each(function(){obj=$(this);if(obj.find('th').length>0){header=obj.find('th').closest('tr');tablecontent='<div style="'+((settings.width)?'width:'+settings.width+';':'')+'height:'+settings.height+';" class="scrollingtables_container"><table class="scrollingtables_table"><tbody>'+obj.html().split(header.html()).join('').replace(/\>([\s\r\n]+)\</gi,'><').replace(/\<tr\>\<\/tr\>/gi,'')+'</tbody></table></div>'}else{header=false;tablecontent=obj.html()};var a=((header)?'<table class="scrollingtables_header"><thead><tr>'+header.html()+'</tr></thead></table>':'')+tablecontent.replace(/\<tbody\>\<tbody\>/gi,'<tbody>').replace(/\<\/tbody\>\<\/tbody\>/gi,'</tbody>');obj.after(a);if(header){obj.next('.scrollingtables_header').find('th').each(function(i,val){w=obj.next('.scrollingtables_header').next('.scrollingtables_container').find('.scrollingtables_table tr:eq(0) td:eq('+i+')').width();obj.next('.scrollingtables_header').find('th:eq('+i+')').width(w);obj.next('.scrollingtables_header').next('.scrollingtables_container').find('.scrollingtables_table tr:eq(0) td:eq('+i+')').width(w)})};if(!settings.width){w=obj.next('.scrollingtables_header').next('.scrollingtables_container').find('.scrollingtables_table').width();obj.next('.scrollingtables_header').next('.scrollingtables_container').width(obj.next('.scrollingtables_header').next('.scrollingtables_container').find('.scrollingtables_table').width()+20)}else{obj.next('.scrollingtables_header').next('.scrollingtables_container').css({overflowX:'hidden'}).find('.scrollingtables_table').width(settings.width);obj.next('.scrollingtables_header').width(settings.width)}obj.next('.scrollingtables_header').next('.scrollingtables_container').find('.scrollingtables_table tr:eq(1) td').each(function(i,v){obj.next('.scrollingtables_header').find('th:eq('+i+')').width($(this).width()+((i==obj.next('.scrollingtables_header').next('.scrollingtables_container').find('.scrollingtables_table tr:eq(1) td').length-1)?20:0))});obj.parent().find('tr,tbody').filter(function(){return $.trim($(this).html())==''}).remove();obj.remove()})}});(function(){$.extend($.fn,{rightClick:function(handler){$(this).each(function(){$(this).mousedown(function(e){var evt=e;$(this).mouseup(function(){$(this).unbind('mouseup');if(evt.button==2){handler.call($(this),evt);return false}else return true})});$(this).oncontextmenu=function(){return false}});return $(this)},rightMouseDown:function(handler){$(this).each(function(){$(this).mousedown(function(e){if(e.button==2){handler.call($(this),e);return false}else return true});$(this)[0].oncontextmenu=function(){return false}});return $(this)},rightMouseUp:function(handler){$(this).each(function(){$(this).mouseup(function(e){if(e.button==2){handler.call($(this),e);return false}else return true});$(this)[0].oncontextmenu=function(){return false}});return $(this)},noContext:function(){$(this).each(function(){$(this)[0].oncontextmenu=function(){return false}});return $(this)}})})($);mJS.doTable=function(a){a.find('tr:gt(0)').css({backgroundColor:''});a.find('tr:gt(0):visible:even').css({backgroundColor:'#d7d7d7'})};mJS.doAccordion=function(){$('.accordion').each(function(){if($(this).hasClass('accordioned'))return true;var m=$(this),a=m.find('div:odd'),b=m.find('div:even');a.addClass('holder').hide();b.addClass('handle').click(function(){if($(this).hasClass('active_handle')){$(this).closest('.accordion').find('.active_handle').removeClass('active_handle').next('.active').slideUp('fast').removeClass('active');return true};$(this).closest('.accordion').find('.active_handle').removeClass('active_handle').next('.active').slideUp('fast').removeClass('active');$(this).addClass('active_handle').next('div').slideDown('fast').addClass('active')});m.addClass('accordioned');delete m,a,b})};mJS.doAccordion();var a=document.location.hash;if(a){mJS.hash=a.replace('#','').split(',')};if(mJS.check.fn(mindshelf))mindshelf();if(typeof(hub)!=='undefined'&&mJS.check.fn(hub))hub();if(typeof(modular)!=='undefined'&&mJS.check.fn(modular))modular();for(i in mJS.plugins)if(mJS.check.fn(mJS.plugins[i]))mJS.plugins[i]()}})();
