var quality_campaign = 
{
	navigation :
	{
		suns : function()	{
		
			var menuActive = false;
			var sunTimer;
			
			$("ul#sun-navigation li div.label").each(function(i)	{
				$(this).append("<span class=\"right\" style=\"right: 0px;\"></span><span class=\"pointer\"></span>");
				
				//$(this).css("width",$(this).attr("offsetWidth"));
				
				var sr_pos = $(this).attr("offsetWidth");
			
				if($.browser.msie && $.browser.version=="8.0") {	
					$(this).children("span.right").css("position","relative");
					sr_pos = sr_pos - 10;
					$(this).children("span.right").css("right","-" + sr_pos + "px");
					
					
					if (i == 0)	{
						sr_pos = sr_pos + 18;
						$(this).children("span.right").css("right","-" + sr_pos + "px");
					}
					
				
				}
				else	{
					$(this).children("span.right").css("position","absolute");
					$(this).children("span.right").css("right","0px");
					$(this).children("span.right").css("top","0px");
					$(this).children("span.pointer").css("top","5px");
				}
					
			});
			// position the pointer on the first and last

			$("ul#sun-navigation li:first-child div.label span.pointer").css("width",$("ul#sun-navigation li:first-child div.label").attr("offsetWidth"));
			$("ul#sun-navigation li:last-child div.label span.pointer").css("margin-right","6px");
			
		
			$("ul#sun-navigation a").mouseenter(function()	{
			
				$(this).stop(clearQueue=true);
				clearTimeout(sunTimer);
				$("ul#sun-navigation div.label:visible").css("visibility","hidden");
			
			
				if (!$(this).parent("li").hasClass("active"))	{
					// mouseover thhe non active item set variable to true and lower the active page
					menuActive = true
					$("ul#sun-navigation li.active").children("a").animate({bottom: "0px"},200,"swing");
				}
							
				// animate the sun
				$(this).animate({bottom: "20px"},200,"swing");
				
				// calculate where to position the label
				
				// get the width of the label, css visibility rather than display has to be used to calculate widths of hidden elements
				var labelWidth = $(this).prev("div.label").attr("offsetWidth");
				var labelLeft = 0;
				var sunWidth = 30;
				
				
				if ($(this).parent("li").is(":first-child"))	{
					//alert("first");
					labelLeft = labelLeft;
				}
				else if ($(this).parent("li").is(":last-child"))	{
					
					labelLeft = labelLeft-labelWidth;
					labelLeft = labelLeft+sunWidth;
					//hack
					labelLeft = labelLeft+15;
					
				}
				else if (labelWidth > 34)	{
					labelLeft = (labelWidth - sunWidth) / 2;
					
					//hack - fix me
					labelLeft = labelLeft - 5;
					labelLeft = Math.ceil(labelLeft);
					
					if (labelLeft < 0)	{
						labelLeft = labelLeft+"px";
					}
					else	{
						labelLeft = "-"+labelLeft+"px";
					}
				
					//alert(labelWidth);
					//alert(labelLeft);
				
					
					
				}
				
				$(this).prev("div.label").css("left",labelLeft);
				// show the label - cant use fade as visibility
				
				
				
				$(this).prev("div.label").css("visibility","visible");
				
				//alert($(this).prev("div.label").html());
				
				
				
				
				/*
				$("div.label:visible span.right").css("position","absolute");
				$("div.label:visible span.right").css("right","200px");
				$("div.label:visible span.right").css("border","1px solid lime");
				*/
				//alert($(this).prev("div.label").attr("offsetWidth"));
				
				
				

				
				
			});
			
			$("ul#sun-navigation li").mouseleave(function()	{
			
				if (menuActive)	{
					$(this).children("div.label").css("visibility","hidden");
					
					$(this).children("a").animate({bottom: "0px"},200,"swing");
				}
				
			})
			
			$("ul#sun-navigation").mouseleave(function()	{
				// 
				sunTimer = setTimeout(resetSuns,1000);
				menuActive = false;
			});
			
			function resetSuns()	{
				$("sul#sun-navigation a").stop(clearQueue=true);
				$("ul#sun-navigation li div.label:visible").css("visibility","hidden");
				$("ul#sun-navigation li.active a").animate({bottom: "20px"},200,"swing");
			}
			
		}
	}
}
