/*
 * JTip
 * By Cody Lindley (http://www.codylindley.com)
 * Under an Attribution, Share Alike License
 * JTip is built on top of the very light weight jquery library.
 
 * Modifications by Rey Bango and Karl Swedberg
 */

//on page load (as soon as it is ready) call JT_init
jq(document).ready(JT_init);

function JT_init(){
	// 9/21/06 - Rey Bango added hide() method to correct an issue with FF
	jq("a.jTip")	  
	  .wrap('<span style="position:relative;"></span>')
	  .hover(function() {
	    JT_show(this.href,this.id,this.name)
	  },function() {
	    jq('#JT, #JT_arrow_left, #JT_arrow_right').hide().remove();
	  })
    .click(function(){return false});	   
}

function JT_show(url,linkId,title){
	if(title == false)title="&nbsp;";
	var de = document.documentElement;
	var w = self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var hasArea = w - getAbsoluteLeft(linkId);
	var clickElementy = getAbsoluteTop(linkId) - 3; //set y position
	
	var queryString = url.replace(/^[^\?]+\??/,'');
	var params = parseQuery( queryString );
	if(params['width'] === undefined){params['width'] = 250};
	if(params['link'] !== undefined){
  	jq('#' + linkId).bind('click',function(){window.location = params['link']});
  	jq('#' + linkId).css('cursor','pointer');
	}
	
	if(hasArea>((params['width']*1)+75)){
		jq("body").append("<div id='JT' style='width:"+params['width']*1+"px'><div id='JT_close_left'>"+title+"</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");//right side
		jq('body').append('<div id="JT_arrow_left"></div>'); 
		var arrowOffset = getElementWidth(linkId) + 11;
		var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; //set x position
    jq('#JT_arrow_left').css({left: (clickElementx - 10) + "px", top: clickElementy +"px"});		
	}else{
		jq("body").append("<div id='JT' style='width:"+params['width']*1+"px'><div id='JT_close_right'>"+title+"</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");//left side
		jq('body').append('<div id="JT_arrow_right"></div>');
		var clickElementx = getAbsoluteLeft(linkId) - ((params['width']*1) + 20); //set x position
	  jq('#JT_arrow_right').css({left: (getAbsoluteLeft(linkId) - 20) + "px", top: clickElementy + "px"});		
	}
	if (jq.browser.msie) { 
		jq('#JT').prepend('<iframe id="jTipiFrame"></iframe>'); // iframe for IE select box z-index issue
	  jq('#jTipiFrame').width((params['width']*1) + "px");	
	}	
	jq('#JT').css({left: clickElementx+"px", top: clickElementy +"px"});
   
	jq('#JT_copy').load(url, function() {
	  //if jtip goes to left side and is partially cut off at left of doc...	  
	  if (jq('#JT_arrow_right') && clickElementx < 0) {
	    var JT_width = (getAbsoluteLeft(linkId) - 22);
	    jq('#JT').css({left: 2, width: JT_width}); //adjust width to fit
	  }
	  //get the height of the jtip after loading it
	  var jtip_height = jq('#JT').height();
	  //adjust the top of jTip
	  move_jtip();
	  if ( (scroll_position + window_height) - clickElementy < jtip_height ) {
	    var adjusted_top = (window_height - jtip_height) - 6 + scroll_position;
      if ( adjusted_top - scroll_position < 0 ) {
        jq('#JT').css({top: scroll_position + 1});
      } else {
        jq('#JT').css({top: adjusted_top});
      }
    }      
	}); // end .load()
	jq('#JT').show();
} // end JT_show()

function getElementWidth(objectId) {
	x = document.getElementById(objectId);
	return x.offsetWidth;
}

function getAbsoluteLeft(objectId) {
	// Get an object left position from the upper left viewport corner
	o = document.getElementById(objectId)
	oLeft = o.offsetLeft            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent left position
		o = oParent
	}
	return oLeft
}

function getAbsoluteTop(objectId) {
	// Get an object top position from the upper left viewport corner
	o = document.getElementById(objectId);
	oTop = 0;
	if(o.offsetParent) {
	  o = o.offsetParent;
	}
	while(o) { // Parse the parent hierarchy up to the document element
		oTop += o.offsetTop; // Add parent top position
		o = o.offsetParent;
	}
	return oTop
}

function parseQuery ( query ) {
   var Params = new Object ();
   if ( ! query ) return Params; // return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) continue;
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}
function move_jtip() {
  if (window.innerHeight) {
	  scroll_position = window.pageYOffset;
	  window_height = window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.scrollTop) {
		scroll_position = document.documentElement.scrollTop;
    window_height = document.documentElement.clientHeight;
	}
	else if (document.body) {
	  scroll_position = document.body.scrollTop;
	  window_height = document.body.clientHeight;
	}
}

function blockEvents(evt) {
  if(evt.target){
    evt.preventDefault();
  }else{
    evt.returnValue = false;
  }
}

/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * jqLastChangedDatejq
 * jqRevjq
 *
 * Version: @VERSION
 *
 * Requires: jQuery 1.2+
 */

(function(jq){
	
jq.dimensions = {
	version: '@VERSION'
};

// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jq.each( [ 'Height', 'Width' ], function(i, name){
	
	// innerHeight and innerWidth
	jq.fn[ 'inner' + name ] = function() {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		return this.css('display') != 'none' ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
	};
	
	// outerHeight and outerWidth
	jq.fn[ 'outer' + name ] = function(options) {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		options = jq.extend({ margin: false }, options || {});
		
		var val = this.css('display') != 'none' ? 
				this[0]['offset' + name] : 
				num( this, name.toLowerCase() )
					+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
					+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
		
		return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
	};
});

// Create scrollLeft and scrollTop methods
jq.each( ['Left', 'Top'], function(i, name) {
	jq.fn[ 'scroll' + name ] = function(val) {
		if (!this[0]) return;
		
		return val != undefined ?
		
			// Set the scroll offset
			this.each(function() {
				this == window || this == document ?
					window.scrollTo( 
						name == 'Left' ? val : jq(window)[ 'scrollLeft' ](),
						name == 'Top'  ? val : jq(window)[ 'scrollTop'  ]()
					) :
					this[ 'scroll' + name ] = val;
			}) :
			
			// Return the scroll offset
			this[0] == window || this[0] == document ?
				self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
					jq.boxModel && document.documentElement[ 'scroll' + name ] ||
					document.body[ 'scroll' + name ] :
				this[0][ 'scroll' + name ];
	};
});

jq.fn.extend({
	position: function() {
		var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
		
		if (elem) {
			// Get *real* offsetParent
			offsetParent = this.offsetParent();
			
			// Get correct offsets
			offset       = this.offset();
			parentOffset = offsetParent.offset();
			
			// Subtract element margins
			offset.top  -= num(elem, 'marginTop');
			offset.left -= num(elem, 'marginLeft');
			
			// Add offsetParent borders
			parentOffset.top  += num(offsetParent, 'borderTopWidth');
			parentOffset.left += num(offsetParent, 'borderLeftWidth');
			
			// Subtract the two offsets
			results = {
				top:  offset.top  - parentOffset.top,
				left: offset.left - parentOffset.left
			};
		}
		
		return results;
	},
	
	offsetParent: function() {
		var offsetParent = this[0].offsetParent;
		while ( offsetParent && (!/^body|htmljq/i.test(offsetParent.tagName) && jq.css(offsetParent, 'position') == 'static') )
			offsetParent = offsetParent.offsetParent;
		return jq(offsetParent);
	}
});

function num(el, prop) {
	return parseInt(jq.curCSS(el.jquery?el[0]:el,prop,true))||0;
};

})(jQuery);/*
 * Date prototype extensions. Doesn't depend on any
 * other code. Doens't overwrite existing methods.
 *
 * Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear,
 * isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear,
 * setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods
 *
 * Copyright (c) 2006 JÃ¶rn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 *
 * Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString -
 * I've added my name to these methods so you know who to blame if they are broken!
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * An Array of day names starting with Sunday.
 * 
 * @example dayNames[0]
 * @result 'Sunday'
 *
 * @name dayNames
 * @type Array
 * @cat Plugins/Methods/Date
 */
Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];

