$(function(){
	/*simulation select golbal binder*/
	$("#QuestionSelect").CreateSimSelect();
	$("#faqList").CreateAccordion();
	
	$(window).bind('resize',function (){
		if($(".subSimSelect").css("display")=="none")
			return;
		
		$(".subSimSelect").positionBy({
			target:$("#QuestionSelect"),
			targetPos: 3,
			elementPos:0
		}).show("fast");
	});
	
});

function faqDropdown(url,faqCategoryId){
	$.ajax({
		url:url,
		type:'get',
		success:function(response){
			$("#faqList").html(response)
			$("#subnaigation .on").removeClass('on');
			$(".subSimSelect").hide();
			if(faqCategoryId!=''&&faqCategoryId!=undefined){
				$("#subnaigation .Menu3rd a[href=faqs.jspx?faqCategoryId\="+faqCategoryId+"]").addClass('on');
			}else{
				$("#subnaigation .Menu3rd a[href=faqs.jspx]").addClass('on');
			}	
			
				/*$(".subSimSelect .first").removeClass("first");
				$(".subSimSelect li").each(function(){
					if($(this).text()=='All Questions')$(this).remove();
				});
				
				var str="<li onclick=\"faqDropdown('/en-US/faqs-ajax.jspx')\" class=\"first\">All Questions</li>";
				$(".subSimSelect").html(str+$(".subSimSelect").html());
				$(".subSimSelect li").each(function(){
						$(this).removeClass("hover");
						$(this).hover(
								function(){
									$(this).addClass("hover");
									$(this).next().css("border-top", "none");
								},
								function(){
									$(this).removeClass("hover");
									$(this).next().css("border-top", "1px dashed #f29400");
								}
							).bind("click", function(){
								$(this).parent().prev().text($(this).text());
							});
				});*/
		}
	});
	
}

function trackFaq(url,id){
	if($("#"+id).attr("class")==''){
		trackingPage(url+"/open");
	}else{
		trackingPage(url+"/close");
	}
}

