/*
* hassha.js 
* hassha basic interaction script.
*
*/
$(function(){
	var show_profile = '';
	//getting target doms.
	$('img.swap')
		.mouseover(
			function(e) {
				var self = $(this);
				var tmp_dest = self[0].src;
				var destination = tmp_dest.replace('\/thumb50\/','\/thumb\/');
				var target = self.attr('target');
				var target_id = target.replace('feed_','main_');
				$('#'+target_id)[0].src = destination;
			}
		);
		var out = function(e) {
			var t = e.target;
			do{
				if(t == document) break;
				if(t.tagName.toUpperCase() == 'DT'){
					break;
				}
			}while( t = t.parentNode );
			if(t == document) {
				$('#'+show_profile).hide("slow");
				show_profile = '';
			}
		}
		var over = function(e) {
			if(!jQuery.timers.length){
				var target_id = $(this).attr('target').replace('feed_','prof_');
				$('#'+target_id).show("slow");
				show_profile = target_id;
				$(document).bind('mouseover',out);
			}
		}
		$('dt.prof').mouseover( over );

		$('#goToTop').click(function(e) {
			$.scrollTo('0px',800);
		});
});

