
(function($){

	$(window).load(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]').click(function(){					
			window.open(this.href, '_blank');
			return false;
		});
		
		// popup
		jQuery(".popup").click(function(i){
			this.src = window.open(this.href,'_blank','menubar=yes, toolbar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=yes, top=45, left=80, width=800, height=500');return false;
		});
		
		// popup-content
		jQuery(".popup-content").click(function(i){
			this.src = window.open(this.href,'_blank','menubar=yes, toolbar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=yes, top=45, left=80, width=680, height=600');return false;
		});

	});

})(jQuery);

