/**
 * @author Laurynas Karvelis
 * @author "made.By" - www.by.lt
 * @date 2007-09-10
 */

// cookie support
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('s.5=D(a,b,c){4(m b!=\'E\'){c=c||{};4(b===p){b=\'\';c.3=-1}2 d=\'\';4(c.3&&(m c.3==\'n\'||c.3.q)){2 e;4(m c.3==\'n\'){e=B F();e.H(e.I()+(c.3*J*t*t*z))}r{e=c.3}d=\'; 3=\'+e.q()}2 f=c.7?\'; 7=\'+c.7:\'\';2 g=c.8?\'; 8=\'+c.8:\'\';2 h=c.o?\'; o\':\'\';6.5=[a,\'=\',C(b),d,f,g,h].G(\'\')}r{2 j=p;4(6.5&&6.5!=\'\'){2 k=6.5.A(\';\');y(2 i=0;i<k.9;i++){2 l=s.w(k[i]);4(l.u(0,a.9+1)==(a+\'=\')){j=v(l.u(a.9+1));x}}}K j}};',47,47,'||var|expires|if|cookie|document|path|domain|length|||||||||||||typeof|number|secure|null|toUTCString|else|jQuery|60|substring|decodeURIComponent|trim|break|for|1000|split|new|encodeURIComponent|function|undefined|Date|join|setTime|getTime|24|return'.split('|'),0,{}))

 
$(document).ready(function() {
	$('div#groups a').hover(
		function() {
			var id = $('div.tip-shadow', $(this).parent()).attr('id');
			showToolbar(id);
		},
		function() {
			hideToolbar();
		}
	);
	
	$('form#medicsFrom').submit(function() {
		var url = $(this).attr('action') + $('form#medicsFrom #type').val() + 'city:' + $('form#medicsFrom #city').val() + '/';
		window.location = url;
		return false;
	});

	if(typeof jQuery.fn.rating == 'function') {
		$('form.rating').rating();
	}
	
	$('div.ratingDesc, div.postComment, td.medic').hover(
		function() {
			$(this).addClass('activeBlock');
		},
		function() {
			$(this).removeClass('activeBlock');
		}
	);
});


function getMouseXY(e) {
	var e = (!e) ? window.event : e;
	var posScroll = 0;
	
	posX = 0;
	posY = 0;
	
	if (e.pageX || e.pageY) {
		posX = e.pageX;
		posY = e.pageY;
		posScroll = document.documentElement.scrollTop;
	} else if (e.clientX || e.clientY) {
		if (document.body.scrollLeft || document.body.scrollTop) {
			posX = e.clientX + document.body.scrollLeft;
			posY = e.clientY + document.body.scrollTop;
			posScroll = document.body.scrollTop;
		} else {
			posX = e.clientX + document.documentElement.scrollLeft;
			posY = e.clientY + document.documentElement.scrollTop;
			posScroll = document.documentElement.scrollTop;
		}
	}
	
	updateToolbar();
}

function updateToolbar() {	
	if(wmtt != null){	
		$(wmtt).css('left', (posX + 10) + "px");
		$(wmtt).css('top', (posY + 10) + "px");
	}
}

function showToolbar(id){
	wmtt = $('div#' + id);
	updateToolbar();
	
	$(wmtt).show();
}

function hideToolbar(){
	$(wmtt).hide();
	wmtt = null;
}

document.onmousemove = getMouseXY;
wmtt = null;