
(function(){

	$(document).ready(function(){

		// rollover.
		$('img.over, input.over').each(function(){
			// preload image.
			var img = new Image();
			img.src = this.src.replace(/^(.+)(\.[a-z]+)$/, '$1_over$2');
			$(this)
				// store the image sources.
				.data('image', {
					defaultSrc: this.src,
					hoverSrc: img.src
				})
				.hover(
					function(){
						this.src = $(this).data('image').hoverSrc;
					},
					function(){
						this.src = $(this).data('image').defaultSrc;
					}
				);
		});

		// print button.
		$('#content p.print > img')
			.css({ cursor: 'pointer'})
			.click(function(){
				window.print();
			});

		// close button.
		$('#content > p.close > a').click(function(){
			window.close();
			return false;
		});

		// external links.
		$('a[rel=external]').click(function(){
			window.open(this.href, '_blank');
			return false;
		});

		// open link as 'popup'.
		$('a[rel=popup], area.popup').click(function(){					
			window.open(this.href, '_blank',' status=no, toolbar=no, location=no, menubar=no, scrollbars=yes, resizable=no, width=700');
			return false;
		});
		$('a[rel=popup3]').click(function(){					
			window.open(this.href, 'popupx660','menubar=no,toolbar=no,location=yes,status=yes,resizable=yes,scrollbars=yes,width=700,height=500');
			return false;
		});

		// for ie6.
		if ($.browser.msie && (parseInt($.browser.version) < 7)) {
			try {
				document.execCommand('BackgroundImageCache', false, true);
			}
			catch(e) {}
		}

	});

})(jQuery);
