TINY={};TINY.box=function(){var j,m,b,g,v,p=0;return{show:function(o){v={opacity:70,close:1,animate:1,fixed:1,mask:1,maskid:'',boxid:'',topsplit:2,url:0,post:0,height:0,width:0,html:0,iframe:0};for(s in o){v[s]=o[s]}if(!p){j=document.createElement('div');j.className='tbox';p=document.createElement('div');p.className='tinner';b=document.createElement('div');b.className='tcontent';m=document.createElement('div');m.className='tmask';g=document.createElement('div');g.className='tclose';g.v=0;document.body.appendChild(m);document.body.appendChild(j);j.appendChild(p);p.appendChild(b);m.onclick=g.onclick=TINY.box.hide;window.onresize=TINY.box.resize}else{j.style.display='none';clearTimeout(p.ah);if(g.v){p.removeChild(g);g.v=0}}p.id=v.boxid;m.id=v.maskid;j.style.position=v.fixed?'fixed':'absolute';if(v.html&&!v.animate){p.style.backgroundImage='none';b.innerHTML=v.html;b.style.display='';p.style.width=v.width?v.width+'px':'auto';p.style.height=v.height?v.height+'px':'auto'}else{b.style.display='none';if(!v.animate&&v.width&&v.height){p.style.width=v.width+'px';p.style.height=v.height+'px'}else{p.style.width=p.style.height='100px'}}if(v.mask){this.mask();this.alpha(m,1,v.opacity)}else{this.alpha(j,1,100)}if(v.autohide){p.ah=setTimeout(TINY.box.hide,1000*v.autohide)}else{document.onkeyup=TINY.box.esc}},fill:function(c,u,k,a,w,h){if(u){if(v.image){var i=new Image();i.onload=function(){w=w||i.width;h=h||i.height;TINY.box.psh(i,a,w,h)};i.src=v.image}else if(v.iframe){this.psh('',a,w,h)}else{var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');x.onreadystatechange=function(){if(x.readyState==4&&x.status==200){p.style.backgroundImage='';TINY.box.psh(x.responseText,a,w,h)}};if(k){x.open('POST',c,true);x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(k)}else{x.open('GET',c,true);x.send(null)}}}else{this.psh(c,a,w,h)}},psh:function(c,a,w,h){if(typeof c=='object'){b.appendChild(c)}else{b.innerHTML=c}var x=p.style.width,y=p.style.height;if(!w||!h){p.style.width=w?w+'px':'';p.style.height=h?h+'px':'';b.style.display='';if(!h){h=parseInt(b.offsetHeight)}if(!w){w=parseInt(b.offsetWidth)}b.style.display='none'}p.style.width=x;p.style.height=y;this.size(w,h,a)},esc:function(e){e=e||window.event;if(e.keyCode==27){TINY.box.hide()}},hide:function(){TINY.box.alpha(j,-1,0,3);document.onkeypress=null;if(v.closejs){v.closejs()}},resize:function(){TINY.box.pos();TINY.box.mask()},mask:function(){m.style.height=this.total(1)+'px';m.style.width=this.total(0)+'px'},pos:function(){var t;if(typeof v.top!='undefined'){t=v.top}else{t=(this.height()/v.topsplit)-(j.offsetHeight/2);t=t<20?20:t}if(!v.fixed&&!v.top){t+=this.top()}j.style.top=t+'px';j.style.left=typeof v.left!='undefined'?v.left+'px':(this.width()/2)-(j.offsetWidth/2)+'px'},alpha:function(e,d,a){clearInterval(e.ai);if(d){e.style.opacity=0;e.style.filter='alpha(opacity=0)';e.style.display='block';TINY.box.pos()}e.ai=setInterval(function(){TINY.box.ta(e,a,d)},20)},ta:function(e,a,d){var o=Math.round(e.style.opacity*100);if(o==a){clearInterval(e.ai);if(d==-1){e.style.display='none';e==j?TINY.box.alpha(m,-1,0,2):b.innerHTML=p.style.backgroundImage=''}else{if(e==m){this.alpha(j,1,100)}else{j.style.filter='';TINY.box.fill(v.html||v.url,v.url||v.iframe||v.image,v.post,v.animate,v.width,v.height)}}}else{var n=a-Math.floor(Math.abs(a-o)*.5)*d;e.style.opacity=n/100;e.style.filter='alpha(opacity='+n+')'}},size:function(w,h,a){if(a){clearInterval(p.si);var wd=parseInt(p.style.width)>w?-1:1,hd=parseInt(p.style.height)>h?-1:1;p.si=setInterval(function(){TINY.box.ts(w,wd,h,hd)},20)}else{p.style.backgroundImage='none';if(v.close){p.appendChild(g);g.v=1}p.style.width=w+'px';p.style.height=h+'px';b.style.display='';this.pos();if(v.openjs){v.openjs()}}},ts:function(w,wd,h,hd){var cw=parseInt(p.style.width),ch=parseInt(p.style.height);if(cw==w&&ch==h){clearInterval(p.si);p.style.backgroundImage='none';b.style.display='block';if(v.close){p.appendChild(g);g.v=1}if(v.openjs){v.openjs()}}else{if(cw!=w){p.style.width=(w-Math.floor(Math.abs(w-cw)*.6)*wd)+'px'}if(ch!=h){p.style.height=(h-Math.floor(Math.abs(h-ch)*.6)*hd)+'px'}this.pos()}},top:function(){return document.documentElement.scrollTop||document.body.scrollTop},width:function(){return self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth},height:function(){return self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight},total:function(d){var b=document.body,e=document.documentElement;return d?Math.max(Math.max(b.scrollHeight,e.scrollHeight),Math.max(b.clientHeight,e.clientHeight)):Math.max(Math.max(b.scrollWidth,e.scrollWidth),Math.max(b.clientWidth,e.clientWidth))}}}();
(function($){$.extend({tablesorter:new
function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((ab)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i= (c.totalPages-1)) {
c.page = (c.totalPages-1);
}
moveToPage(table);
}
function moveToPrevPage(table) {
var c = table.config;
c.page--;
if(c.page <= 0) {
c.page = 0;
}
moveToPage(table);
}
function moveToPage(table) {
var c = table.config;
if(c.page < 0 || c.page > (c.totalPages-1)) {
c.page = 0;
}
renderTable(table,c.rowsCopy);
}
function renderTable(table,rows) {
var c = table.config;
var l = rows.length;
var s = (c.page * c.size);
var e = (s + c.size);
if(e > rows.length ) {
e = rows.length;
}
var tableBody = $(table.tBodies[0]);
// clear the table body
$.tablesorter.clearTableBody(table);
for(var i = s; i < e; i++) {
//tableBody.append(rows[i]);
var o = rows[i];
var l = o.length;
for(var j=0; j < l; j++) {
tableBody[0].appendChild(o[j]);
}
}
//fixPosition(table,tableBody);
$(table).trigger("applyWidgets");
if( c.page >= c.totalPages ) {
moveToLastPage(table);
}
updatePageDisplay(c);
}
this.appender = function(table,rows) {
var c = table.config;
c.rowsCopy = rows;
c.totalRows = rows.length;
c.totalPages = Math.ceil(c.totalRows / c.size);
renderTable(table,rows);
};
this.defaults = {
size: 10,
offset: 0,
page: 0,
totalRows: 0,
totalPages: 0,
container: null,
cssNext: '.next',
cssPrev: '.prev',
cssFirst: '.first',
cssLast: '.last',
cssPageDisplay: '.pagedisplay',
cssPageSize: '.pagesize',
seperator: "/",
positionFixed: true,
appender: this.appender
};
this.construct = function(settings) {
return this.each(function() {
config = $.extend(this.config, $.tablesorterPager.defaults, settings);
var table = this, pager = config.container;
$(this).trigger("appendCache");
config.size = parseInt($(".pagesize",pager).val());
$(config.cssFirst,pager).click(function() {
moveToFirstPage(table);
return false;
});
$(config.cssNext,pager).click(function() {
moveToNextPage(table);
return false;
});
$(config.cssPrev,pager).click(function() {
moveToPrevPage(table);
return false;
});
$(config.cssLast,pager).click(function() {
moveToLastPage(table);
return false;
});
$(config.cssPageSize,pager).change(function() {
setPageSize(table,parseInt($(this).val()));
return false;
});
});
};
}
});
// extend plugin scope
$.fn.extend({
tablesorterPager: $.tablesorterPager.construct
});
})(jQuery);
/*
* Copyright (c) 2008 Justin Britten justinbritten at gmail.com
*
* Some code was borrowed from:
* 1. Greg Weber's uiTableFilter project (http://gregweber.info/projects/uitablefilter)
* 2. Denny Ferrassoli & Charles Christolini's TypeWatch project (www.dennydotnet.com)
*
* Contributions have been made by:
* René Leonhardt (github.com/rleonhardt)
* Thomas Kappler (github.com/thomas11)
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
(function($) {
$.extend({
tablesorterFilter: new function() {
// Default filterFunction implementation (element text, search words, case-sensitive flag)
function has_words(str, words, caseSensitive) {
var text = caseSensitive ? str : str.toLowerCase();
for (var i=0; i < words.length; i++) {
if (words[i].charAt(0) == '-') {
if (text.indexOf(words[i].substr(1)) != -1) return false; // Negated word must not be in text
} else if (text.indexOf(words[i]) == -1) return false; // Normal word must be in text
}
return true;
}
function doFilter(table) {
if(table.config.debug) { var cacheTime = new Date(); }
// Build multiple filters from input boxes
// TODO: enable incremental filtering by caching result and applying only single filter action
var filters = [];
// Implement dynamic selection of a filter column
// by setting filter.filterColumns based on the user's
// query. That means we have to restore the base configuration
// of filterColumns after processing the query.
var defaultFilterColumns = [];
for(var i=0; i < table.config.filter.length; i++) {
var filter = table.config.filter[i];
var container = $(filter.filterContainer);
// Record the base setting of filtered columns to
// be able to restore it later, see above.
defaultFilterColumns[i] = filter.filterColumns;
// Trim and unify whitespace before splitting
var phrase = jQuery.trim(container.val()).replace(/\s+/g, ' ');
if(phrase.length != 0) {
// Check for a 'col:' prefix.
var field_prefix = /^([a-z]+):(.+)/;
var match = field_prefix.exec(phrase);
if (match !== null) {
// The user wants to filter based on a
// certain column. Find the index of that column and
// set filterColumns accordingly.
var field = match[1];
phrase = match[2];
for (var k=0; k < filter.columns.length; k++) {
if (filter.columns[k].indexOf(field) === 0) {
filter.filterColumns = [k];
break;
}
}
}
var caseSensitive = filter.filterCaseSensitive;
filters.push({
caseSensitive: caseSensitive,
words: caseSensitive ? phrase.split(" ") : phrase.toLowerCase().split(" "),
findStr: filter.filterColumns ? "td:eq(" + filter.filterColumns.join("),td:eq(") + ")" : "",
filterFunction: filter.filterFunction
});
}
// Restore the base setting of filtered columns
filter.filterColumns = defaultFilterColumns[i];
}
var filterCount = filters.length;
// Filter cleared?
if(filterCount == 0) {
var search_text = function() {
var elem = jQuery(this);
resultRows[resultRows.length] = elem;
}
} else {
var search_text = function() {
var elem = jQuery(this);
for(var i=0; i < filterCount; i++) {
if(! filters[i].filterFunction(
(filters[i].findStr ? elem.find(filters[i].findStr) : elem).text(),
filters[i].words,
filters[i].caseSensitive) ) {
return true; // Skip elem and continue to next element
}
}
resultRows[resultRows.length] = elem;
}
}
// Walk through all of the table's rows and search.
// Rows which match the string will be pushed into the resultRows array.
var allRows = table.config.cache.row;
var resultRows = [];
var allRowsCount = allRows.length;
for (var i=0; i < allRowsCount; i++) {
allRows[i].each ( search_text );
}
// Clear the table
$.tablesorter.clearTableBody(table);
// Push all rows which matched the search string onto the table for display.
var resultRowsCount = resultRows.length;
for (var i=0; i < resultRowsCount; i++) {
$(table.tBodies[0]).append(resultRows[i]);
}
// Update the table by executing some of tablesorter's triggers
// This will apply any widgets or pagination, if used.
$(table).trigger("update");
if (resultRows.length) {
$(table).trigger("appendCache");
// Apply current sorting after restoring rows
$(table).trigger("sorton", [table.config.sortList]);
}
if(table.config.debug) { $.tablesorter.benchmark("Apply filter:", cacheTime); }
// Inform subscribers that filtering finished
$(table).trigger("filterEnd");
return table;
};
function clearFilter(table) {
if(table.config.debug) { var cacheTime = new Date(); }
// Reset all filter values
for(var i=0; i < table.config.filter.length; i++)
$(table.config.filter[i].filterContainer).val('').get(0).lastValue = '';
var allRows = table.config.cache.row;
$.tablesorter.clearTableBody(table);
for (var i=0; i < allRows.length; i++) {
$(table.tBodies[0]).append(allRows[i]);
}
$(table).trigger("update");
$(table).trigger("appendCache");
// Apply current sorting after restoring all rows
$(table).trigger("sorton", [table.config.sortList]);
if(table.config.debug) { $.tablesorter.benchmark("Clear filter:", cacheTime); }
$(table).trigger("filterCleared");
return table;
};
this.defaults = {
filterContainer: '#filter-box',
filterClearContainer: '#filter-clear-button',
filterColumns: null,
filterCaseSensitive: false,
filterWaitTime: 500,
filterFunction: has_words,
columns: []
};
this.construct = function() {
var settings = arguments; // Allow multiple config objects in constructor call
return this.each(function() {
this.config.filter = new Array(settings.length);
var config = this.config;
config.filter = new Array(settings.length);
for (var i = 0; i < settings.length; i++)
config.filter[i] = $.extend(this.config.filter[i], $.tablesorterFilter.defaults, settings[i]);
var table = this;
// Create a timer which gets reset upon every keyup event.
//
// Perform filter only when the timer's wait is reached (user finished typing or paused long enough to elapse the timer).
//
// Do not perform the filter is the query has not changed.
//
// Immediately perform the filter if the ENTER key is pressed.
function checkInputBox(inputBox, override) {
var value = inputBox.value;
if ((value != inputBox.lastValue) || (override)) {
inputBox.lastValue = value;
doFilter( table );
}
};
var timer = new Array(settings.length);
for (var i = 0; i < settings.length; i++) {
var container = $(config.filter[i].filterContainer);
// TODO: throw error for non-existing filter container?
if(container.length)
container[0].filterIndex = i;
container.keyup(function(e, phrase) {
var index = this.filterIndex;
if(undefined !== phrase)
$(this).val(phrase);
var inputBox = this;
// Was ENTER pushed?
if (inputBox.keyCode == 13 || undefined !== phrase) {
var timerWait = 1;
var overrideBool = true;
} else {
var timerWait = config.filter[index].filterWaitTime || 500;
var overrideBool = false;
}
var timerCallback = function() {
checkInputBox(inputBox, overrideBool);
}
// Reset the timer
clearTimeout(timer[index]);
timer[index] = setTimeout(timerCallback, timerWait);
return false;
});
// Avoid binding click event to whole document if no clearContainer has been defined
if(config.filter[i].filterClearContainer) {
var container = $(config.filter[i].filterClearContainer);
if(container.length) {
container[0].filterIndex = i;
container.click(function() {
var index = this.filterIndex;
var container = $(config.filter[index].filterContainer);
container.val("");
// Support entering the same filter text after clearing
container[0].lastValue = "";
// TODO: Clear single filter only
doFilter(table);
if(container[0].type != 'hidden')
container.focus();
});
}
}
}
$(table).bind("doFilter",function() {
doFilter(table);
});
$(table).bind("clearFilter",function() {
clearFilter(table);
});
});
};
}
});
// extend plugin scope
$.fn.extend({
tablesorterFilter: $.tablesorterFilter.construct
});
})(jQuery);
// jQuery Alert Dialogs Plugin
//
// Version 1.1
//
// Cory S.N. LaViska
// A Beautiful Site (http://abeautifulsite.net/)
// 14 May 2009
//
// Visit http://abeautifulsite.net/notebook/87 for more information
//
// Usage:
// jAlert( message, [title, callback] )
// jConfirm( message, [title, callback] )
// jPrompt( message, [value, title, callback] )
//
// History:
//
// 1.00 - Released (29 December 2008)
//
// 1.01 - Fixed bug where unbinding would destroy all resize events
//
// License:
//
// This plugin is dual-licensed under the GNU General Public License and the MIT License and
// is copyright 2008 A Beautiful Site, LLC.
//
(function($) {
$.alerts = {
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
repositionOnResize: true, // re-centers the dialog on window resize
overlayOpacity: .75, // transparency level of overlay
overlayColor: '#FFF', // base color of overlay
draggable: false, // make the dialogs draggable (requires UI Draggables plugin)
okButton: ' OK ', // text for the OK button
cancelButton: ' Cancel ', // text for the Cancel button
dialogClass: null, // if specified, this class will be applied to all dialogs
// Public methods
alert: function(message, title, callback) {
if( title == null ) title = 'Alert';
$.alerts._show(title, message, null, 'alert', function(result) {
if( callback ) callback(result);
});
},
confirm: function(message, title, callback) {
if( title == null ) title = 'Confirm';
$.alerts._show(title, message, null, 'confirm', function(result) {
if( callback ) callback(result);
});
},
prompt: function(message, value, title, callback) {
if( title == null ) title = 'Prompt';
$.alerts._show(title, message, value, 'prompt', function(result) {
if( callback ) callback(result);
});
},
// Private methods
_show: function(title, msg, value, type, callback) {
$.alerts._hide();
$.alerts._overlay('show');
$("BODY").append(
'');
if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
// IE6 Fix
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
$("#popup_container").css({
position: pos,
zIndex: 99999,
padding: 0,
margin: 0
});
$("#popup_title").text(title);
$("#popup_content").addClass(type);
$("#popup_message").text(msg);
$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '
') );
$("#popup_container").css({
minWidth: $("#popup_container").outerWidth(),
maxWidth: $("#popup_container").outerWidth()
});
$.alerts._reposition();
$.alerts._maintainPosition(true);
switch( type ) {
case 'alert':
$("#popup_message").after('');
$("#popup_ok").click( function() {
$.alerts._hide();
callback(true);
});
$("#popup_ok").focus().keypress( function(e) {
if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
});
break;
case 'confirm':
$("#popup_message").after('');
$("#popup_ok").click( function() {
$.alerts._hide();
if( callback ) callback(true);
});
$("#popup_cancel").click( function() {
$.alerts._hide();
if( callback ) callback(false);
});
$("#popup_ok").focus();
$("#popup_ok, #popup_cancel").keypress( function(e) {
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
});
break;
case 'prompt':
$("#popup_message").append('
').after('');
$("#popup_prompt").width( $("#popup_message").width() );
$("#popup_ok").click( function() {
var val = $("#popup_prompt").val();
$.alerts._hide();
if( callback ) callback( val );
});
$("#popup_cancel").click( function() {
$.alerts._hide();
if( callback ) callback( null );
});
$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
});
if( value ) $("#popup_prompt").val(value);
$("#popup_prompt").focus().select();
break;
}
// Make draggable
if( $.alerts.draggable ) {
try {
$("#popup_container").draggable({ handle: $("#popup_title") });
$("#popup_title").css({ cursor: 'move' });
} catch(e) { /* requires jQuery UI draggables */ }
}
},
_hide: function() {
$("#popup_container").remove();
$.alerts._overlay('hide');
$.alerts._maintainPosition(false);
},
_overlay: function(status) {
switch( status ) {
case 'show':
$.alerts._overlay('hide');
$("BODY").append('');
$("#popup_overlay").css({
position: 'absolute',
zIndex: 99998,
top: '0px',
left: '0px',
width: '100%',
height: $(document).height(),
background: $.alerts.overlayColor,
opacity: $.alerts.overlayOpacity
});
break;
case 'hide':
$("#popup_overlay").remove();
break;
}
},
_reposition: function() {
var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
if( top < 0 ) top = 0;
if( left < 0 ) left = 0;
// IE6 fix
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
$("#popup_container").css({
top: top + 'px',
left: left + 'px'
});
$("#popup_overlay").height( $(document).height() );
},
_maintainPosition: function(status) {
if( $.alerts.repositionOnResize ) {
switch(status) {
case true:
$(window).bind('resize', $.alerts._reposition);
break;
case false:
$(window).unbind('resize', $.alerts._reposition);
break;
}
}
}
}
// Shortuct functions
jAlert = function(message, title, callback) {
$.alerts.alert(message, title, callback);
}
jConfirm = function(message, title, callback) {
$.alerts.confirm(message, title, callback);
};
jPrompt = function(message, value, title, callback) {
$.alerts.prompt(message, value, title, callback);
};
})(jQuery);
jQuery(function($) {
$("#amq_list").tablesorter({
widgets: ['zebra'],
headers:{
6:{
sorter: false
}
},
sortList: [[0,1]]
}).tablesorterPager({
container: $("#pager")}
);
$.alerts.overlayColor = '#333';
$("body").on("click", ".delete", function(){
var qID = $(this).attr('rel');
var parentRow = $(this).parent().parent();
jConfirm('Are you sure you want to delete this question?', 'Delete Question', function(result) {
if(result == true){
$.post($("#plugin_path").val()+'/delete_question.php', {"id": qID}, function(obj){
if(obj.result == true){
$("#amq_list").trigger("update");
$(parentRow).fadeOut();
}else{
alert('oops');
}
})
}
});
return false;
});
$("body").on("click", ".answer", function(){
var thisID = $(this).attr('rel');
TINY.box.show({
url:$("#plugin_path").val()+'/modal.php',
post:'id='+thisID+'',
maskid:'mask',
fixed: false,
maskopacity:40,
})
return false;
});
$("body").on("click", "#cancel", function(){
TINY.box.hide();
return false;
});
$("body").on("click", "#save", function(){
var fieldNames = ['subject', 'question', 'answer'];
var fieldLength = fieldNames.length;
for(i=0;iNo');
}else if(data.display === 1){
$(thisCell).html('Yes');
}
}else{
$(thisCell).html('Unable to change display setting!');
}
});
});
//Plugin Settings
if(!$("#notify:checked").length){
$("#email").attr('disabled', true);
}
if($("#email").val() != ''){
$("#notify").attr('checked', true);
}
$("#notify").click(function() {
if($(this).attr('checked')){
$("#email").attr('disabled', false);
}else{
$("#email").val('');
$("#email").attr('disabled', true);
}
});
});