$(document).ready(function(){
	imgComplete=function(s){
		var a=true;
		if(s==false){
			var img=$('.page img');
			for(i=0;i<img.length;i++){
				if(img[i].readyState!="complete"){
					a=false;
					break;
				};
			};
		};
		if(a==true){
			$('#loading').remove();
			$('.page').animate({opacity:'toggle'},2000);
		}else{
			setTimeout("imgComplete("+a+")",100);
		};
	};
	imgComplete(false);
	$('#carousel').Carousel({
		itemWidth: 150,
		itemHeight: 0,
		itemMinWidth: 80,
		items: 'a',
		reflections:0.5,
		rotationSpeed:0.5
	});
	$('a').focus(function(){
		this.blur();
	});
	$(document).PngForIE({
		AutoSize:true,
		ReplacImg:'images/mblank.gif'
	});
	$('.tip').each(function(){
		var me=$(this);
		var t=$(this).attr('title');
		$(this).removeAttr('title');
		me.hover(function(){
			$('#tip img').css({'filter':'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="images/'+t+'.png", sizingmethod=scale)'});
			$('#tip').show();
		},function(){
			$('#tip').hide();
		});
	});
});
function mouseCoords(ev){
	if(ev.pageX || ev.pageY){
		return {
			x:ev.pageX, y:ev.pageY
		};
	}
	return {
		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		y:ev.clientY + document.body.scrollTop - document.body.clientTop
	};
}
function mouseMove(ev){
	ev = ev || window.event;
	return mousePos = mouseCoords(ev);
}
document.onmousemove = mouseMove;
