var FRAME_PX=40;var FRAME_DELAY=1;var MIN_GROUP_HEIGHT="20px";var eImgSrc="../../img/global/gl_collapse.gif";var eWidthHeight=[11,11];var cImgSrc="../../img/global/gl_expand.gif";var cWidthHeight=[11,11];var rowNormal="#ffffff";var rowHighlight="#dbd0c5";var containerSelector=".tDealerAccessoriesContainer";var groupNames=new Array();var dispStatus2=new Array();var g,ABS_MIN,notAllDisp,c,a,dispStatus,imgDisp,gHeight,expand,collapse,fVal;ABS_MIN=parseInt(MIN_GROUP_HEIGHT);function toggleGroup(gId,startHeight){g=$(gId);ABS_MIN=startHeight;notAllDisp=false;c=0;if(g.style.height=='')g.style.height=MIN_GROUP_HEIGHT;hideDhtmlPop('dhtmlPop');if(g.style.height==ABS_MIN+'px'){_animateGroup(g,ABS_MIN,g.scrollHeight,FRAME_PX,arguments[2]);$(gId+'_img').src=eImgSrc;$(gId+'_img').alt=cDesc;}
else{_animateGroup(g,g.scrollHeight,ABS_MIN,-FRAME_PX,arguments[2]);$(gId+'_img').src=cImgSrc;$(gId+'_img').alt=eDesc;}
for(a=0;a<groupNames.length;a++){dispStatus=$(groupNames[a]).style.height;if(dispStatus=='')dispStatus=MIN_GROUP_HEIGHT;if(dispStatus==MIN_GROUP_HEIGHT)c++;}
if(c==1&&g.style.height==MIN_GROUP_HEIGHT)notAllDisp=false;else notAllDisp=true;_toggleHTMLSwitch(notAllDisp);}
function toggleAll(){notAllDisp=false;for(a=0;a<groupNames.length;a++){dispStatus=$(groupNames[a]).style.height;if(dispStatus=='')dispStatus=MIN_GROUP_HEIGHT;if(dispStatus==MIN_GROUP_HEIGHT){notAllDisp=true;break;}}
if(notAllDisp==true){_openCloseGroups(groupNames,false);_toggleHTMLSwitch(false);}
else{if(jQuery!="undefined"){if(jQuery(containerSelector).size()>0){jQuery(containerSelector).each(function(){var t=jQuery(this);t.css({height:t.height()+"px"});});setTimeout(function(){jQuery(containerSelector).css({height:"auto"});},800);}}
location.hash="#toggleAll";_openCloseGroups(groupNames,true);_toggleHTMLSwitch(true);}
hideDhtmlPop('dhtmlPop');}
function addGroup(groupID){groupNames.push(groupID);}
function highlightFeature(f){if(fVal){if(fVal!=-1){if(fVal.indexOf("CommonFeatures")!=-1)$(fVal).style.backgroundColor=rowNormal;if(fVal.indexOf("StandardFeatures")!=-1)$(fVal).style.backgroundColor=rowNormal;}}
fVal=f;hideDhtmlPop('dhtmlPop');if(fVal.indexOf("CommonFeatures")!=-1){var thenTrigger=(f!=-1)?_highlightAndOpenFeature:_delayedToggleGroup1;_openCloseGroups(groupNames,true,thenTrigger);_toggleHTMLSwitch(true);}
if(fVal.indexOf("StandardFeatures")!=-1){$(fVal).style.backgroundColor=rowHighlight;newScrollAnchor=fVal;_thenScrollIntoView();}}
function expandCategory(){if(document.location.pathname.indexOf("expandCategory.")!=-1){var category=document.location.pathname.substr(document.location.pathname.indexOf("expandCategory.")).split(".")[1];toggleGroup("accordionGroup_"+category,parseInt(MIN_GROUP_HEIGHT));}else{if(document.getElementById("accordingGroup_1")){toggleGroup("accordionGroup_1",parseInt(MIN_GROUP_HEIGHT));}}}
function _animateGroup(g,minH,maxH,delta,thenTrigger){if(delta>0){if(minH<=maxH){g.style.height=minH+"px";setTimeout(function(){_animateGroup(g,(minH+delta),maxH,delta,thenTrigger);},FRAME_DELAY);}else{g.style.height=g.scrollHeight+"px";if(typeof thenTrigger=="function"){thenTrigger();}
return;}}else{if(minH>=ABS_MIN){g.style.height=minH+"px";setTimeout(function(){_animateGroup(g,(minH+delta),maxH,delta,thenTrigger);},FRAME_DELAY);}else{g.style.height=ABS_MIN+"px";if(typeof thenTrigger=="function"){thenTrigger();}
return;}}}
function _toggleHTMLSwitch(collapsed){expand='<a href="javascript:toggleAll();" onClick="window.focus();" hideFocus="true"><img src="'+cImgSrc+'" width="'+eWidthHeight[0]+'" height="'+eWidthHeight[1]+'" alt="'+eDesc+'" border="0" /> '+eDesc+'</a>';collapse='<a href="javascript:toggleAll();" onClick="window.focus();" hideFocus="true"><img src="'+eImgSrc+'" width="'+cWidthHeight[0]+'" height="'+cWidthHeight[1]+'" alt="'+cDesc+'" border="0" /> '+cDesc+'</a>';if(collapsed==true){setHtml("ExpandCollapseLink_Top",expand);setHtml("ExpandCollapseLink_Bottom",expand);}
else{setHtml("ExpandCollapseLink_Top",collapse);setHtml("ExpandCollapseLink_Bottom",collapse);}}
function _openCloseGroups(items,allOpened,thenTrigger){var wasTriggered=false;if(allOpened==false){imgDisp=eImgSrc;for(a=0;a<items.length;a++){g=$(items[a]);gHeight=$(items[a]).style.height;if(gHeight=="")gHeight=MIN_GROUP_HEIGHT;if(gHeight==MIN_GROUP_HEIGHT){_animateGroup(g,parseInt(MIN_GROUP_HEIGHT),g.scrollHeight,FRAME_PX,thenTrigger);wasTriggered=true;}
$(items[a]+"_img").src=imgDisp;}}else{imgDisp=cImgSrc;for(a=0;a<items.length;a++){g=$(items[a]);gHeight=$(items[a]).style.height;if(parseInt(gHeight)>parseInt(MIN_GROUP_HEIGHT)){_animateGroup(g,g.scrollHeight,parseInt(MIN_GROUP_HEIGHT),-FRAME_PX,thenTrigger);wasTriggered=true;}
$(items[a]+"_img").src=imgDisp;}}
if(!wasTriggered&&typeof thenTrigger=="function"){thenTrigger();}}
function _thenScrollIntoView(){if(newScrollAnchor){$(newScrollAnchor).scrollIntoView();newScrollAnchor=null;}}
function _highlightAndOpenFeature(){f=fVal;feat=$(f);feat.style.backgroundColor=rowHighlight;var featgroup="";var featancestor=feat.parentNode;for(var iterate=0;featgroup==""&&iterate<100;iterate++){if(featancestor.className.indexOf("tAccordionGroup")==-1){featancestor=featancestor.parentNode;}else{featgroup=featancestor.id;newScrollAnchor=feat.id;if(featancestor.style.height==MIN_GROUP_HEIGHT||featancestor.style.height==''){toggleGroup(featancestor.id,parseInt(MIN_GROUP_HEIGHT),_thenScrollIntoView);}else{_thenScrollIntoView();}
break;}}}
function _delayedToggleGroup1(){toggleGroup('accordionGroup_1',parseInt(MIN_GROUP_HEIGHT));}
