',
iframeWidth: null,
iframeHeight: null,
popHt : 500,
popWd : 400,
popX : 200,
popY : 200,
popTitle : '',
popClose : false
};
var settings = {};//global settings
$.fn.printArea = function( options )
{
$.extend( settings, defaults, options );
var $this = $(this);
counter++;
var idPrefix = "printArea_";
$( "[id^=" + idPrefix + "]" ).remove();
var ele = getFormData( $this );
settings.id = idPrefix + counter;
if (settings.iframeWidth == null)
{
settings.iframeWidth = $this.outerWidth();
}
if (settings.iframeHeight == null)
{
settings.iframeHeight = $this.outerHeight();
}
var writeDoc;
var printWindow;
switch ( settings.mode )
{
case modes.iframe :
var f = new Iframe(settings.selector);
writeDoc = f.doc;
printWindow = f.contentWindow || f;
break;
case modes.popup :
printWindow = new Popup();
writeDoc = printWindow.doc;
}
writeDoc.open();
writeDoc.write( settings.doctype + '' + getHead() + getBody(ele) + '' );
$(writeDoc).find('a').click(function(e) { e.preventDefault(); });
writeDoc.close();
//printWindow.focus();
//printWindow.print();
if ( settings.mode == modes.popup && settings.popClose )
printWindow.close();
}
function getHead()
{
var head = "
" + settings.popTitle + "";
$(document).find("link")
.filter(function(){
return $(this).attr("rel").toLowerCase() == "stylesheet";
})
.filter(function(){ // this filter contributed by "mindinquiring"
var media = $(this).attr("media");
return (media.toLowerCase() == "" || media.toLowerCase() == "print")
})
.each(function(){
head += '
';
});
head += "";
return head;
}
function getBody(printElm)
{
return '
' + printElm.html() + '
';
}
function getFormData( ele )
{
$("input,select,textarea", ele).each(function(){
// In cases where radio, checkboxes and select elements are selected and deselected, and the print
// button is pressed between select/deselect, the print screen shows incorrectly selected elements.
// To ensure that the correct inputs are selected, when eventually printed, we must inspect each dom element
var type = $(this).attr("type");
if ( type == "radio" || type == "checkbox" )
{
if ( $(this).is(":not(:checked)") ) this.removeAttribute("checked");
else this.setAttribute( "checked", true );
}
else if ( type == "text" )
this.setAttribute( "value", $(this).val() );
else if ( type == "select-multiple" || type == "select-one" )
$(this).find( "option" ).each( function() {
if ( $(this).is(":not(:selected)") ) this.removeAttribute("selected");
else this.setAttribute( "selected", true );
});
else if ( type == "textarea" )
{
var v = $(this).attr( "value" );
if ($.browser.mozilla)
{
if (this.firstChild) this.firstChild.textContent = v;
else this.textContent = v;
}
else this.innerHTML = v;
}
});
return ele;
}
function Iframe(selector)
{
var frameId = settings.id;
var iframeStyle = 'border:0; overflow:hidden; width:' + settings.iframeWidth + 'px; height:' + settings.iframeHeight + 'px;';
var iframe;
try
{
iframe = document.createElement('iframe');
iframe.frameBorder = 0; // For IE
iframe.scrolling = 'no'; // For IE
$(selector).empty()[0].appendChild(iframe);
$(iframe).attr({ style: iframeStyle, id: frameId, src: "", scrolling: 'no', frameBorder: 'no' });
iframe.doc = null;
iframe.doc = iframe.contentDocument ? iframe.contentDocument : ( iframe.contentWindow ? iframe.contentWindow.document : iframe.document);
}
catch( e ) { throw e + ". iframes may not be supported in this browser."; }
if ( iframe.doc == null ) throw "Cannot find document.";
return iframe;
}
function Popup()
{
var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no";
windowAttr += ",width=" + settings.popWd + ",height=" + settings.popHt;
windowAttr += ",resizable=yes,screenX=" + settings.popX + ",screenY=" + settings.popY + ",personalbar=no,scrollbars=no";
var newWin = window.open( "", "_blank", windowAttr );
newWin.doc = newWin.document;
return newWin;
}
})(jQuery);;
/* Comment Generated by Combres - Resource '~/static/js/ext/jquery.cookie.js' (Mode: Static) */
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
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(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
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 { // only name given, get cookie
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]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};;
/* Comment Generated by Combres - Resource '~/static/js/control/faq-expander.js' (Mode: Static) */
/**
* Created by Genex
* User: wkhoe
* Date: Dec 7, 2010
*/
(function ($, window) {
$.fn.faqExpander = function()
{
this.each(function(i)
{
var $this = $(this);
$this.find('dt a').live('click', expandCollapseAnswer);
$this.find('.link-expand-all').click(expandAll);
$this.find('.link-collapse-all').click(collapseAll);
});
}
function expandCollapseAnswer(e)
{
e.preventDefault();
var $question = $(this).parent();
$question.toggleClass('active').next('dd').toggleClass('active');
}
function expandAll(e)
{
e.preventDefault();
$(this).closest('.faq').find('dt, dd').addClass('active');
}
function collapseAll(e)
{
e.preventDefault();
$(this).closest('.faq').find('dt, dd').removeClass('active');
}
})(jQuery, this);