$(function()
{
	var uarr = location.pathname.split("/");
    var path = uarr[uarr.length-1];
	var tid = path.replace("type-tid-","").replace(".html","");
	
	if (tid != null)
	{
		//$("a[href*=tid="+ tid +"]").parent().parent().parent().find("li[class*=producttype]").show();
        var uarr = location.pathname.split("/");
        var path = uarr[uarr.length-1];
        var url = path + location.search;
        var typediv = $("ul[class=producttype]");
		var temp = typediv.find("a[href="+ url +"]");
		if (temp == "undefined")
		{
			return;
		}
		
        temp = typediv.find("a[href="+ url +"]").parent();
		
        var cls_arr = temp.attr("class").split(' ');
        var i = parseInt(cls_arr[0].replace('producttype',''));
        var level = 0;
        if (!isNaN(i))
            level = i + 1;
		var child = $("#producttype"+tid);
		if (child != null)
		{
			child.find(".producttype"+ level).show();
		}

		/*temp = temp.parent();*/

		for (index=i; index>0; index--)
		{
			temp.parent().find(".producttype"+ index).show();
			temp = temp.parent().parent();
		}
	}
});

function QueryString(fieldName)
{
  var urlString = document.location.search;
  if(urlString != null)
  {
	   var typeQu = fieldName+"=";
	   var urlEnd = urlString.indexOf(typeQu);
	   if(urlEnd != -1)
	   {
			var paramsUrl = urlString.substring(urlEnd+typeQu.length);
			var isEnd =  paramsUrl.indexOf('&');
			if(isEnd != -1)
			{
				 return paramsUrl.substring(0, isEnd);
			}
			else
			{
				return paramsUrl;
			}
	   }
	   else
	   {
			return null;
	   }
  }
 else
 {
	return null;
 }
}