//

// TNavigationPrint
function TNavigationPrint(){
        var myNavIndex = XML.getFirstItem("Config").getFirstItem("NavigationIndex").getValue()
        if(!(myNavIndex=="null"||myNavIndex=="")){
                navigation[parseInt(myNavIndex)].active = true;
                if(navigation[parseInt(myNavIndex)].parentId!=null) navigation[navigation[parseInt(myNavIndex)].parentId].open = true;
                };
        var rString = '<TABLE class="CATLINKS1STPARENT" width="100%" border="0" cellpadding="1" cellspacing="0" >';
        for(var i=0;i<navigation.length;i++) if(navigation[i].parentId==null){
                rString += navigation[i].print();
                if(navigation[i].active==true||navigation[i].open==true){
                        rString += "</TABLE>"
                        rString += '<TABLE class="CATLINKS2NDPARENT" width="100%" border="0" cellpadding="1" cellspacing="0" ><TR valign="top">';
                        for(var j=0;j<navigation.length;j++) if(navigation[j].parentId==navigation[i].id){
                                rString += navigation[j].print();
                                };
                        rString += "</TABLE>"
                        rString += '<TABLE class="CATLINKS1STPARENT" width="100%" border="0" cellpadding="1" cellspacing="0" >';
                        };
                };
                rString += "</TABLE>"
        return(rString);
        };
// TNavElemprint
function TNavElemPrint(){
        var rString = '<TR valign="top">';
        with(this){
                if(active){
                        if(parentId!=null) rString += '<TD class="ACTIVECATEGORY" ><IMG SRC="images/spacer.gif" width="11" height="1"></TD>'
                        rString += '<TD class="ACTIVECATEGORY" ><img src="images/bulletcatact.gif" width="11" height="14" border="0" align="bottom" hspace="0" vspace="0" class="CATNAV"></TD>'
                        }
                else{
                        if(parentId!=null){
                                rString += '<TD class="CATLINKS2NDBULLET" ><IMG SRC="images/spacer.gif" width="11" height="1"></TD>';
                                rString += '<TD class="CATLINKS2NDBULLET" ><img src="images/bulletcat2nd.gif" width="11" height="14" border="0" align="bottom" hspace="0" vspace="0" class="CATNAV"></TD>';
                                }
                        else{
                                rString += '<TD class="CATLINKS1STBULLET" >';
                                if(!open) rString += '<img src="images/bulletcat1st.gif" width="11" height="14" border="0" align="bottom" hspace="0" vspace="0" class="CATNAV"></TD>'
                                else rString += '<img src="images/bulletcat1stcls.gif" width="11" height="14" border="0" align="bottom" hspace="0" vspace="0" class="CATNAV"></TD>';
                                };
                        };
                if(active) rString += '<TD nowrap class="ACTIVECATEGORY"  width="100%">'
                else{
                        if(parentId!=null) rString += '<TD nowrap class="CATLINKS2NDCAPTION"  width="100%">'
                        else rString += '<TD nowrap colspan="2" class="CATLINKS1STCAPTION"  width="100%">'
                        };
                rString += "<a href=\"javascript: changeLoc(" + this.id + ",'" + this.linkUrl + "')\" class=\"wagrunav\">";
                rString += caption;
                rString += "</a>";
                rString += "</TD>"
                rString += "</TR>";
                };
        return rString;
        };

//

// navElem
function navElem(id,caption,linkUrl,parentId){
        this.id = id;
        this.caption = caption;
        this.linkUrl = linkUrl;
        this.parentId = parentId;
        this.print = TNavElemPrint;
        this.active = false;
        this.open = true;
        };
// navigation
var navigation = new Array();
//
navigation[0] = new navElem(0,"Kontaktlinsen","kontaktlinsen.htm",null);
navigation[1] = new navElem(1,"Ferngläser","fernglaeser.htm",null);
navigation[2] = new navElem(2,"Handelsware","pi942088510.htm",null);
navigation[3] = new navElem(3,"Brillenglasaktionen","glaeser.htm",null);
navigation[4] = new navElem(4,"Fassungsaktionen","fassungen.htm",null);
navigation[5] = new navElem(5,"Weltweite Ersatzbrille","ersatz.htm",null);
navigation[6] = new navElem(6,"Ihre Meinung","meinung.htm",null);
navigation[7] = new navElem(7,"Angebot","angebot.htm",null);

// changeLoc
function changeLoc(id,linkUrl){
        XML.getFirstItem("Config").getFirstItem("NavigationIndex").putValue(id.toString());
        safeData();
        location.href = linkUrl;
        };
