	var st = null;
	var rb = null;
	var i = null;
	
	function getPosX(e) {
		var posx = 0;		
		if (e.pageX ) 	{
			posx = e.pageX;
		}
		else if (e.clientX || e.clientY) 	{
			posx = e.clientX + document.body.scrollLeft
				+ document.documentElement.scrollLeft;			
		}			
		return posx;
	}
	
	function getPosY(e) {
		
		var posy = 0;
		if (e.pageY) 	{			
			posy = e.pageY;
		}
		else if (e.clientY) 	{			
			posy = e.clientY + document.body.scrollTop
				+ document.documentElement.scrollTop;
		}	
		return posy;
	}
	
    $(document).ready(function() {		
		Raphael.el.tooltip = function (tp) {			
			this.hover(
				function(event){								
					var position = $("#signscroller").offset();			
					var left = Math.round(position.left);
					var top = Math.round(position.top);
					tb.attr({x:event.clientX - left + 5, y:event.clientY-top}).show().toFront();
					tbt.attr({'text':tp, x: event.clientX -left + 45,y:event.clientY-top+13}).show().toFront();
					this.mousemove(function(event){								
						tb.attr({x: event.clientX - left + 5,y:event.clientY-top});
						tbt.attr({x: event.clientX - left + 45,y:event.clientY-top+13});						
						});
					},
				function(event){
					tb.hide();
					tbt.hide();					
					this.unmousemove();
					});
			return this;
		};

        var paper = Raphael(document.getElementById("signscroller"), 395, 353);				
		
		var tb = paper.rect(0, 0, 90, 24, 5).attr({'fill':'#ffffff','stroke':'#BEA3D4'}).hide();
		var tbt = paper.text(0,0,"").attr({'font-size': 13, 'font-style':'italic' , 'font-weight':'bold', 'font-family': 'Times New Roman','fill':'#BEA3D4'}).hide();
		
		rb = paper.image("./images/wheel.png", 0, 0, 331, 331);
		i = paper.image("./images/wheel_yellow.png", 124, 8 , 82, 80).hide();
		st = paper.set();		
		st.push(			
			paper.image("./images/wheel/aries.gif", 145, 25 , 39, 43).click(function(){
				st.animate({rotation:"0 165 165 true"}, 300);
				rb.animate({rotation:"0 165 165 true"}, 300, waitShowYellow());
				showSign('Aries');
			}).tooltip('Aries'),
			paper.image("./images/wheel/taurus.gif", 210, 40 , 42, 41).click(function(){
				st.animate({rotation:"-30 165 165 true"}, 300);
				rb.animate({rotation:"-30 165 165 true"}, 300, waitShowYellow());
				showSign('Taurus');
			}).tooltip('Taurus'),
			paper.image("./images/wheel/sagitaurus.gif", 260, 85 , 38, 45).click(function(){
				st.animate({rotation:"-60 165 165 true"}, 300);
				rb.animate({rotation:"-60 165 165 true"}, 300, waitShowYellow());
				showSign('Sagittarius');
			}).tooltip('Sagittarius'),
			paper.image("./images/wheel/libra.gif", 270, 150 , 39, 39).click(function(){
				st.animate({rotation:"-90 165 165 true"}, 300);
				rb.animate({rotation:"-90 165 165 true"}, 300, waitShowYellow());
				showSign('Libra');
			}).tooltip('Libra'),
			paper.image("./images/wheel/virgo.gif", 250, 210 , 50, 44).click(function(){
				st.animate({rotation:"-120 165 165 true"}, 300);
				rb.animate({rotation:"-120 165 165 true"}, 300, waitShowYellow());
				showSign('Virgo');
			}).tooltip('Virgo'),
			paper.image("./images/wheel/leo.gif", 210, 250, 40, 42).click(function(){
				st.animate({rotation:"-150 165 165 true"}, 300);
				rb.animate({rotation:"-150 165 165 true"}, 300, waitShowYellow());
				showSign('Leo');
			}).tooltip('Leo'),
			paper.image("./images/wheel/cancer.gif", 85, 250, 41, 41).click(function(){
				st.animate({rotation:"150 165 165 true"}, 300);
				rb.animate({rotation:"150 165 165 true"}, 300, waitShowYellow());
				showSign('Cancer');
			}).tooltip('Cancer'),
			paper.image("./images/wheel/aquarius.gif", 35, 210, 46, 33).click(function(){
				st.animate({rotation:"120 165 165 true"}, 300);
				rb.animate({rotation:"120 165 165 true"}, 300, waitShowYellow());
				showSign('Aquarius');
			}).tooltip('Aquarius'),
			paper.image("./images/wheel/scorpio.gif", 20, 145, 54, 37).click(function(){
				st.animate({rotation:"90 165 165 true"}, 300);
				rb.animate({rotation:"90 165 165 true"}, 300, waitShowYellow());
				showSign('Scorpio');
			}).tooltip('Scorpio'),
			paper.image("./images/wheel/gemini.gif", 37, 85, 46, 35).click(function(){
				st.animate({rotation:"60 165 165 true"}, 300);
				rb.animate({rotation:"60 165 165 true"}, 300, waitShowYellow());
				showSign('Gemini');
			}).tooltip('Gemini'),
			paper.image("./images/wheel/capricorn.gif", 80, 40, 34, 42).click(function(){
				st.animate({rotation:"30 165 165 true"}, 300);
				rb.animate({rotation:"30 165 165 true"}, 300, waitShowYellow());
				showSign('Capricorn');
			}).tooltip('Capricorn'),			
			paper.image("./images/wheel/pisces.gif", 150, 265 , 37, 41).click(function(){
				st.animate({rotation:"180 165 165 true"}, 300);
				rb.animate({rotation:"180 165 165 true"}, 300, waitShowYellow());
				showSign('Pisces');
			}).tooltip('Pisces')		
		);
		var t = paper.image("./images/select.png", 95, 116 , 143, 95);		
	});
	
	function rotateWheel(starSign)
	{	
		if(st != null)
		{
			var rot = 0;
			var angle = [
			{ Name: "Aries", Angle: 0},
			{ Name: "Taurus", Angle: -30},
			{ Name: "Sagittarius", Angle: -65},
			{ Name: "Libra", Angle: -93},
			{ Name: "Virgo", Angle: -120},
			{ Name: "Leo", Angle: -150},
			{ Name: "Pisces", Angle: 180},
			{ Name: "Cancer", Angle: 150},
			{ Name: "Aquarius", Angle: 120},
			{ Name: "Scorpio", Angle: 90},
			{ Name: "Gemini", Angle: 60},
			{ Name: "Capricorn", Angle: 30}];

			for (var index in angle)
			{
				var sign = angle[index];
				if (sign.Name == starSign){
					rot = sign.Angle;
					break;
				}
			}
			
			st.animate({rotation:rot + " 165 165 true"}, 300);
			rb.animate({rotation:rot + " 165 165 true"}, 300, waitShowYellow());
		}
	}
	
	function waitShowYellow()
	{
		i.hide();
		var t=setTimeout("showYellow()",300);
	}
	
	function showYellow()
	{
		i.show();
	}
	
	function showSign(starSign)
	{
		$('#spanTitleSign').html(starSign);
		$('#myIframe').attr({src:'/Index/OverviewIFrame?StarSign=' + starSign });
		$('#overviewLink').attr({href: '/Index/OverviewIFrame?StarSign=' + starSign });
		$('#monthlyIFrameLink').attr({href: '/Index/MonthlyIFrame?StarSign=' + starSign });
		$('#financeIFrameLink').attr({href: '/Index/FinanceIFrame?StarSign=' + starSign });
	}	