/**
 * An Array of abbreviated day names starting with Sun.
 * 
 * @example abbrDayNames[0]
 * @result 'Sun'
 *
 * @name abbrDayNames
 * @type Array
 * @cat Plugins/Methods/Date
 */
Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];

/**
 * An Array of month names starting with Janurary.
 * 
 * @example monthNames[0]
 * @result 'January'
 *
 * @name monthNames
 * @type Array
 * @cat Plugins/Methods/Date
 */
Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

/**
 * An Array of abbreviated month names starting with Jan.
 * 
 * @example abbrMonthNames[0]
 * @result 'Jan'
 *
 * @name monthNames
 * @type Array
 * @cat Plugins/Methods/Date
 */
Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

/**
 * The first day of the week for this locale.
 *
 * @name firstDayOfWeek
 * @type Number
 * @cat Plugins/Methods/Date
 * @author Kelvin Luck
 */
Date.firstDayOfWeek = 1;

/**
 * The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc).
 *
 * @name format
 * @type String
 * @cat Plugins/Methods/Date
 * @author Kelvin Luck
 */
Date.format = 'dd/mm/yyyy';
//Date.format = 'mm/dd/yyyy';
//Date.format = 'yyyy-mm-dd';
//Date.format = 'dd mmm yy';

/**
 * The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear
 * only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes.
 *
 * @name format
 * @type String
 * @cat Plugins/Methods/Date
 * @author Kelvin Luck
 */
Date.fullYearStart = '20';

(function() {

	/**
	 * Adds a given method under the given name 
	 * to the Date prototype if it doesn't
	 * currently exist.
	 *
	 * @private
	 */
	function add(name, method) {
		if( !Date.prototype[name] ) {
			Date.prototype[name] = method;
		}
	};
	
	/**
	 * Checks if the year is a leap year.
	 *
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.isLeapYear();
	 * @result true
	 *
	 * @name isLeapYear
	 * @type Boolean
	 * @cat Plugins/Methods/Date
	 */
	add("isLeapYear", function() {
		var y = this.getFullYear();
		return (y%4==0 && y%100!=0) || y%400==0;
	});
	
	/**
	 * Checks if the day is a weekend day (Sat or Sun).
	 *
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.isWeekend();
	 * @result false
	 *
	 * @name isWeekend
	 * @type Boolean
	 * @cat Plugins/Methods/Date
	 */
	add("isWeekend", function() {
		return this.getDay()==0 || this.getDay()==6;
	});
	
	/**
	 * Check if the day is a day of the week (Mon-Fri)
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.isWeekDay();
	 * @result false
	 * 
	 * @name isWeekDay
	 * @type Boolean
	 * @cat Plugins/Methods/Date
	 */
	add("isWeekDay", function() {
		return !this.isWeekend();
	});
	
	/**
	 * Gets the number of days in the month.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getDaysInMonth();
	 * @result 31
	 * 
	 * @name getDaysInMonth
	 * @type Number
	 * @cat Plugins/Methods/Date
	 */
	add("getDaysInMonth", function() {
		return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()];
	});
	
	/**
	 * Gets the name of the day.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getDayName();
	 * @result 'Saturday'
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getDayName(true);
	 * @result 'Sat'
	 * 
	 * @param abbreviated Boolean When set to true the name will be abbreviated.
	 * @name getDayName
	 * @type String
	 * @cat Plugins/Methods/Date
	 */
	add("getDayName", function(abbreviated) {
		return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()];
	});

	/**
	 * Gets the name of the month.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getMonthName();
	 * @result 'Janurary'
	 *
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getMonthName(true);
	 * @result 'Jan'
	 * 
	 * @param abbreviated Boolean When set to true the name will be abbreviated.
	 * @name getDayName
	 * @type String
	 * @cat Plugins/Methods/Date
	 */
	add("getMonthName", function(abbreviated) {
		return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()];
	});

	/**
	 * Get the number of the day of the year.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getDayOfYear();
	 * @result 11
	 * 
	 * @name getDayOfYear
	 * @type Number
	 * @cat Plugins/Methods/Date
	 */
	add("getDayOfYear", function() {
		var tmpdtm = new Date("1/1/" + this.getFullYear());
		return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000);
	});
	
	/**
	 * Get the number of the week of the year.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.getWeekOfYear();
	 * @result 2
	 * 
	 * @name getWeekOfYear
	 * @type Number
	 * @cat Plugins/Methods/Date
	 */
	add("getWeekOfYear", function() {
		return Math.ceil(this.getDayOfYear() / 7);
	});

	/**
	 * Set the day of the year.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.setDayOfYear(1);
	 * dtm.toString();
	 * @result 'Tue Jan 01 2008 00:00:00'
	 * 
	 * @name setDayOfYear
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("setDayOfYear", function(day) {
		this.setMonth(0);
		this.setDate(day);
		return this;
	});
	
	/**
	 * Add a number of years to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addYears(1);
	 * dtm.toString();
	 * @result 'Mon Jan 12 2009 00:00:00'
	 * 
	 * @name addYears
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addYears", function(num) {
		this.setFullYear(this.getFullYear() + num);
		return this;
	});
	
	/**
	 * Add a number of months to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addMonths(1);
	 * dtm.toString();
	 * @result 'Tue Feb 12 2008 00:00:00'
	 * 
	 * @name addMonths
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addMonths", function(num) {
		var tmpdtm = this.getDate();
		
		this.setMonth(this.getMonth() + num);
		
		if (tmpdtm > this.getDate())
			this.addDays(-this.getDate());
		
		return this;
	});
	
	/**
	 * Add a number of days to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addDays(1);
	 * dtm.toString();
	 * @result 'Sun Jan 13 2008 00:00:00'
	 * 
	 * @name addDays
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addDays", function(num) {
		this.setDate(this.getDate() + num);
		return this;
	});
	
	/**
	 * Add a number of hours to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addHours(24);
	 * dtm.toString();
	 * @result 'Sun Jan 13 2008 00:00:00'
	 * 
	 * @name addHours
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addHours", function(num) {
		this.setHours(this.getHours() + num);
		return this;
	});

	/**
	 * Add a number of minutes to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addMinutes(60);
	 * dtm.toString();
	 * @result 'Sat Jan 12 2008 01:00:00'
	 * 
	 * @name addMinutes
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addMinutes", function(num) {
		this.setMinutes(this.getMinutes() + num);
		return this;
	});
	
	/**
	 * Add a number of seconds to the date object.
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.addSeconds(60);
	 * dtm.toString();
	 * @result 'Sat Jan 12 2008 00:01:00'
	 * 
	 * @name addSeconds
	 * @type Date
	 * @cat Plugins/Methods/Date
	 */
	add("addSeconds", function(num) {
		this.setSeconds(this.getSeconds() + num);
		return this;
	});
	
	/**
	 * Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant.
	 * 
	 * @example var dtm = new Date();
	 * dtm.zeroTime();
	 * dtm.toString();
	 * @result 'Sat Jan 12 2008 00:01:00'
	 * 
	 * @name zeroTime
	 * @type Date
	 * @cat Plugins/Methods/Date
	 * @author Kelvin Luck
	 */
	add("zeroTime", function() {
		this.setMilliseconds(0);
		this.setSeconds(0);
		this.setMinutes(0);
		this.setHours(0);
		return this;
	});
	
	/**
	 * Returns a string representation of the date object according to Date.format.
	 * (Date.toString may be used in other places so I purposefully didn't overwrite it)
	 * 
	 * @example var dtm = new Date("01/12/2008");
	 * dtm.asString();
	 * @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy'
	 * 
	 * @name asString
	 * @type Date
	 * @cat Plugins/Methods/Date
	 * @author Kelvin Luck
	 */
	add("asString", function() {
		var r = Date.format;
		return r
			.split('yyyy').join(this.getFullYear())
			.split('yy').join((this.getFullYear() + '').substring(2))
			.split('mmm').join(this.getMonthName(true))
			.split('mm').join(_zeroPad(this.getMonth()+1))
			.split('dd').join(_zeroPad(this.getDate()));
	});
	
	/**
	 * Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object
	 * (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere)
	 *
	 * @example var dtm = Date.fromString("12/01/2008");
	 * dtm.toString();
	 * @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy'
	 * 
	 * @name fromString
	 * @type Date
	 * @cat Plugins/Methods/Date
	 * @author Kelvin Luck
	 */
	Date.fromString = function(s)
	{
		var f = Date.format;
		var d = new Date('01/01/1977');
		var iY = f.indexOf('yyyy');
		if (iY > -1) {
			d.setFullYear(Number(s.substr(iY, 4)));
		} else {
			// TODO - this doesn't work very well - are there any rules for what is meant by a two digit year?
			d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2)));
		}
		var iM = f.indexOf('mmm');
		if (iM > -1) {
			var mStr = s.substr(iM, 3);
			for (var i=0; i<Date.abbrMonthNames.length; i++) {
				if (Date.abbrMonthNames[i] == mStr) break;
			}
			d.setMonth(i);
		} else {
			d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1);
		}
		d.setDate(Number(s.substr(f.indexOf('dd'), 2)));
		if (isNaN(d.getTime())) {
			return false;
		}
		return d;
	};
	
	// utility method
	var _zeroPad = function(num) {
		var s = '0'+num;
		return s.substring(s.length-2)
		//return ('0'+num).substring(-2); // doesn't work on IE :(
	};
	
})();
		/**
 * Copyright (c) 2007 Kelvin Luck (http://www.kelvinluck.com/)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * jqId: jquery.datePicker.js 3739 2007-10-25 13:55:30Z kelvin.luck jq
 **/

