// imported by the central js-files
function openOnlineCatalogue( def, country, language, groupid) {
     catalogueurl = 'http://www.hella.com/toc/enter';
    
    country        = country ? country : 'DE';
      language    = language ? language : 'DE';
    
      if( def!='' ) {
        url = catalogueurl+'?DEFAULT='+def+'&COUNTRY='+country+'&LANGUAGE='+language;
    } else {
        url = catalogueurl+'?COUNTRY='+country+'&LANGUAGE='+language;
    }
    if( groupid!='' ) {
        url = url+'&GROUP_ID='+groupid;
    }
    var winWidth = screen.availWidth-10;
    var winHeight = screen.availHeight-50;
    var left = 0;
    var top = 0;
    var toolbar_str = 'no';
    var menubar_str = 'no';
    var statusbar_str = 'no';
    var scrollbar_str = 'yes';
    var resizable_str = 'yes';
    var ocwin = window.open(url, 'oc', 'left='+left+',top='+top+',width='+winWidth+',height='+winHeight+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
    ocwin.focus();
}
//
//    function to open the Hella Online Catalogue
//
//     onlineCatalogue( country, language[, basket[, prices[, articleNO[, formfieldID]]]] )
//
//        country        = country as string for old catalogue, i. e. 'DE'; default 'DE'
//        language    = language as string for old catalogue, i. e. 'DE'; default 'DE'
//        basket        = 'showing a shoppping basket' as int (1=yes, 0=no); optional
//        prices        = 'showing prices' as int (1=yes, 0=no); optional
//        articleNO    = number of article to search as string; optional
//        formfieldID    = id of form field to search as string; optional
//
function onlineCatalogue( country, language, basket, prices, articleNO, formfieldID ) {
     // new catalogue? ( 0=old - 1=new )
    var newCat                = 1;
    
    // old catalogue
    var oldCatalogueURL     = 'http://www.hella.com/toc/enter';
    var tmpCountry            = 'DE'; // default
    var tmpLanguage            = 'DE'; // default
    var basketPart            = '&DEFAULT=2';
    
    // new catalogue
    var newCatalogueURL     = 'http://www.hella.com/toc/enter';
    
    var profileIDArr        = new Array();
    profileIDArr[0]            = 21; // no shopping basket
    profileIDArr[1]            = 23; // shopping basket
    
    // general
    var searchPart            = '&SEARCH_PATH=4&SearchNumber=';
    var pricesPart            = 'GROUP_ID=test_1';
    
    // init
    var tmpCatalogueURL;
    var tmpProfile;
    var tmpURL;
    var tmpArt;
    
    // build catalogue url
    // general
    if ( country && country != '' ) {
        tmpCountry    = country;
    } // country set
    if ( language && language != '' ) {
        tmpLanguage    = language;
    } // language set
    tmpProfile        = 'COUNTRY=' + tmpCountry + '&LANGUAGE=' + tmpLanguage;
    
    if ( !basket || basket != 1 ) {
        basket = 0;
    } // no basket
    
    if ( newCat == 1 ) {
        tmpProfile        += '&profile=' + profileIDArr[basket];
        tmpURL = newCatalogueURL + '?' + tmpProfile;
    } else { // new catalogue
        tmpURL = oldCatalogueURL + '?' + tmpProfile
        if ( basket && basket == 1 ) {
            tmpURL = tmpURL + basketPart;
        } // shopping basket in old oc
    } // old catalogue
    
    // additional setting    
    if ( prices && prices == 1 ) {
        tmpURL = tmpURL + '&' + pricesPart;
    } // prices shown
    
    // article search by number
    if ( formfieldID && formfieldID != '' && document.getElementById( formfieldID ) ) {
        if ( ( tmpArt = document.getElementById( formfieldID ).value ) != '' ) {
            tmpURL = tmpURL + searchPart + tmpArt;
        } else if ( ( tmpArt = document.getElementById( formfieldID ).value ) == '' ) { // article no set in form field
            tmpURL = '';
        } // empthy form field
    } else if ( articleNO && articleNO != '' ) { // search by form field
        tmpURL = tmpURL + searchPart + articleNO;
    } // search by optional set article no
    if ( tmpURL != '' ) {
        // window setting
        var winWidth        = screen.availWidth-10;
        var winHeight         = screen.availHeight-50;
        var left             = 0;
        var top             = 0;
        var toolbar_str     = 'no';
        var menubar_str     = 'no';
        var statusbar_str     = 'no';
        var scrollbar_str     = 'yes';
        var resizable_str     = 'yes';
        
        // WebTrends
        downloadTrack(tmpURL);
        // opening the catalogue
        var ocwin = window.open( tmpURL, 'ocwin', 'left=' + left + ',top=' + top + ',width=' + winWidth + ',height=' + winHeight + ',toolbar=' + toolbar_str + ',menubar=' + menubar_str + ',status=' + statusbar_str + ',scrollbars=' + scrollbar_str + ',resizable=' + resizable_str);
        ocwin.focus();
    } // no URL top open
}
