$(document).ready(function ()
{
	var x = $("div.slotOne").find("ul li ul li.CMSListMenuHighlightedLI");
	//alert("x.length: " + x.length);
	var x1 = $("div.slotOne").find("ul li.CMSListMenuHighlightedLI a.CMSListMenuLinkHighlighted"); 
	var x2 = $("div.slotOne").find("ul.CMSListMenuUL li.CMSListMenuHighlightedLI ul.CMSListMenuUL li.CMSListMenuHighlightedLI ul li.CMSListMenuHighlightedLI a.CMSListMenuLinkHighlighted");
	//alert("x length: " + x.length); 
	//alert("x1 length: " + x1.length); 
	//alert("x2 length: " + x2.length); 
	if(x2.length > 0)
	{
		$(x[0]).removeAttr("class");
	}
	if(x.length > 0)
	{
		//alert("x1 length: " + x1.length); 
		//alert("x2 length: " + x2.length); 
		$(x1[0]).removeAttr("class");		
		/*if(x2.length > 3)
		{
			$(x2[3]).removeAttr("class");
		}*/
	}
	if(x.length > 1)
	{
		//alert("Another length 1: " + x1.length); 
		$(x1[1]).removeAttr("class");
	}
	if(x.length > 2)
	{
		//alert("Another length 2: " + x1.length); 
		$(x1[2]).removeAttr("class");
	}
	if(x.length > 3)
	{
		//alert("Another length 3: " + x1.length); 
		$(x1[3]).removeAttr("class");
	}
	if(x.length > 4)
	{
		//alert("Another length 4: " + x1.length); 
		$(x1[4]).removeAttr("class");
	}
	var y = $("div.breadcrumb").find("ul li a.CMSBreadCrumbsCurrentItem");
	//alert("y.length: " + y.length);
	var y1 = $("div.breadcrumb").find("ul li a.CMSBreadCrumbsLink");
	//alert("y1.length: " + y1.length);
	var z = $("div.breadcrumb").find("ul li.other-link");
	//alert(z.length);
	if(y.length <= 0)
	{
		$(y1[(y1.length)-1]).removeClass("CMSBreadCrumbsLink").addClass("CMSBreadCrumbsCurrentItem");			
	}
	if(z.length > 0)
	{
		//alert("breadcrumb length: " + $(z[0]).text().length);
		//alert("breadcrumb current item length: " + $(y[0]).text().length);
		//alert("Difference: " + ($(z[0]).text().length - $(y[0]).text().length));
		if($(z[0]).text().length > 90)
		{
			if(($(z[0]).text().length - $(y[0]).text().length) > 70)
			{
				if($(y[0]).text().length > 15)
				{
					$tempStr = $(y[0]).text().substring(0, 15);
				}
				else
				{
					$tempStr = $(y[0]).text().substring(0, 10);
				}			
			}
			else if(($(z[0]).text().length - $(y[0]).text().length) > 35)
			{
				if($(y[0]).text().length > 35)
				{
					$tempStr = $(y[0]).text().substring(0, 35);
				}
				else
				{
					$tempStr = $(y[0]).text().substring(0, 30);
				}			
			}			
			else
			{
				if($(y[0]).text().length > 55)
				{
					$tempStr = $(y[0]).text().substring(0, 55);
				}
				else
				{
					$tempStr = $(y[0]).text().substring(0, 40);
				}
			}
			//alert("breadcrumb current item length: " + $(y[0]).text().length);
			$tempStr = $tempStr.substring(0, $tempStr.lastIndexOf(' '));	
			$(y[0]).text($tempStr + "...");
		}
	}
	var findBreadCrumb = $("div.breadcrumb");
	//alert("if breadcrumb: " + findBreadCrumb.length);
	if(findBreadCrumb.length > 0)
	{
		$("div.outerBodySize").addClass("breadCrumbBackColor");		
	}
});