(function(jq){
    
	jq.fn.extend({
/**
 * Render a calendar table into any matched elements.
 * 
 * @param Object s (optional) Customize your calendars.
 * @option Number month The month to render (NOTE that months are zero based). Default is today's month.
 * @option Number year The year to render. Default is today's year.
 * @option Function renderCallback A reference to a function that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Default is no callback.
 * @option Number showHeader Whether or not to show the header row, possible values are: jq.dpConst.SHOW_HEADER_NONE (no header), jq.dpConst.SHOW_HEADER_SHORT (first letter of each day) and jq.dpConst.SHOW_HEADER_LONG (full name of each day). Default is jq.dpConst.SHOW_HEADER_SHORT.
 * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.
 * @type jQuery
 * @name renderCalendar
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('#calendar-me').renderCalendar({month:0, year:2007});
 * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me.
 *
 * @example
 * var testCallback = function(jqtd, thisDate, month, year)
 * {
 * if (jqtd.is('.current-month') && thisDate.getDay() == 4) {
 *		var d = thisDate.getDate();
 *		jqtd.bind(
 *			'click',
 *			function()
 *			{
 *				alert('You clicked on ' + d + '/' + (Number(month)+1) + '/' + year);
 *			}
 *		).addClass('thursday');
 *	} else if (thisDate.getDay() == 5) {
 *		jqtd.html('Friday the ' + jqtd.html() + 'th');
 *	}
 * }
 * jq('#calendar-me').renderCalendar({month:0, year:2007, renderCallback:testCallback});
 * 
 * @desc Renders a calendar displaying January 2007 into the element with an id of calendar-me. Every Thursday in the current month has a class of "thursday" applied to it, is clickable and shows an alert when clicked. Every Friday on the calendar has the number inside replaced with text.
 **/
		renderCalendar  :   function(s)
		{
			var dc = function(a)
			{
				return document.createElement(a);
			};
			
			s = jq.extend(
				{
					month			: null,
					year			: null,
					renderCallback	: null,
					showHeader		: jq.dpConst.SHOW_HEADER_SHORT,
					dpController	: null,
					hoverClass		: 'dp-hover'
				}
				, s
			);
			
			if (s.showHeader != jq.dpConst.SHOW_HEADER_NONE) {
				var headRow = jq(dc('tr'));
				for (var i=Date.firstDayOfWeek; i<Date.firstDayOfWeek+7; i++) {
					var weekday = i%7;
					var day = Date.dayNames[weekday];
					headRow.append(
						jQuery(dc('th')).attr({'scope':'col', 'abbr':day, 'title':day, 'class':(weekday == 0 || weekday == 6 ? 'weekend' : 'weekday')}).html(s.showHeader == jq.dpConst.SHOW_HEADER_SHORT ? day.substr(0, 1) : day)
					);
				}
			};
			
			var calendarTable = jq(dc('table'))
									.attr(
										{
											'cellspacing':2,
											'className':'jCalendar'
										}
									)
									.append(
										(s.showHeader != jq.dpConst.SHOW_HEADER_NONE ? 
											jq(dc('thead'))
												.append(headRow)
											:
											dc('thead')
										)
									);
			var tbody = jq(dc('tbody'));
			
			var today = (new Date()).zeroTime();
			
			var month = s.month == undefined ? today.getMonth() : s.month;
			var year = s.year || today.getFullYear();
			
			var currentDate = new Date(year, month, 1);
			
			
			var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1;
			if (firstDayOffset > 1) firstDayOffset -= 7;
			var weeksToDraw = Math.ceil(( (-1*firstDayOffset+1) + currentDate.getDaysInMonth() ) /7);
			currentDate.addDays(firstDayOffset-1);
			
			var doHover = function()
			{
				if (s.hoverClass) {
					jq(this).addClass(s.hoverClass);
				}
			};
			var unHover = function()
			{
				if (s.hoverClass) {
					jq(this).removeClass(s.hoverClass);
				}
			};
			
			var w = 0;
			while (w++<weeksToDraw) {
				var r = jQuery(dc('tr'));
				for (var i=0; i<7; i++) {
					var thisMonth = currentDate.getMonth() == month;
					var d = jq(dc('td'))
								.text(currentDate.getDate() + '')
								.attr('className', (thisMonth ? 'current-month ' : 'other-month ') +
													(currentDate.isWeekend() ? 'weekend ' : 'weekday ') +
													(thisMonth && currentDate.getTime() == today.getTime() ? 'today ' : '')
								)
								.hover(doHover, unHover)
							;
					if (s.renderCallback) {
						s.renderCallback(d, currentDate, month, year);
					}
					r.append(d);
					currentDate.addDays(1);
				}
				tbody.append(r);
			}
			calendarTable.append(tbody);
			
			return this.each(
				function()
				{
					jq(this).empty().append(calendarTable);
				}
			);
		},
/**
 * Create a datePicker associated with each of the matched elements.
 *
 * The matched element will receive a few custom events with the following signatures:
 *
 * dateSelected(event, date, jqtd, status)
 * Triggered when a date is selected. event is a reference to the event, date is the Date selected, jqtd is a jquery object wrapped around the TD that was clicked on and status is whether the date was selected (true) or deselected (false)
 * 
 * dpClosed(event, selected)
 * Triggered when the date picker is closed. event is a reference to the event and selected is an Array containing Date objects.
 *
 * dpMonthChanged(event, displayedMonth, displayedYear)
 * Triggered when the month of the popped up calendar is changed. event is a reference to the event, displayedMonth is the number of the month now displayed (zero based) and displayedYear is the year of the month.
 *
 * dpDisplayed(event, jqdatePickerDiv)
 * Triggered when the date picker is created. jqdatePickerDiv is the div containing the date picker. Use this event to add custom content/ listeners to the popped up date picker.
 *
 * @param Object s (optional) Customize your date pickers.
 * @option Number month The month to render when the date picker is opened (NOTE that months are zero based). Default is today's month.
 * @option Number year The year to render when the date picker is opened. Default is today's year.
 * @option String startDate The first date date can be selected.
 * @option String endDate The last date that can be selected.
 * @option Boolean inline Whether to create the datePicker as inline (e.g. always on the page) or as a model popup. Default is false (== modal popup)
 * @option Boolean createButton Whether to create a .dp-choose-date anchor directly after the matched element which when clicked will trigger the showing of the date picker. Default is true.
 * @option Boolean showYearNavigation Whether to display buttons which allow the user to navigate through the months a year at a time. Default is true.
 * @option Boolean closeOnSelect Whether to close the date picker when a date is selected. Default is true.
 * @option Boolean displayClose Whether to create a "Close" button within the date picker popup. Default is false.
 * @option Boolean selectMultiple Whether a user should be able to select multiple dates with this date picker. Default is false.
 * @option Boolean clickInput If the matched element is an input type="text" and this option is true then clicking on the input will cause the date picker to appear.
 * @option Number verticalPosition The vertical alignment of the popped up date picker to the matched element. One of jq.dpConst.POS_TOP and jq.dpConst.POS_BOTTOM. Default is jq.dpConst.POS_TOP.
 * @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of jq.dpConst.POS_LEFT and jq.dpConst.POS_RIGHT.
 * @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0.
 * @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0.
 * @option (Function|Array) renderCallback A reference to a function (or an array of seperate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback.
 * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.
 * @type jQuery
 * @name datePicker
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('input.date-picker').datePicker();
 * @desc Creates a date picker button next to all matched input elements. When the button is clicked on the value of the selected date will be placed in the corresponding input (formatted according to Date.format).
 *
 * @example demo/index.html
 * @desc See the projects homepage for many more complex examples...
 **/
		datePicker : function(s)
		{			
			if (!jq.event._dpCache) jq.event._dpCache = [];
			
			// initialise the date picker controller with the relevant settings...
			s = jq.extend(
				{
					month				: undefined,
					year				: undefined,
					startDate			: undefined,
					endDate				: undefined,
					inline				: false,
					renderCallback		: [],
					createButton		: true,
					showYearNavigation	: true,
					closeOnSelect		: true,
					displayClose		: false,
					selectMultiple		: false,
					clickInput			: false,
					verticalPosition	: jq.dpConst.POS_TOP,
					horizontalPosition	: jq.dpConst.POS_LEFT,
					verticalOffset		: -150,
					horizontalOffset	: 0,
					hoverClass			: 'dp-hover'
				}
				, s
			);
			
			return this.each(
				function()
				{
					var jqthis = jq(this);
					var alreadyExists = true;
					
					if (!this._dpId) {
						this._dpId = jq.event.guid++;
						jq.event._dpCache[this._dpId] = new DatePicker(this);
						alreadyExists = false;
					}
					
					if (s.inline) {
						s.createButton = false;
						s.displayClose = false;
						s.closeOnSelect = false;
						jqthis.empty();
					}
					
					var controller = jq.event._dpCache[this._dpId];
					
					controller.init(s);
					
					if (!alreadyExists && s.createButton) {
						// create it!
						controller.button = jq('<a href="#" class="dp-choose-date" title="' + jq.dpText.TEXT_CHOOSE_DATE + '">' + jq.dpText.TEXT_CHOOSE_DATE + '</a>')
								.bind(
									'click',
									function()
									{
										jqthis.dpDisplay(this);
										this.blur();
										return false;
									}
								);
						jqthis.after(controller.button);
					}
					
					if (!alreadyExists && jqthis.is(':text')) {
						jqthis
							.bind(
								'dateSelected',
								function(e, selectedDate, jqtd)
								{
									this.value = selectedDate.asString();
								}
							).bind(
								'change',
								function()
								{
									var d = Date.fromString(this.value);
									if (d) {
										controller.setSelected(d, true, true);
									}
								}
							);
						if (s.clickInput) {
							jqthis.bind(
								'click',
								function()
								{
									jqthis.dpDisplay();
								}
							);
						}
						var d = Date.fromString(this.value);
						if (this.value != '' && d) {
							controller.setSelected(d, true, true);
						}
					}
					
					jqthis.addClass('dp-applied');
					
				}
			)
		},
/**
 * Disables or enables this date picker
 *
 * @param Boolean s Whether to disable (true) or enable (false) this datePicker
 * @type jQuery
 * @name dpSetDisabled
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('.date-picker').datePicker();
 * jq('.date-picker').dpSetDisabled(true);
 * @desc Prevents this date picker from displaying and adds a class of dp-disabled to it (and it's associated button if it has one) for styling purposes. If the matched element is an input field then it will also set the disabled attribute to stop people directly editing the field.
 **/
		dpSetDisabled : function(s)
		{
			return _w.call(this, 'setDisabled', s);
		},
/**
 * Updates the first selectable date for any date pickers on any matched elements.
 *
 * @param String d A string representing the first selectable date (formatted according to Date.format).
 * @type jQuery
 * @name dpSetStartDate
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('.date-picker').datePicker();
 * jq('.date-picker').dpSetStartDate('01/01/2000');
 * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the first selectable date for each of these to the first day of the millenium.
 **/
		dpSetStartDate : function(d)
		{
			return _w.call(this, 'setStartDate', d);
		},
/**
 * Updates the last selectable date for any date pickers on any matched elements.
 *
 * @param String d A string representing the last selectable date (formatted according to Date.format).
 * @type jQuery
 * @name dpSetEndDate
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('.date-picker').datePicker();
 * jq('.date-picker').dpSetEndDate('01/01/2010');
 * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the last selectable date for each of these to the first Janurary 2010.
 **/
		dpSetEndDate : function(d)
		{
			return _w.call(this, 'setEndDate', d);
		},
/**
 * Gets a list of Dates currently selected by this datePicker. This will be an empty array if no dates are currently selected or NULL if there is no datePicker associated with the matched element.
 *
 * @type Array
 * @name dpGetSelected
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('.date-picker').datePicker();
 * alert(jq('.date-picker').dpGetSelected());
 * @desc Will alert an empty array (as nothing is selected yet)
 **/
		dpGetSelected : function()
		{
			var c = _getController(this[0]);
			if (c) {
				return c.getSelected();
			}
			return null;
		},
/**
 * Selects or deselects a date on any matched element's date pickers. Deselcting is only useful on date pickers where selectMultiple==true. Selecting will only work if the passed date is within the startDate and endDate boundries for a given date picker.
 *
 * @param String d A string representing the date you want to select (formatted according to Date.format).
 * @param Boolean v Whether you want to select (true) or deselect (false) this date. Optional - default = true.
 * @param Boolean m Whether you want the date picker to open up on the month of this date when it is next opened. Optional - default = true.
 * @type jQuery
 * @name dpSetSelected
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('.date-picker').datePicker();
 * jq('.date-picker').dpSetSelected('01/01/2010');
 * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010.
 **/
		dpSetSelected : function(d, v, m)
		{
			if (v == undefined) v=true;
			if (m == undefined) m=true;
			return _w.call(this, 'setSelected', Date.fromString(d), v, m);
		},
/**
 * Sets the month that will be displayed when the date picker is next opened. If the passed month is before startDate then the month containing startDate will be displayed instead. If the passed month is after endDate then the month containing the endDate will be displayed instead.
 *
 * @param Number m The month you want the date picker to display. Optional - defaults to the currently displayed month.
 * @param Number y The year you want the date picker to display. Optional - defaults to the currently displayed year.
 * @type jQuery
 * @name dpSetDisplayedMonth
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('.date-picker').datePicker();
 * jq('.date-picker').dpSetDisplayedMonth(10, 2008);
 * @desc Creates a date picker associated with all elements with a class of "date-picker" then sets the selected date on these date pickers to the first Janurary 2010. When the date picker is next opened it will display Janurary 2010.
 **/
		dpSetDisplayedMonth : function(m, y)
		{
			return _w.call(this, 'setDisplayedMonth', Number(m), Number(y));
		},
/**
 * Displays the date picker associated with the matched elements. Since only one date picker can be displayed at once then the date picker associated with the last matched element will be the one that is displayed.
 *
 * @param HTMLElement e An element that you want the date picker to pop up relative in position to. Optional - default behaviour is to pop up next to the element associated with this date picker.
 * @type jQuery
 * @name dpDisplay
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('#date-picker').datePicker();
 * jq('#date-picker').dpDisplay();
 * @desc Creates a date picker associated with the element with an id of date-picker and then causes it to pop up.
 **/
		dpDisplay : function(e)
		{
			return _w.call(this, 'display', e);
		},
/**
 * Sets a function or array of functions that is called when each TD of the date picker popup is rendered to the page
 *
 * @param (Function|Array) a A function or an array of functions that are called when each td is rendered. Each function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year.
 * @type jQuery
 * @name dpSetRenderCallback
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('#date-picker').datePicker();
 * jq('#date-picker').dpSetRenderCallback(function(jqtd, thisDate, month, year)
 * {
 * 	// do stuff as each td is rendered dependant on the date in the td and the displayed month and year
 * });
 * @desc Creates a date picker associated with the element with an id of date-picker and then creates a function which is called as each td is rendered when this date picker is displayed.
 **/
		dpSetRenderCallback : function(a)
		{
			return _w.call(this, 'setRenderCallback', a);
		},
/**
 * Sets the position that the datePicker will pop up (relative to it's associated element)
 *
 * @param Number v The vertical alignment of the created date picker to it's associated element. Possible values are jq.dpConst.POS_TOP and jq.dpConst.POS_BOTTOM
 * @param Number h The horizontal alignment of the created date picker to it's associated element. Possible values are jq.dpConst.POS_LEFT and jq.dpConst.POS_RIGHT
 * @type jQuery
 * @name dpSetPosition
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('#date-picker').datePicker();
 * jq('#date-picker').dpSetPosition(jq.dpConst.POS_BOTTOM, jq.dpConst.POS_RIGHT);
 * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be bottom and right aligned to the #date-picker element.
 **/
		dpSetPosition : function(v, h)
		{
			return _w.call(this, 'setPosition', v, h);
		},
/**
 * Sets the offset that the popped up date picker will have from it's default position relative to it's associated element (as set by dpSetPosition)
 *
 * @param Number v The vertical offset of the created date picker.
 * @param Number h The horizontal offset of the created date picker.
 * @type jQuery
 * @name dpSetOffset
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('#date-picker').datePicker();
 * jq('#date-picker').dpSetOffset(-20, 200);
 * @desc Creates a date picker associated with the element with an id of date-picker and makes it so that when this date picker pops up it will be 20 pixels above and 200 pixels to the right of it's default position.
 **/
		dpSetOffset : function(v, h)
		{
			return _w.call(this, 'setOffset', v, h);
		},
/**
 * Closes the open date picker associated with this element.
 *
 * @type jQuery
 * @name dpClose
 * @cat plugins/datePicker
 * @author Kelvin Luck (http://www.kelvinluck.com/)
 *
 * @example jq('.date-pick')
 *		.datePicker()
 *		.bind(
 *			'focus',
 *			function()
 *			{
 *				jq(this).dpDisplay();
 *			}
 *		).bind(
 *			'blur',
 *			function()
 *			{
 *				jq(this).dpClose();
 *			}
 *		);
 * @desc Creates a date picker and makes it appear when the relevant element is focused and disappear when it is blurred.
 **/
		dpClose : function()
		{
			return _w.call(this, '_closeCalendar', false, this[0]);
		},
		// private function called on unload to clean up any expandos etc and prevent memory links...
		_dpDestroy : function()
		{
			// TODO - implement this?
		}
	});
	
	// private internal function to cut down on the amount of code needed where we forward
	// dp* methods on the jQuery object on to the relevant DatePicker controllers...
	var _w = function(f, a1, a2, a3)
	{
		return this.each(
			function()
			{
				var c = _getController(this);
				if (c) {
					c[f](a1, a2, a3);
				}
			}
		);
	};
	
	function DatePicker(ele)
	{
		this.ele = ele;
		
		// initial values...
		this.displayedMonth		=	null;
		this.displayedYear		=	null;
		this.startDate			=	null;
		this.endDate			=	null;
		this.showYearNavigation	=	null;
		this.closeOnSelect		=	null;
		this.displayClose		=	null;
		this.selectMultiple		=	null;
		this.verticalPosition	=	null;
		this.horizontalPosition	=	null;
		this.verticalOffset		=	null;
		this.horizontalOffset	=	null;
		this.button				=	null;
		this.renderCallback		=	[];
		this.selectedDates		=	{};
		this.inline				=	null;
		this.context			=	'#dp-popup';
	};
	jq.extend(
		DatePicker.prototype,
		{	
			init : function(s)
			{
				this.setStartDate(s.startDate);
				this.setEndDate(s.endDate);
				this.setDisplayedMonth(Number(s.month), Number(s.year));
				this.setRenderCallback(s.renderCallback);
				this.showYearNavigation = s.showYearNavigation;
				this.closeOnSelect = s.closeOnSelect;
				this.displayClose = s.displayClose;
				this.selectMultiple = s.selectMultiple;
				this.verticalPosition = s.verticalPosition;
				this.horizontalPosition = s.horizontalPosition;
				this.hoverClass = s.hoverClass;
				this.setOffset(s.verticalOffset, s.horizontalOffset);
				this.inline = s.inline;
				if (this.inline) {
					this.context = this.ele;
					this.display();
				}
			},
			setStartDate : function(d)
			{
				if (d) {
					this.startDate = Date.fromString(d);
				}
				if (!this.startDate) {
					this.startDate = (new Date()).zeroTime();
				}
				this.setDisplayedMonth(this.displayedMonth, this.displayedYear);
			},
			setEndDate : function(d)
			{
				if (d) {
					this.endDate = Date.fromString(d);
				}
				if (!this.endDate) {
					this.endDate = (new Date('12/31/2999')); // using the JS Date.parse function which expects mm/dd/yyyy
				}
				if (this.endDate.getTime() < this.startDate.getTime()) {
					this.endDate = this.startDate;
				}
				this.setDisplayedMonth(this.displayedMonth, this.displayedYear);
			},
			setPosition : function(v, h)
			{
				this.verticalPosition = v;
				this.horizontalPosition = h;
			},
			setOffset : function(v, h)
			{
				this.verticalOffset = parseInt(v) || 0;
				this.horizontalOffset = parseInt(h) || 0;
			},
			setDisabled : function(s)
			{
				jqe = jq(this.ele);
				jqe[s ? 'addClass' : 'removeClass']('dp-disabled');
				if (this.button) {
					jqbut = jq(this.button);
					jqbut[s ? 'addClass' : 'removeClass']('dp-disabled');
					jqbut.attr('title', s ? '' : jq.dpText.TEXT_CHOOSE_DATE);
				}
				if (jqe.is(':text')) {
					jqe.attr('disabled', s ? 'disabled' : '');
				}
			},
			setDisplayedMonth : function(m, y)
			{
				if (this.startDate == undefined || this.endDate == undefined) {
					return;
				}
				var s = new Date(this.startDate.getTime());
				s.setDate(1);
				var e = new Date(this.endDate.getTime());
				e.setDate(1);
				
				var t;
				if ((!m && !y) || (isNaN(m) && isNaN(y))) {
					// no month or year passed - default to current month
					t = new Date().zeroTime();
					t.setDate(1);
				} else if (isNaN(m)) {
					// just year passed in - presume we want the displayedMonth
					t = new Date(y, this.displayedMonth, 1);
				} else if (isNaN(y)) {
					// just month passed in - presume we want the displayedYear
					t = new Date(this.displayedYear, m, 1);
				} else {
					// year and month passed in - that's the date we want!
					t = new Date(y, m, 1)
				}
				
				// check if the desired date is within the range of our defined startDate and endDate
				if (t.getTime() < s.getTime()) {
					t = s;
				} else if (t.getTime() > e.getTime()) {
					t = e;
				}
				this.displayedMonth = t.getMonth();
				this.displayedYear = t.getFullYear();
			},
			setSelected : function(d, v, moveToMonth)
			{
				if (this.selectMultiple == false) {
					this.selectedDates = {};
					jq('td.selected', this.context).removeClass('selected');
				}
				if (moveToMonth) {
					this.setDisplayedMonth(d.getMonth(), d.getFullYear());
				}
				this.selectedDates[d.toString()] = v;
			},
			isSelected : function(d)
			{
				return this.selectedDates[d.toString()];
			},
			getSelected : function()
			{
				var r = [];
				for(s in this.selectedDates) {
					if (this.selectedDates[s] == true) {
						r.push(Date.parse(s));
					}
				}
				return r;
			},
			display : function(eleAlignTo)
			{
				if (jq(this.ele).is('.dp-disabled')) return;
				
				eleAlignTo = eleAlignTo || this.ele;
				var c = this;
				var jqele = jq(eleAlignTo);
				var eleOffset = jqele.offset();
				
				var jqcreateIn;
				var attrs;
				var attrsCalendarHolder;
				var cssRules;
				
				if (c.inline) {
					jqcreateIn = jq(this.ele);
					attrs = {
						'id'		:	'calendar-' + this.ele._dpId,
						'className'	:	'dp-popup dp-popup-inline'
					};
					cssRules = {
					};
				} else {
					jqcreateIn = jq('body');
					attrs = {
						'id'		:	'dp-popup',
						'className'	:	'dp-popup'
					};
					cssRules = {
						'top'	:	eleOffset.top + c.verticalOffset,
						'left'	:	eleOffset.left + c.horizontalOffset
					};
					
					var _checkMouse = function(e)
					{
						var el = e.target;
						var cal = jq('#dp-popup')[0];
						
						while (true){
							if (el == cal) {
								return true;
							} else if (el == document) {
								c._closeCalendar();
								return false;
							} else {
								el = jq(el).parent()[0];
							}
						}
					};
					this._checkMouse = _checkMouse;
				
					this._closeCalendar(true);
				}
				
				
				jqcreateIn
					.append(
						jq('<div></div>')
							.attr(attrs)
							.css(cssRules)
							.append(
								jq('<h2></h2>'),
								jq('<div class="dp-nav-prev"></div>')
									.append(
										jq('<a class="dp-nav-prev-year" href="#" title="' + jq.dpText.TEXT_PREV_YEAR + '">&lt;&lt;</a>')
											.bind(
												'click',
												function()
												{
													return c._displayNewMonth.call(c, this, 0, -1);
												}
											),
										jq('<a class="dp-nav-prev-month" href="#" title="' + jq.dpText.TEXT_PREV_MONTH + '">&lt;</a>')
											.bind(
												'click',
												function()
												{
													return c._displayNewMonth.call(c, this, -1, 0);
												}
											)
									),
								jq('<div class="dp-nav-next"></div>')
									.append(
										jq('<a class="dp-nav-next-year" href="#" title="' + jq.dpText.TEXT_NEXT_YEAR + '">&gt;&gt;</a>')
											.bind(
												'click',
												function()
												{
													return c._displayNewMonth.call(c, this, 0, 1);
												}
											),
										jq('<a class="dp-nav-next-month" href="#" title="' + jq.dpText.TEXT_NEXT_MONTH + '">&gt;</a>')
											.bind(
												'click',
												function()
												{
													return c._displayNewMonth.call(c, this, 1, 0);
												}
											)
									),
								jq('<div></div>')
									.attr('className', 'dp-calendar')
							)
							.bgIframe()
						);
					
				var jqpop = this.inline ? jq('.dp-popup', this.context) : jq('#dp-popup');
				
				if (this.showYearNavigation == false) {
					jq('.dp-nav-prev-year, .dp-nav-next-year', c.context).css('display', 'none');
				}
				if (this.displayClose) {
					jqpop.append(
						jq('<a href="#" id="dp-close">' + jq.dpText.TEXT_CLOSE + '</a>')
							.bind(
								'click',
								function()
								{
									c._closeCalendar();
									return false;
								}
							)
					);
				}
				c._renderCalendar();
				
				jq(this.ele).trigger('dpDisplayed', jqpop);
				
				if (!c.inline) {
					if (this.verticalPosition == jq.dpConst.POS_BOTTOM) {
						jqpop.css('top', eleOffset.top + jqele.height() - jqpop.height() + c.verticalOffset);
					}
					if (this.horizontalPosition == jq.dpConst.POS_RIGHT) {
						jqpop.css('left', eleOffset.left + jqele.width() - jqpop.width() + c.horizontalOffset);
					}
					jq(document).bind('mousedown', this._checkMouse);
				}
			},
			setRenderCallback : function(a)
			{
				if (a && typeof(a) == 'function') {
					a = [a];
				}
				this.renderCallback = this.renderCallback.concat(a);
			},
			cellRender : function (jqtd, thisDate, month, year) {
				var c = this.dpController;
				var d = new Date(thisDate.getTime());
				
				// add our click handlers to deal with it when the days are clicked...
				
				jqtd.bind(
					'click',
					function()
					{
						var jqthis = jq(this);
						if (!jqthis.is('.disabled')) {
							c.setSelected(d, !jqthis.is('.selected') || !c.selectMultiple);
							var s = c.isSelected(d);
							jq(c.ele).trigger('dateSelected', [d, jqtd, s]);
							jq(c.ele).trigger('change');
							if (c.closeOnSelect) {
								c._closeCalendar();
							} else {
								jqthis[s ? 'addClass' : 'removeClass']('selected');
							}
						}
					}
				);
				
				if (c.isSelected(d)) {
					jqtd.addClass('selected');
				}
				
				// call any extra renderCallbacks that were passed in
				for (var i=0; i<c.renderCallback.length; i++) {
					c.renderCallback[i].apply(this, arguments);
				}
				
				
			},
			// ele is the clicked button - only proceed if it doesn't have the class disabled...
			// m and y are -1, 0 or 1 depending which direction we want to go in...
			_displayNewMonth : function(ele, m, y) 
			{
				if (!jq(ele).is('.disabled')) {
					this.setDisplayedMonth(this.displayedMonth + m, this.displayedYear + y);
					this._clearCalendar();
					this._renderCalendar();
					jq(this.ele).trigger('dpMonthChanged', [this.displayedMonth, this.displayedYear]);
				}
				ele.blur();
				return false;
			},
			_renderCalendar : function()
			{
				// set the title...
				jq('h2', this.context).html(Date.monthNames[this.displayedMonth] + ' ' + this.displayedYear);
				
				// render the calendar...
				jq('.dp-calendar', this.context).renderCalendar(
					{
						month			: this.displayedMonth,
						year			: this.displayedYear,
						renderCallback	: this.cellRender,
						dpController	: this,
						hoverClass		: this.hoverClass
					}
				);
				
				// update the status of the control buttons and disable dates before startDate or after endDate...

				// TODO: When should the year buttons be disabled? When you can't go forward a whole year from where you are or is that annoying?
				if (this.displayedYear == this.startDate.getFullYear() && this.displayedMonth == this.startDate.getMonth()) {
					jq('.dp-nav-prev-year', this.context).addClass('disabled');
					jq('.dp-nav-prev-month', this.context).addClass('disabled');
					jq('.dp-calendar td.other-month', this.context).each(
						function()
						{
							var jqthis = jq(this);
							if (Number(jqthis.text()) > 20) {
								jqthis.addClass('disabled');
							}
						}
					);
					var d = this.startDate.getDate();
					jq('.dp-calendar td.current-month', this.context).each(
						function()
						{
							var jqthis = jq(this);
							if (Number(jqthis.text()) < d) {
								jqthis.addClass('disabled');
							}
						}
					);
				} else {
					jq('.dp-nav-prev-year', this.context).removeClass('disabled');
					jq('.dp-nav-prev-month', this.context).removeClass('disabled');
					var d = this.startDate.getDate();
					if (d > 20) {
						// check if the startDate is last month as we might need to add some disabled classes...
						var sd = new Date(this.startDate.getTime());
						sd.addMonths(1);
						if (this.displayedYear == sd.getFullYear() && this.displayedMonth == sd.getMonth()) {
							jq('dp-calendar td.other-month', this.context).each(
								function()
								{
									var jqthis = jq(this);
									if (Number(jqthis.text()) < d) {
										jqthis.addClass('disabled');
									}
								}
							);
						}
					}
				}
				if (this.displayedYear == this.endDate.getFullYear() && this.displayedMonth == this.endDate.getMonth()) {
					jq('.dp-nav-next-year', this.context).addClass('disabled');
					jq('.dp-nav-next-month', this.context).addClass('disabled');
					jq('.dp-calendar td.other-month', this.context).each(
						function()
						{
							var jqthis = jq(this);
							if (Number(jqthis.text()) < 14) {
								jqthis.addClass('disabled');
							}
						}
					);
					var d = this.endDate.getDate();
					jq('.dp-calendar td.current-month', this.context).each(
						function()
						{
							var jqthis = jq(this);
							if (Number(jqthis.text()) > d) {
								jqthis.addClass('disabled');
							}
						}
					);
				} else {
					jq('.dp-nav-next-year', this.context).removeClass('disabled');
					jq('.dp-nav-next-month', this.context).removeClass('disabled');
					var d = this.endDate.getDate();
					if (d < 13) {
						// check if the endDate is next month as we might need to add some disabled classes...
						var ed = new Date(this.endDate.getTime());
						ed.addMonths(-1);
						if (this.displayedYear == ed.getFullYear() && this.displayedMonth == ed.getMonth()) {
							jq('.dp-calendar td.other-month', this.context).each(
								function()
								{
									var jqthis = jq(this);
									if (Number(jqthis.text()) > d) {
										jqthis.addClass('disabled');
									}
								}
							);
						}
					}
				}
			},
			_closeCalendar : function(programatic, ele)
			{
				if (!ele || ele == this.ele)
				{
					jq(document).unbind('mousedown', this._checkMouse);
					this._clearCalendar();
					jq('#dp-popup a').unbind();
					jq('#dp-popup').empty().remove();
					if (!programatic) {
						jq(this.ele).trigger('dpClosed', [this.getSelected()]);
					}
				}
			},
			// empties the current dp-calendar div and makes sure that all events are unbound
			// and expandos removed to avoid memory leaks...
			_clearCalendar : function()
			{
				// TODO.
				jq('.dp-calendar td', this.context).unbind();
				jq('.dp-calendar', this.context).empty();
			}
		}
	);
	
	// static constants
	jq.dpConst = {
		SHOW_HEADER_NONE	:	0,
		SHOW_HEADER_SHORT	:	1,
		SHOW_HEADER_LONG	:	2,
		POS_TOP				:	0,
		POS_BOTTOM			:	1,
		POS_LEFT			:	0,
		POS_RIGHT			:	1
	};
	// localisable text
	jq.dpText = {
		TEXT_PREV_YEAR		:	'Previous year',
		TEXT_PREV_MONTH		:	'Previous month',
		TEXT_NEXT_YEAR		:	'Next year',
		TEXT_NEXT_MONTH		:	'Next month',
		TEXT_CLOSE			:	'Close',
		TEXT_CHOOSE_DATE	:	'Choose date'
	};
	// version
	jq.dpVersion = 'jqId: jquery.datePicker.js 3739 2007-10-25 13:55:30Z kelvin.luck jq';

	function _getController(ele)
	{
		if (ele._dpId) return jq.event._dpCache[ele._dpId];
		return false;

	};
	
	// make it so that no error is thrown if bgIframe plugin isn't included (allows you to use conditional
	// comments to only include bgIframe where it is needed in IE without breaking this plugin).
	if (jq.fn.bgIframe == undefined) {
		jq.fn.bgIframe = function() {return this; };
	};


	// clean-up
	jq(window)
		.bind('unload', function() {
			var els = jq.event._dpCache || [];
			for (var i in els) {
				jq(els[i].ele)._dpDestroy();
			}
		});
		
	
})(jQuery);
/* jSocialize - bookmark tool ©2008 artViper designstudio - all rights reserved */
/* information about this tool and other widgets: info@artviper.net  */
/* the header 'artViper's social bookmark widget has not to be removed */
/* same goes for the link to this tool */
/* add these lines to your document, to make this script work: */
/* <script language="javascript" type="text/ecmascript" src="js/jquery.js"></script>
<script language="javascript" type="text/ecmascript" src="js/jquery.dimensions.js"></script>
<script language="javascript" type="text/ecmascript" src="js/jSocialize.js"></script>
*/

 jq(document).ready(function() {
		jq(".socializer").click(function (e) { 
			if(document.getElementById('containerx') == null){							 
				
				var top 	= jq(".socializer").offset().top;
				var height	= jq(".socializer").height();
				var left	= jq(".socializer").offset().left;
				var pos 	= top+height+20;
				
				var div = document.createElement("div");
				jq(div).hide();
				jq(div).addClass("soc_container");
				jq(document.body).prepend(div);
					
				var closeme = document.createElement('img');
				
				jq(closeme).attr({ id: "close", src: "/img/jsocialize/close.gif"});
				jq(closeme).addClass('close');
				jq(div).append(closeme);
				
				jq(closeme).click(function(){
					jq(div).remove();
				})
				
				var title= jq(".socializer").attr("title");
				var url  = document.location.href;  //jq(".socializer").attr("alt");  --> use this if you wish to define an url in the alt tag 
				
				var name = document.createElement('h2');
				jq(name).html('haus-battisti.com - bookmark and share');
				jq(div).prepend(name);
				
				var left = document.createElement('div');
				jq(left).addClass('soc_left');
				jq(div).append(left);
				
				//bookmark.it
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to bookmark.it', src: "/img/jsocialize/bookmark.gif"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs = "http://www.bookmark.it/bookmark.php?url=" + url;
				jq(myLink).attr({ href: hrefs , title: 'send to bookmark.it' });
				jq(myLink).html("bookmark.it");
				jq(left).append(myLink);
				
				// del.icio.us
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to delicious', src: "/img/jsocialize/delicious.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs = "http://del.icio.us/post?url=" + url;
				jq(myLink).attr({ href: hrefs , title: 'send to del.icio.us' });
				jq(myLink).html("del.icio.us");
				jq(left).append(myLink);
				
				// digg
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to digg', src: "/img/jsocialize/digg.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs = 'http://digg.com/submit?phase=2&url='+encodeURIComponent(url)+'&title='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to digg' });
				jq(myLink).html("digg");
				jq(left).append(myLink);
				
				// furl
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to digg', src: "/img/jsocialize/furl.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs = 'http://furl.net/storeIt.jsp?t='+title+'&u='+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to furl' });
				jq(myLink).html("furl");
				jq(left).append(myLink);
				
				// blinklist
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to blinklist', src: "/img/jsocialize/blinklist.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs = 'http://blinklist.com/index.php?Action=Blink/addblink.php&Name='+title+'&Url='+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to blinklist' });
				jq(myLink).html("blinklist");
				jq(left).append(myLink);
				
				// reddit
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to reddit', src: "/img/jsocialize/reddit.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://reddit.com/submit?url='+encodeURIComponent(url)+'&title='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to reddit' });
				jq(myLink).html("reddit");
				jq(left).append(myLink);
				
				// feedmelinks
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to feedmelinks', src: "/img/jsocialize/feedmelinks.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://feedmelinks.com/categorize?from=toolbar&op=submit&name='+title+'&url='+encodeURIComponent(url)
				jq(myLink).attr({ href: hrefs , title: 'send to feedmelinks' });
				jq(myLink).html("feedmelinks");
				jq(left).append(myLink);
				
				// technorati
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to technorati', src: "/img/jsocialize/technorati.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.technorati.com/faves?add='+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to technorati' });
				jq(myLink).html("technorati");
				jq(left).append(myLink);
				
				// yahoo
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to yahoo', src: "/img/jsocialize/im_yahoo.gif"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+encodeURIComponent(url)+'&t='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to yahoo' });
				jq(myLink).html("yahoo");
				jq(left).append(myLink);
				
				// rawsugar
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to rawsugar', src: "/img/jsocialize/rawsugar.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.rawsugar.com/tagger/?turl='+encodeURIComponent(url)+'&tttl='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to rawsugar' });
				jq(myLink).html("rawsugar");
				jq(left).append(myLink);
				
				// netvous
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to netvouz', src: "/img/jsocialize/netvouz.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://netvouz.com/action/submitBookmark?url='+encodeURIComponent(url)+'&title='+title+'&popup=no';
				jq(myLink).attr({ href: hrefs , title: 'send to netvouz' });
				jq(myLink).html("netvouz");
				jq(left).append(myLink);
				
				// rojo
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to rojo', src: "/img/jsocialize/rojo.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.rojo.com/add-subscription/?resource='+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to rojo' });
				jq(myLink).html("rojo");
				jq(left).append(myLink);
				
				// shadows
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to shadows', src: "/img/jsocialize/shadows.png"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.shadows.com/shadows.aspx?url='+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to shadows' });
				jq(myLink).html("shadows");
				jq(left).append(myLink);
				
				// shadows
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to gabbr', src: "/img/jsocialize/gabbr.gif"  });
				jq(left).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.gabbr.com/submit/?bookurl='+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to gabbr' });
				jq(myLink).html("gabbr");
				jq(left).append(myLink);
				
				// put in right container
				var right = document.createElement('div');
				jq(right).addClass('soc_left');
				jq(div).append(right);
				
				//dzone
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to dzone', src: "/img/jsocialize/dzone.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.dzone.com/links/add.html?description='+title +'&url='+ url;
				jq(myLink).attr({ href: hrefs , title: 'send to dzone' });
				jq(myLink).html("dzone");
				jq(right).append(myLink);
				
				//newsvine
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to newsvine', src: "/img/jsocialize/newsvine.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.newsvine.com/_wine/save?u='+encodeURIComponent(url)+'&h='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to newsvine' });
				jq(myLink).html("newsvine");
				jq(right).append(myLink);
				
				//ma.gnolia.com
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to ma.gnolia.com', src: "/img/jsocialize/magnolia.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://ma.gnolia.com/bookmarklet/add?url='+encodeURIComponent(url)+'&title='+title+'&description=';
				jq(myLink).attr({ href: hrefs , title: 'send to ma.gnolia.com' });
				jq(myLink).html("ma.gnolia");
				jq(right).append(myLink);
				
				//stumbleupon
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to ma.gnolia.com', src: "/img/jsocialize/stumbleupon.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.stumbleupon.com/refer.php?url='+encodeURIComponent(url)+'&title='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to stumbleupon' });
				jq(myLink).html("stumbleupon");
				jq(right).append(myLink);
				
				//google
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to google', src: "/img/jsocialize/google.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk='+encodeURIComponent(url)+'&title='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to google' });
				jq(myLink).html("google");
				jq(right).append(myLink);
				
				//squidoo
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to squidoo', src: "/img/jsocialize/squidoo.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.squidoo.com/lensmaster/bookmark?'+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to squidoo' });
				jq(myLink).html("squidoo");
				jq(right).append(myLink);
				
				// spurl.net
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to spurl', src: "/img/jsocialize/spurl.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.spurl.net/spurl.php?url='+encodeURIComponent(url)+'&title='+title+'&blocked=';
				jq(myLink).attr({ href: hrefs , title: 'send to spurl' });
				jq(myLink).html("spurl");
				jq(right).append(myLink);
				
				// blinkbits
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to blinkbits', src: "/img/jsocialize/blinkbits.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://blinkbits.com/bookmarklets/save.php?v=1&source_url='+encodeURIComponent(url)+'&title='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to blinkbits' });
				jq(myLink).html("blinkbits");
				jq(right).append(myLink);
				
				// blogmarks
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to blogmarks', src: "/img/jsocialize/bmarks.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://blogmarks.net/my/new.php?mini=1&simple=1&url='+encodeURIComponent(url)+'&title='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to blogmarks' });
				jq(myLink).html("blogmarks");
				jq(right).append(myLink);
				
				// bloglines
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to bloglines', src: "/img/jsocialize/bloglines.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.bloglines.com/sub/'+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to bloglines' });
				jq(myLink).html("bloglines");
				jq(right).append(myLink);
				
				// co.mments
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to co.mments', src: "/img/jsocialize/comments.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://co.mments.com/track?url='+encodeURIComponent(url)+'&title='+title;
				jq(myLink).attr({ href: hrefs , title: 'send to co.mments' });
				jq(myLink).html("co.mments");
				jq(right).append(myLink);
				
				// scuttle
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to scuttle', src: "/img/jsocialize/scuttle.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://www.scuttle.org/bookmarks.php/maxpower?action=add&address='+encodeURIComponent(url)+'&title='+title+'&description=';
				jq(myLink).attr({ href: hrefs , title: 'send to scuttle' });
				jq(myLink).html("scuttle");
				jq(right).append(myLink);
				
				// ask
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to ask.com', src: "/img/jsocialize/ask.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://mystuff.ask.com/mysearch/QuickWebSave?v=1.2&t=webpages&title='+title+'&url='+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to ask' });
				jq(myLink).html("ask");
				jq(right).append(myLink);
								
				// slashdot
				var img = document.createElement('img');
				jq(img).attr({ alt: 'send to slashdot', src: "/img/jsocialize/slashdot.png"  });
				jq(right).append(img);
				
				var myLink = document.createElement('a');
				var hrefs =  'http://slashdot.org/bookmark.pl?title='+title+'&url='+encodeURIComponent(url);
				jq(myLink).attr({ href: hrefs , title: 'send to slashdot' });
				jq(myLink).html("slashdot");
				jq(right).append(myLink);
				
//				jq(".soc_container").css("visibility","visible");
				jq(".soc_container").fadeIn(500);
					
				// ajax window	
				jq('.soc_left a').bind("click",function(e){
					e.preventDefault();
					var address 	= this;
					var scTop 		= jq(window).scrollTop();
                    var width		= 0;									
					
					if(jQuery.browser.msie){
						width = document.body.clientWidth;
					}else{
						width	= window.innerWidth;
					}
				
					var left		= (width - 980) /2;
					var wind 		= document.createElement("div");
			        var cssObj;
					
					if(jQuery.browser.msie){
						 cssObj = {
							top:0,
							width:'980px',
							position:'absolute',
							left: 0,
							border: '1px solid #ccc',
							visibility:'visible'
			
						 }
					}else{
						 cssObj = {
							top:scTop+20,
							width:'980px',
							position:'absolute',
							left: left + 'px'
			
						 }
					}
						
					jq(wind).css(cssObj);
					jq(wind).addClass('open_window');		
				
					var closeX = document.createElement('img');
					jq(closeX).attr({ src:"/img/jsocialize/close.gif", position:'absolute',top:"0",right:"0" });
					jq(closeX).addClass('close');
					
					jq(closeX).click(function(){
						jq(wind).remove();											
					})
					
					jq(wind).prepend(closeX);
					jq(div).append(wind);
					
					var cssObj2 = {
        				width:'980px',
						height:'500px',
						border: 'none',
						position:'absolute',
						overflow:'auto',
						display:'block'
     				 }
					
					var c	 = document.createElement('iframe');		
					jq(c).attr("src",this);
					jq(c).css(cssObj2);
					jq(wind).prepend(c);
					
	       })				
		}			
	})		
 })