
jQuery.print = function(message, insertionType) {
        if (typeof(message) == 'object') {
                var string = '{<br />',
                    values = [],
                    counter = 0;
                $.each(message, function(key, value) {
                        if (value && value.nodeName) {
                                var domnode = '&lt;' + value.nodeName.toLowerCase();
                                domnode += value.className ? ' class="' + value.className + '"' : '';
                                domnode += value.id ? ' id="' + value.id + '"' : '';
                                domnode += '&gt;';
                                value = domnode;
                        }
                        values[counter++] = key + ': ' + value;
                });
                string += values.join(',<br />');
                string += '<br />}';
                message = string;
        }
        
        var $output = $('#print-output');
        
     	var x = 0;
		var y = 0;
		var scroll_y = 0;
		var scroll_x = 0;
		var cartw = 800;
		var carth = 300;
		
		if(browserVersion().name == 'MSIE'){
		    x = document.documentElement.offsetWidth*0.5 - cartw + document.documentElement.scrollLeft + document.body.scrollLeft;
	       	    y = document.documentElement.offsetHeight*0.5 - carth + document.documentElement.scrollTop + document.body.scrollTop;
		    if (y<0)y = document.documentElement.scrollTop + document.body.scrollTop;
		    if (x<0)x = document.documentElement.scrollLeft + document.body.scrollLeft;
		    scroll_y = document.documentElement.scrollTop + document.body.scrollTop;
		    scroll_x = document.documentElement.scrollLeft + document.body.scrollLeft;
		}
		if(browserVersion().name == 'Firefox'){
	            x = window.innerWidth*0.5 - cartw + window.scrollX;
	            y = window.innerHeight*0.5 - carth + window.scrollY;
		    scroll_y = window.scrollY;
		    scroll_x = window.scrollX;
	        }
		if(browserVersion().name == 'Opera'){
	            x = window.innerWidth*0.5 - cartw + document.documentElement.scrollLeft + document.body.scrollLeft;
	            y = window.innerHeight*0.5 - carth + document.documentElement.scrollTop + document.body.scrollTop;
		    scroll_y = document.documentElement.scrollTop + document.body.scrollTop;
		    scroll_x = document.documentElement.scrollLeft + document.body.scrollLeft;
	        }
		
		if(x==0){
			x = window.innerWidth*0.5 - cartw + window.scrollX;
			y = window.innerHeight*0.5 - carth + window.scrollY;
			scroll_y = window.scrollY;
			scroll_x = window.scrollX;
		}
		win_height = document.body.clientHeight;
		win_width = document.body.clientWidth;

		l = (window.innerWidth - cartw)/2 + scroll_x;
		t = (window.innerHeight - carth)/2 + scroll_y
        
        if ($output.length === 0) {
                $output = $('<div id="print-output" style="z-index:1000; width:800px; height:300px; position:absolute; background-color:#fff; top:'+t+'px; left:'+t+'px; color:#000;"/>').appendTo('body');
        }
        
        var $newMessage = $('<div class="print-output-line" />');
        $newMessage.html(message);
        insertionType = insertionType || 'append';
        $output[insertionType]($newMessage);
};


/*jslint browser: true */ /*global jQuery: true */

/**
 * jQuery Cookie plugin
 *
 * Copyright (c) 2010 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
 *
 */

// TODO JsDoc

/**
 * Create a cookie with the given key 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 key The key 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 key.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String key The key 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 (key, value, options) {

    
    // key and value given, set cookie...
    if (arguments.length > 1 && (value === null || typeof value !== "object")) {
        options = jQuery.extend({}, options);
        options.path = '/'
        
        if (value === null) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? String(value) : encodeURIComponent(String(value)),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};
