
(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;
					}
				);
		});

		// status current.
		$('img.on').each(function(){
			this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, '$1_over$2');
		});

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

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

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

	});

})(jQuery);
