// JavaScript Document
var clearQueue = true;
var gotoEnd = true;

// todo: when input form empty, show original text in italic;
$(document).ready(function() 
{
	if (jQuery.browser.msie) {
        try { 
            document.execCommand("BackgroundImageCache", false, true); 
        } catch(err) {}
    }
});
$.fn.exists = function()
{
	return $(this).length > 0;
};
$.fn.onclick = function(fn) 
{
	return this.each(function(){ $(this).css('cursor','pointer').click(fn); })
};
$.javascript = function(file, folder)
{
	if (!folder) folder = 'jscripts/';
	$('<script></script>')
	.attr('type','text/javascript')
	.attr('src',folder+file+'.js')
	.appendTo('head');
	
};
Array.prototype.last = function()
{
	return this[this.length - 1];
};

function AjaxResponse(string)
{
	this.array = string.split('|');
	this.status = this.array.shift();
	this.size = this.array.length;
	this.msg = (this.size > 0) ? this.array[ this.size - 1] : '';
	this.hasMsg = (this.msg != '');
}

/**
* Delay for a number of milliseconds
*/
$.sleep = function(delay)
{
    var start = new Date().getTime();
    while (new Date().getTime() < start + delay);
}
