var nf_publisher;if(!nf_publisher){$(document).ready(function(){cnsl.logIsOn=true;cnsl.init();});}
var cnsl={init:function(){if(cnsl.isOn()){cnsl.getState();cnsl.style.add(cnsl.style.css());cnsl.create();cnsl.moveble();cnsl.show.init();}},create:function(){cnsl.element=$('<div/>').attr('id','nf_cnsl').append($('<div/>').addClass('cnsl_titlebar').append($('<div/>').addClass('cnsl_title').text('nf_cnsl'),$('<div/>').addClass('cnsl_close').text('x').click(function(){$('#nf_cnsl').remove();cnsl.off();})).dblclick(function(){$(this).parent().toggleClass('minimized');}).hover(function(){document.onselectstart=function(){return false;};},function(){document.onselectstart=function(){return true;};}),$('<div/>').addClass('cnsl_linkbar').append($('<a/>').addClass('all').text('all'),$('<a/>').addClass('debug').text('temp'),$('<a/>').addClass('info').text('update'),$('<a/>').addClass('warn').text('behaviour'),$('<a/>').addClass('error').text('build'),$('<a/>').addClass('fatal').text('fatal'),$('<a/>').addClass('erase').text('erase')),$('<div/>').attr('id','nf_cnsl_log'));$('body').append(cnsl.element);$(window).resize(cnsl.moveinsight);},moveinsight:function(){var w=$(window).width();var h=$(window).height();var c=cnsl.element;var a=false;if(c.offset().left+c.width()-c.width()/1.1>=w){c.css('left',w-c.width()+c.width()/1.1);a=true;}
if(c.offset().top+c.height()-c.height()/1.1>=h&&nf_publisher){c.css('top',h-c.height()+c.height()/1.1);a=true;}
if(c.offset().top<0){c.css('top',6);a=true;}
if(a)$.cookie('nf_cnsl_state',c.height()+'/'+c.width()+'/'+c.offset().top+'/'+c.offset().left,{path:'/',expires:100});},log:function(type,var_string){if(!cnsl.isOn())return false;if(type)type=type.toString();else return false;if(!var_string){var var_string=type;debug(var_string);}
else{if(type.match('build')){error(var_string);}
if(type.match('behave')){warn(var_string);}
if(type.match('update')){info(var_string);}
if(type.match('log')){$.post("/publisher/system/log/log.php",{post_string:var_string});}}},moveble:function(){cnsl.element.draggable({handle:cnsl.element.find('.cnsl_titlebar:first'),stop:cnsl.storePos});cnsl.element.resizable({handles:'se',stop:cnsl.storeSize,minWidth:217,minHeight:55});},show:{init:function(){cnsl.element.find('a').click(function(){cnsl.show[$(this).attr('class')]();});},all:function(){FVL_showMessages();},debug:function(){FVL_showMessages(FVL_DEBUG);},info:function(){FVL_showMessages(FVL_INFO);},warn:function(){FVL_showMessages(FVL_WARN);},error:function(){FVL_showMessages(FVL_ERROR);},fatal:function(){FVL_showMessages(FVL_FATAL);},erase:function(){eraseLog(true);}},write:function(){},style:{add:function(css){$('head').append($('<style/>').attr('type','text/css').text(css));},css:function(){css="#nf_cnsl{\
    position: fixed;\
    padding: 6px;\
    top: "+(cnsl.dmnsn.t||50)+"px;\
    left: "+(cnsl.dmnsn.l||650)+"px;\
    width: "+(cnsl.dmnsn.w||125)+"px;\
    height: "+(cnsl.dmnsn.h||250)+"px;\
    min-height: 100px;\
    background: #414141;\
    background: -webkit-gradient(\
     linear, left top, left bottom,\
     color-stop(0.2, rgb(84, 84, 84)),\
     color-stop(0.9, rgb(55, 55, 55))\
    );\
    background: -moz-linear-gradient(\
     -90deg,\
     rgb(84, 84, 84),\
     rgb(55, 55, 55)\
    );\
    font: 9px 'nfscreen9';\
    color: rgb(220, 220, 220);\
    -webkit-box-shadow: 0px 1px 2px black;\
    -moz-box-shadow: 0px 1px 2px black;\
    z-index: 9999;\
    overflow: hidden:\
    }\
   .minimized{\
    height: 16px!important;\
    min-height: 16px!important;\
   }\
   .minimized .cnsl_linkbar, .minimized #nf_cnsl_log{\
    display: none;\
   }\
   .cnsl_titlebar{\
    width: 100%;\
    height: 17px;\
    background: -webkit-gradient(\
     linear, left top, left bottom,\
     color-stop(0.2, rgb(84, 84, 84)),\
     color-stop(0.9, rgb(55, 55, 55))\
    );\
    -webkit-box-shadow: 0px 1px 2px rgb(40,40,40);\
    -moz-box-shadow: 0px 1px 2px rgb(40,40,40);\
    cursor: move;\
    }\
   .cnsl_titlebar div{\
    position: absolute;\
    padding: 3px;\
    }\
   .cnsl_title{\
    cursor: default;\
    }\
   .cnsl_close{\
    right: 8px;\
    cursor: pointer;\
    }\
   .cnsl_linkbar{\
    position: relative;\
    width: 100%;\
    height: 15px;\
    margin-top: 4px;\
    margin-bottom: 5px;\
    padding: 3px 0 0px 0;\
    -webkit-box-shadow: 0px 1px 2px rgb(40,40,40);\
    -moz-box-shadow: 0px 1px 2px rgb(40,40,40);\
    background: -webkit-gradient(\
     linear, left top, left bottom,\
     color-stop(0.2, rgb(84, 84, 84)),\
     color-stop(0.9, rgb(55, 55, 55))\
    );\
    z-index: 100;\
    }\
   .cnsl_linkbar a{\
    position: relative;\
    cursor: pointer;\
    height: 17px;\
    display: inline-table;\
    margin-left: 2px;\
    padding: 1px 1px 1px 1px;\
    z-index: 999;\
    }\
   .cnsl_linkbar .debug { color: lime; }\
   .cnsl_linkbar .info  { color: lightblue; }\
   .cnsl_linkbar .warn  { color: yellow; }\
   .cnsl_linkbar .error { color: #ED791F; }\
   .cnsl_linkbar .fatal { color: gray; }\
   #nf_cnsl_log{\
    position: absolute;\
    overflow: auto;\
    top: 44px;\
    bottom: 6px;\
    left: 6px;\
    right: 6px;\
    padding: 2px;\
    z-index: -1;\
    }\
   #nf_cnsl_log p{\
    margin: 0;\
    }\
   #nf_cnsl p.debug { color: lime;  }\
   #nf_cnsl p.info  { color: lightblue; }\
   #nf_cnsl p.warn  { color: yellow; }\
   #nf_cnsl p.error { color: #ED791F; }\
   #nf_cnsl p.fatal { color: black; }";return css;}},storePos:function(e,ui){var h=cnsl.element.height();var w=cnsl.element.width();var t=ui.position.top;var l=ui.position.left;cnsl.log('update','nf_cnsl_state: '+h+'/'+w+'/'+t+'/'+l);$.cookie('nf_cnsl_state',h+'/'+w+'/'+t+'/'+l,{path:'/',expires:100});},storeSize:function(e,ui){var h=ui.size.height;var w=ui.size.width;var t=cnsl.element.offset().top;var l=cnsl.element.offset().left;cnsl.log('update','nf_cnsl_state: '+h+'/'+w+'/'+t+'/'+l);$.cookie('nf_cnsl_state',h+'/'+w+'/'+t+'/'+l,{path:'/',expires:100});},getState:function(e,ui){var dimens=$.cookie('nf_cnsl_state');if(dimens){dimens=dimens.split('/');var h=dimens[0];var w=dimens[1];var t=dimens[2];var l=dimens[3];}
cnsl.dmnsn={h:h||250,w:w||217,t:t||20,l:l||550};},scrollDown:function(){$('#nf_cnsl_log').each(function(){this.scrollTop=this.scrollHeight;});},on:function(){$.cookie('nf_cnsl_visibility','true',{path:'/',expires:100});cnsl.init();},off:function(){$.cookie('nf_cnsl_visibility','false',{path:'/',expires:100});},isOn:function(){var visibility=$.cookie('nf_cnsl_visibility');if(visibility=='true')return true;if(visibility=='false')return false;else return false;}};var FVLOGGER_VERSION='1.0';var FVL_LOG_ON=true;var FVL_DEFAULT_LOG_LEVEL=FVL_DEBUG;var FVL_LOG_ID='nf_cnsl_log';var FVL_LOG_ELEMENT='p';var FVL_DEBUG=0;var FVL_INFO=1;var FVL_WARN=2;var FVL_ERROR=3;var FVL_FATAL=4;var FVL_LOG_CLASSES=new Array("debug","info","warn","error","fatal");function getLogger(id){if(arguments.length==0){id=FVL_LOG_ID;}
return document.getElementById(id);}
function showDebug(){FVL_showMessages(FVL_DEBUG);}
function showInfo(){FVL_showMessages(FVL_INFO);}
function showWarn(){FVL_showMessages(FVL_WARN);}
function showError(){FVL_showMessages(FVL_ERROR);}
function showFatal(){FVL_showMessages(FVL_FATAL);}
function showAll(){FVL_showMessages();}
function eraseLog(){var debug=getLogger();if(!debug){return false;}
var ps=debug.getElementsByTagName(FVL_LOG_ELEMENT);var length=ps.length;for(var i=0;i<length;i++){debug.removeChild(ps[length-i-1]);}
return true;}
function debug(message){FVL_log(""+message,FVL_DEBUG);}
function warn(message){FVL_log(""+message,FVL_WARN);}
function info(message){FVL_log(""+message,FVL_INFO);}
function error(message){FVL_log(""+message,FVL_ERROR);}
function fatal(message){FVL_log(""+message,FVL_FATAL);}
function windowError(message,url,line){FVL_log('Error on line '+line+' of document '+url+': '+message,FVL_FATAL);return true;}
if(FVL_LOG_ON){window.onerror=windowError;}
function FVL_showMessages(level,hideOthers){var showAll=false;if(arguments.length==0){level=FVL_DEFAULT_LOG_LEVEL;showAll=true;}
if(arguments.length<2){hideOthers=true;}
var debug=getLogger();if(!debug){return false;}
var ps=debug.getElementsByTagName("p");if(ps.length==0){return true;}
var l=ps.length;var lookup=FVL_LOG_CLASSES[level];for(var i=l-1;i>=0;i--){if(hideOthers){hide(ps[i]);}
var c=getNodeClass(ps[i]);if(c&&c.indexOf(lookup)>-1||showAll){show(ps[i]);}}}
function FVL_log(message,level){if(!FVL_LOG_ON){return false;}
if(arguments.length==1){level=FVL_INFO;}
if(level<FVL_DEFAULT_LOG_LEVEL){return false;}
var div=getLogger();if(!div){return false;}
var p=document.createElement(FVL_LOG_ELEMENT);if(p.getAttributeNode("class")){for(var i=0;i<p.attributes.length;i++){if(p.attributes[i].name.toUpperCase()=='CLASS'){p.attributes[i].value=FVL_LOG_CLASSES[level];}}}else{p.setAttribute("class",FVL_LOG_CLASSES[level]);}
var text=document.createTextNode(message);p.appendChild(text);div.appendChild(p);cnsl.scrollDown();return true;}
function exampleLogs(){debug('Scatter debug messages throughout your code to provide a high-level overview of what your code is doing, such as which function is currently in scope and the values of loop counters.');info('Information messages are the meat and potatoes of logging messages; sprinkle them around to reveal more detailed information about your script\'s execution, such as the values of variables and function/method return values.');warn('Warning messages are used to indicate potentially hazardous situations, such as missing function arguments...');error('While error messages are used to indicate that something bad is about to happen; note that these kinds of errors are considered to be run-time errors, which are a different type of beast from the parse errors mentioned below.');a;}
function show(target){target.style.display="";return true;}
function hide(target){target.style.display="none";return true;}
function getNodeClass(obj){var result=false;if(obj.getAttributeNode("class")){result=obj.attributes.getNamedItem("class").value;}
return result;}
var time={init:new Date(),set:{start:function(){time.start=time.init.getTime();},load:function(){var date=new Date();time.load=date.getTime();}},get:{ready:function(){var date=new Date();time.ready=date.getTime();load=time.load-time.start;ready=time.ready-time.load;cnsl.log('build','buildtime: '+ready+' ms');}}}
time.set.start();;jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};