/* General */
function OpenWindow(strURL,strName,varParams) {
    window.open(strURL,strName,varParams);
}
function HighlightSection(strElmtID,strFont) {
    var objRow;
    objRow = document.getElementById(strElmtID);
    objRow.style.color = strFont;
}
/* Menus */
var blnIE;
var objTimeoutId=[0,0];
var intSpeed=100;//higher=faster
var intAnimIntr=5;
var intHideIntr=500;
var intPageWidth=842;
var blnFade=true; 
var blnScroll=false; 
var intOpacity=90;
var varMenuName=["MenuA","MenuDC","MenuDD","MenuI","MenuOB"]; 
var intMenuTop=[242,242,242,242,242];
var varMenuOffset=[323,196,90,-220,-212]; 
var intMenuHeight=[209,209,209,209,209];//19px/option
var intMenuWidth=[200,200,200,200,200];
function GetPageCenter() {
    var varCenter=0;
    if (document.documentElement&&document.documentElement.clientWidth) {
        varCenter=document.documentElement.clientWidth;
    } 
    else if (document.body&&document.body.clientWidth) {
        varCenter=document.body.clientWidth;
    }
    if (varCenter<=intPageWidth)
        varCenter=intPageWidth;
    return varCenter/2;
}
function PositionMenus() {
    //var i,objMenu;
    //var varWidth=GetPageCenter();
    //for (i=0;i<varMenuName.length;i++) {
    //    objMenu=document.getElementById(varMenuName[i]);
    //    objMenu.style.left=(varWidth-varMenuOffset[i])+'px';
    //}
}
function HideMenus() {
    var i,objMenu;
    for (i=0;i<varMenuName.length;i++) {
        objMenu=document.getElementById(varMenuName[i]);
        objMenu.style.visibility='hidden';
    }
}
function AnimateMenu(intMenu,intHeight) {
    var strMenu=varMenuName[intMenu];
    var objMenu=document.getElementById(strMenu);
    intHeight-=(intHeight/intMenuHeight[intMenu])*intSpeed;
    if (blnScroll) {
        if (blnIE) {
            objMenu.style.top=((intMenuTop[intMenu]+1)-intHeight)+'px';
        }
        else {
            objMenu.style.top=(intMenuTop[intMenu]-intHeight)+'px';
        }
        objMenu.style.clip='rect('+intHeight+'px,'+intMenuWidth[intMenu]+'px,'+intMenuHeight[intMenu]+'px,0px)';
    }
    else {
        objMenu.style.top=intMenuTop[intMenu]+'px';
        objMenu.style.clip='rect(0px,'+intMenuWidth[intMenu]+'px,'+intMenuHeight[intMenu]+'px,0px)';
    }
    if (blnFade) {
        if (intHeight<95) 
            objMenu.style.filter='alpha(opacity='+(intOpacity-intHeight)+')';
    }
    else {
        objMenu.style.filter='alpha(opacity='+intOpacity+')';
    }
    if (intHeight>1)
        window.setTimeout("AnimateMenu("+intMenu+","+intHeight+")",intAnimIntr);
}
function ShowMenu(intMenu) {
    var strMenu=varMenuName[intMenu];
    var objMenu=document.getElementById(strMenu);
    CancelMenuClose();
    if (objMenu.style.visibility!='visible') {
        HideMenus();
        objMenu.style.visibility='visible';
        objMenu.style.filter='alpha(opacity=0)';
        AnimateMenu(intMenu,intMenuHeight[intMenu]);
    }
}
function ShowMenuSub(intMenu) {
    var strMenu=varMenuName[intMenu];
    var objMenu=document.getElementById(strMenu);
    CancelMenuClose();
    if (objMenu.style.visibility!='visible') {
        objMenu.style.visibility='visible';
        objMenu.style.filter='alpha(opacity=0)';
        AnimateMenu(intMenu,intMenuHeight[intMenu]);
    }
}
function HideMenu(intMenu,intAlpha) {
    var strMenu=varMenuName[intMenu];
    var objMenu=document.getElementById(strMenu);
    intAlpha-=intSpeed;
    if (blnFade) {
        objMenu.style.filter='alpha(opacity='+intAlpha+')';
    }
    else {
        intAlpha = 0;
    }
    if (intAlpha>0) {
        window.setTimeout("HideMenu("+intMenu+","+intAlpha+")",intAnimIntr);
    }
    else {
        objMenu.style.visibility='hidden';
    }
}
function HideParentMenu(intMenu,varChild,intAlpha) {
    for (i=0;i<varChild.length;i++) {
        HideMenu(varChild[i],intAlpha);
    }
    HideMenu(intMenu,intAlpha);
}
function HideMenuSub(intMenu) {
    HideMenu(intMenu,0);
}
function ShowHideSubMenus(varShowMenus,varHideMenus) { 
    for (i=0;i<varShowMenus.length;i++) {
        ShowMenuSub(varShowMenus[i]);
    }
    for (i=0;i<varHideMenus.length;i++) {
        HideMenuSub(varHideMenus[i]);
    }
}
function HideMenuTimeout(intMenu) {
    CancelMenuClose();
    objTimeoutId[0]=window.setTimeout("HideMenu("+intMenu+","+intOpacity+")",intHideIntr);
}
function HideParentMenuTimeout(intMenu,varChild) {
    CancelMenuClose();
    objTimeoutId[0]=window.setTimeout("HideParentMenu("+intMenu+",["+varChild+"],"+intOpacity+")",intHideIntr);
}
function HideMenuSubTimeout(intChild,intParent) {
    CancelMenuClose();
    objTimeoutId[0]=window.setTimeout("HideMenu("+intChild+","+intOpacity+")",intHideIntr);
    objTimeoutId[1]=window.setTimeout("HideMenu("+intParent+","+intOpacity+")",intHideIntr);
}
function CancelMenuClose() {
    window.clearTimeout(objTimeoutId[0]);
    window.clearTimeout(objTimeoutId[1]);
}
function SetResizeEvent() {
    window.onresize=PositionMenus;
}
blnIE = navigator.appName.indexOf('Microsoft')!=-1;
SetResizeEvent();
/* Dynamic XML */
var objXmlDoc;
var blnXmlIE=false;
if (window.ActiveXObject)
    blnXmlIE=true;
function UpdateModelsList() {
    var strModel;
    var objModels=document.getElementById('Model');
    var intModels=objXmlDoc.getElementsByTagName('models')[0].childNodes.length;
    if (blnXmlIE==false) { 
        intModels=((intModels-1)/2);
    }
    objModels.length=intModels;
    objModels[0]=new Option('-');
    objModels[0].value='-';
    for (var i=0; i < (intModels); i++) {
        strModel=String(objXmlDoc.getElementsByTagName('model')[i].firstChild.nodeValue);
        objModels[i+1]=new Option(strModel);
        objModels[i+1].value=strModel;
    }
    if (i!=0) {
        i+=1;
        objModels[i]=new Option('-');
        objModels[i].value='-';
    }
    objModels[i+1]=new Option('Model not listed');
    objModels[i+1].value='Model not listed';
}
function UpdateMakeModelLists(strMake) { 
    var strXml;
    strXml='models.aspx?Make='+strMake;
    if (blnXmlIE) {
        objXmlDoc=new ActiveXObject("Microsoft.XMLDOM");
        objXmlDoc.async=false;
        objXmlDoc.load(strXml);
        UpdateModelsList();
    }
    else {
        objXmlDoc=document.implementation.createDocument("","",null);
        objXmlDoc.load(strXml);
        objXmlDoc.onload=UpdateModelsList;
    }
}
/* End */
