var ipVersionNumber = "3.0.21";

/* ** start basket ************************/

// this var saves the url to which the basket will be send, it will be overridden by the HOOK_URL, if it was given
// if it was an empty string, after all, the order button won't be displayed (the same like with the sendBasketByEmail)
var sendBasketTo = "";//"http://kuerstner-xp2/interparts3/snoop.jsp"; 

//-- deprecated -- var standardEmailAddress4SendingBasketByEmail = "d.kuerstner@belenus.com"; // if the HOOK_URL dosn't contain the substring "mailto:" this address will be used 4 sending the email
var sendBasketByEmail = ""; // if this flag is an empty string, the email button won't be displayed

//this flag enables or disables the shop availability
var shoppingEnabled = true;

// the follow vars... have in the basket a special meaning...
// they are flags... if the field is not in the visibleBasketFields.. some other fields are also not shown in the basket View....
// they need to have the names of the fields, which are used in visibleBasketFields.... from this resultant that these names are the same like in the basketFields...
// .....
var partnoField = "partno";
var quantityField = "menge"; // here is the name of the quantity field defined... used by the confirmPopup & the basket for counting up...
var priceField = null; //'price'; // if null: don't display price in basket
var descriptionField = "description";
var ociMasternum = "sap"; // this will later concat with the subNo from the querystring, by calling iparts with oci

var basketFields = new Array(partnoField,quantityField,descriptionField,"PartsURI","sap","price"); // define here all fields which you need in the basket
var basketFields_pl = new Array("menge", "partno", "status", "partdesc", "lang", "currency", "price", "priceqty", "packqty", "splitpack", "available", "replaced", "canorder","PartsURI");
var visibleBasketFields = new Array(quantityField,partnoField,descriptionField); // define here which fields should be visible for the user
var visibleBasketFields_pl = new Array(quantityField, "partno", "partdesc", "currency", "price");

var basketAddressFields = new Array("d_name","d_forename","d_street","d_zipcode","d_city","d_email","b_name","b_forename","b_street","b_zipcode","b_city","b_email", "requestTypes", "despatchTypes", "Note");
var basketAddressFields_pl = new Array("custordref","contact","d_name","d_forename","d_street","d_zipcode","d_city","d_phone","d_firm","pL_titles","otherAddress","acceptTermsOfTrade","dircountry");
var basketNot4VerifyAddressFields = new Array("requestTypes","despatchTypes");

var basketServerSendAwayFields = new Array(quantityField,partnoField,descriptionField);// define here which fields should be send to the server, at ordering the basket
var basketEmailSendAwayFields  = new Array(partnoField,quantityField,descriptionField);// define here which fields should be shown in the email body, at ordering the basket 
//var basketServerSendAwayFields = new Array("menge", "partno", "status", "partdesc", "lang", "currency", "price", "priceqty", "packqty", "splitpack", "available", "replaced", "canorder");// define here which fields should be send to the server, at ordering the basket
//var basketEmailSendAwayFields  = new Array("menge", "partno", "status", "partdesc", "lang", "currency", "price", "priceqty", "packqty", "splitpack", "available", "replaced", "canorder");// define here which fields should be shown in the email body, at ordering the basket 


// sort basket for this field, this field must be defined at the basketFields...
var basketSortField = descriptionField;

// for the field in which should be sort, has a string value use "string" else if it is a num value use "int"!
var basketSortMode = "string";

var basketTax = "19"; // in %; use . eg "17.5"
// var jumpToCatalog
// (1st param) in which field the partsURI is saved
// (2nd param) if it's en|disabled, to jump out of the basket to the SPL...
// (3rd param) which field should have the link... can be also more fields than just one
var jumpToCatalog = new Array("PartsURI",true, new Array(partnoField, descriptionField)); 

// entries to support "composite keys" for identification of items in the basket
// all fields in this variable MUST ALSO BE IN "basketFields" and SHOULD be in "visibleBasketFields"
var basketItemIDFields = new Array(partnoField); 
											 
var belenusBasketConfirmPopupWindow = false; // on adding an item to the basket... should popup a confirm window....

// this flag enables or disables in the basket, that the user has the ability, to put in some userinformations
// & also that in the printviews & at the order page no userinformations will be shown
var basketExtraInfo = true;

// the first array entry defines how the field will be named in the formular, which provides the basket data
// the second array entry includes an other array, in which the single entries for the select box, are be defined. 
// they are mapped with the corresponding entry in the lang.js (ld[requestTypes[0]+'_'+requestTypes[1][index]]).
// if the length of the array, with the select box entries is 0, it doesn't will be displayed
var requestTypes = new Array("requestTypes",new Array("order","request"));

// the first array entry defines how the field will be named in the formular, which provides the basket data
// the second array entry includes an other array, in which the single entries for the select box, are be defined. 
// they are mapped with the corresponding entry in the lang.js (ld[despatchTypes[0]+'_'+despatchTypes[1][index]]).
// if the length of the array, with the select box entries is 0, it doesn't will be displayed
var despatchTypes = new Array("despatchTypes",new Array("openly","forwarding","express"));

// decide about the use of a note field
var displayNoteInBasket = true;

// true -> at startup, the basket will use the saved information out of the cookie, and fullfill itself (*)
// false -> at startup, the basket don't use the cookie information, which save the last basket content.
// *It only works if cookies are activated
var saveCartOnExit = true;

// enable or disable if it's possible to use the server supported basket, 
// (different framesets)
// but if you use a static version, it never will be shown
var serverSupportedBasket = false; 

// if the user is deleting all itmes.. a confirm window will shown
var delAllConfirmDialog = false;

// if the user is deleting one single item.. a confirm window will shown
var delConfirmDialog = false;

// define here the standard frame height of the basket header frame
var basketHeaderFrameHeight = 24;

// subTableFieldsIdentifier
var subTableFieldsIdentifier = "s";

var basketCookieDurationTimeOfValidity = 1800000 ;// in milliseconds (0.5h == 60s x 30 x 1000)

// use interparts Basket (internal) or the 'Salesman'
var useInternalBasket = true; 
// if the salesman is in use (see the flag above), 
// here you can decide which label is pass as parameter ctx to the salesman 
// 0 means the current selected label
// 1 means the label one step over the current selected .... and so on
var useTheLabelXStepsHigherThanCurrentlySelected = 0;

var xmlExportEnabled = false;
var xmlExportFileName = "basket.xml";
var xmlExportContentType = "text/xml";

var runningNumberFormat = "style0"; // currently u can choose between "style0" -> 1) or "style1" -> 001

/*** end basket *************************/


/*** start search ***********************/

// is a Server Supported Search possible, or does the applet handle all?
// used in suche.html in the function doSearch()
var serverSupportedSearch = false;

// for Server Supported Search we need a SearchProcess (the displaying JSP-page)
// used in suche.html in the function makeQS().....
var searchProcess = 'result';

// in which searchfields a search (static search) is possible (also edit the caption in the language dependent file like lang/de_de/lang.js)
var static_searchFields = new Array(
  new Array("searchCaptions0","searchfield=tree:&maxlength=15&inputCheck=alphaNum"),
  new Array("searchCaptions1","searchfield=description&maxlength=15&inputCheck=alphaNum"),
  new Array("searchCaptions2","searchfield=partno&maxlength=15&inputCheck=alphaNum")
);
//
var staticSearchResultFields = new Array("partno","description");
var staticInitSort = "description";
  
// the same like above, but just for the dynamic(extended) search
//maxlength = 40 = default
//inputCheck = ['num'|'alphaNum']
// per esempio -> "query=sachnr&searchfield=sachnr&maxlength=3&inputCheck=num"
var dynamic_searchFields = new Array(
/*  new Array("s_dyn_ext_option0","command=search&query=tsstext&searchfield=tsstext",false,'new Array("command=search&query=sachnr&searchfield=sachnr","command=search&query=sachnr&searchfield=sachnr")')*/ // <-- multiple searchs
  new Array("s_dyn_ext_option1","command=search&query=sachnr&searchfield=sachnr&maxlength=10&inputCheck=num",false,""),
  new Array("s_dyn_ext_option0","command=search&query=tsstext&searchfield=tsstext",false,"")
);  
  
// set here the index of the dropdown box with the different search keys which should be pre selected
var preSelectSearchIndex_static = 2;
var preSelectSearchIndex_dynamic = 0;

// used in the dynamic search, set here the index which should be preselect if the user starts a partno search
var preSelectSearchPartnoIndex = 1;

// the next four vars are used by the "MODE_FLAG" search...    
var searchDescriptionDyn = "command=search&query=tsstext";
var searchPartnoDyn = "command=search&query=sachnr";

var search4SingleIDInTreeQuery = "command=search&query=singleIDJump";

var searchDescriptionStatic = "description";
var searchPartnoStatic = "partno";
    
// ['standard' | null | 'url:relative']
var searchMode = "standard";
//searchMode = "custom/liebherr_search_dyn.js";
//searchMode = null;

// "display js libary" which should use by the search result page for displaying the entries
// relative path please 
// [null | "relative url:"] (default = "js/dyn_search.js")
var searchDisplayFn = null;

// [null | "relative url:"] (default  = "custom/searchresult.css")
var searchDisplayCSS = null;

// define here the standard frame height of the search header frame
var searchHeaderFrameHeight = 18;
    
var cssMapping = new Array(); // give every search result type a mapping to the desired css property, defined at css/searchresult.css
cssMapping['geraetebez'] = "layout2";
cssMapping['fremdbez'] = "layout2";
cssMapping['servicenr'] = "layout2";
cssMapping['tsstext'] = "layout0";
cssMapping['ftext'] = "layout1";
cssMapping['sachnr'] = "layout1";
cssMapping['sachnrde'] = "layout0";

var searchBelowSelectedTreeEntry = null;// false; // true | false | null, if null the image is hidden

/*** end search *************************/


/*** start toolbar **********************/

var shownBtnsWithoutXVL = new Array("Print", "ZoomIn", "ZoomOut", "FitToWin", "FitToWidth", "Lens", "FreeScale", "PrevImg", "MainImg", "NextImg", "ImageList");
var shownBtnsWithXVL = new Array("Print", "MoveHand", "Rotate3d", "ZoomIn", "ZoomOut", "FitToWin", "FitToWidth", "FitToWidthPart", "Lens", "FreeScale", "HideOnePart", "ShowAllParts", "SemiTransparent", "PrevImg", "MainImg", "NextImg", "ImageList");
var customBtns = new Array();
//    customBtns['FitToWidth'] = "belenusHome.DetailFrame.fitToWidth()";

// define here the standard frame height of the toolbar frame
var toolbarFrameHeight = "23";
    
/*** end toolbar ************************/

// the behavior of the ImageView
// possible entries:{ 'always','never','ifAvailable' }
var showImage = "ifAvailable";

// set this to true if you want to display tiff files
// in ImageView
var useTIFFLibrary = true;

// set this to true if you want to display png files
// in ImageView
var usePNGLibrary = true;

// use this flag to activate cookies
// used in cookie.js 
var cookieActivate = true;

// enable or disable that interparts will be recall the last position in the tree
// used in tree.html
// writes by javascript an extra flag in the applet  tag (<param name="treepath" value="'+treepath+'">
// if it set to true
var rememberLastVisited = true;

// contains all available languages
// when passed to an PartsApplet using the "languages"-param, the
// first entry will be the default language
var availableDataLanguages = "de_de,en_gb,fr_fr,es_es";

// contains all available GUI languages
// first entry will be the default language
var availableGUILanguages = "de_de,bg_bg,cs_cz,da_dk,en_gb,es_es,fr_fr,hr_hr,hu_hu,it_it,nl_nl,pl_pl,pt_pt,ro_ro,ru_ru,tr_tr";

// define here the standard frame width of the tree frame
// with which it will be initialize
// this value will be set to the state.js in the var currentTreeFrameWidth which is used for recall the current frame width
var treeFrameWidth = "222"; //pixel

// define here the standard frame height of the partsdrawing frame
var partsDrawingHeight = "62%";

// define here the standard frame height of the header frame
var headerFrameHeight = "25"; //pixel

// define here the standard frame height of the historyBar frame
var historyBarFrameHeight = "17"; //pixel

var initDetailArrangement = "horizontal"; // "horizontal" | "vertical"

var mediaFrameProperty = "neverAvailable"; // "on" | "off" | "neverAvailable" 
var mediaFrame = 35; 

var footnoteFrameProperty = "neverAvailable"; // "on" | "off" | "neverAvailable" 
var footnoteFrame = 18; 

// with this flag u can switch between the both possibilities of sending the cart to the sap-system
// zero (0) means the standard way of sending, a normal html form &
// one (1) means send it as a xml (xml_type="ESAPO")
// used in order.html... for switching...
var oci_sendSwitcher = 0;

// here you can define, the parameters which should not transfer to the oci interface
var unallowedOCIParams = new Array('language', 'dataLanguage','HOOK_URL','login_password','login_username','command','ip_language','range','schemaname','checked','xmlBuiltIn');

// here you can define the properties of the label, how it will be displayed
var maxShownParentLabels = 4; // the number of parents whose labels will be displayed
var maxLengthOfStr = 15; // the max size of the string, before it will cut
var shownDots = 3; // how many dots should be shown, if the string is too long

//enable or disable the possibility to navigate in help with the links in the history bar, 
var labelNavigation = true;

//
displayRoot = false;

// in the follow two variables you can define how often & how fast the basket button will flash
// if something will be added to the basket
var flashs = 2; // how often
var flashDelay = 50; // how fast

// shows the customer, that the basket is already filled
// the small rectangle in the basket button
var fullBasketTwinkle = 10; // how often
var fullBasketDelayOnInit = 250; // how fast

//disable or enable the printServer functionality
// false means off
// true means on 
var printServerSwitcher = false;

// define here, the address of the servlet which handels the print jobs
 var printServerURL = "";

// insert here the names of the windows which sould shonw in the tab registry
var useTabManager = true;
var autoTabMinimize = false;
var tabManagerFrameHeight = 203; // the whole TabManager frame height
var maxTabsSize = 7;
var tabManagerCaptionFrameHeight = 23;
var tabManagerTabBarFrameHeight = 19


/*** generate the dropDownBox  ***\
\*** ~~~~~~~~~~~~~~~~~~ ***/

/*
  1st param allowed values:
    0 - invisible
    1 - visible in both versions
    2 - visible only in the static version
    3 - visible only in the dynamic version
    
  2nd param is the name of the function which should be called at selecting this entry (using a switch statement)
        and also for reach a dicison, if the entry should be shown (e.g. language option, only if more than one language is defined at the preferences.js...)
        A LIST OF SPECIAL BEHAVIOR MENU ENTRIES:
        - divider
        -language
        -printServer
  
*/

var opts = new Array(
  new Array(1, "none"),
  new Array(1, "divider"),
  new Array(1, "tree"),
  new Array(1, "divider"),
  new Array(1, "img"),
  new Array(1, "spl"),
  new Array(1, "imgSpl"),
  new Array(1, "flipArrangement"),
  new Array(1, "divider"),
  new Array(0, "notes"),
  new Array(0, "favs"),
  new Array(1, "divider"),
  new Array(1, "language"),
  new Array(0, "printServer"),
  new Array(1, "filter")
);

// the different print modes
var printModes = new Array(
  "PrintImage",
  "PrintImageAndPartList",
  "PrintImageAndSelectedParts",
  "PrintCutout",
  "PrintCutoutAndPartList",
  "PrintCutoutAndSelectedParts",
  "PrintAllImages",
  "PrintAllImagesAndPartList",
  "PrintAllImagesAndSelectedParts",
  "PrintPartList",
  "PrintSel"
);

// if the note field should show in the print
var showNoteFieldInPrint = true;


//if welcome page is for all languages the same or if different ones should use
// true = use different ones (/lang/??_??/welcome.html)
// false = use always the same (/welcome.html)
var welcomeI18N = true; 

// flag 4 using partslink instead the standard belenus basket
var usePartslinkConnector = false;

//session cookie names
var sessionName = new Array("jsessionid","JSESSIONID","sessionid");

// keep
var keepServerSessionAlive = true;

// logout path
var logoutPath = "../server?command=logout&forward=index.jsp";

// flag 4 using the oci interface
var useOCIInterface = false;

// the following two parameters/definitions "belonging" together
// "attachedMediaOnTreeButNoImage" and "attachedMediaOnTreeOpenUpBehavior".
// If it is wished to include 'special'-files that were attached on the tree into the content frame 
// they must define here in the array, and than add to the Array: attachedMediaOnTreeOpenUpBehavior[]
// e.g.
// attachedMediaOnTreeOpenUpBehavior[".doc"] = "include";
// currently in the standard: ".jpeg",".jpg",".gif",".bmp",".png",".html",".htm",".tiff",".tif"
var attachedMediaOnTreeButNoImage = new Array();//(/*".doc",".pdf"*/);

// Control the Behavior of media-files attached to the tree which were images/files that the browser can display without a plugin
// or special-files defined in the Array above
// e.g.
// attachedMediaOnTreeOpenUpBehavior[".doc"] = "include";
// Currently in the standard: ".jpeg",".jpg",".gif",".bmp",".png",".html",".htm",".tiff",".tif"
// by default all files will exclude
var attachedMediaOnTreeOpenUpBehavior = new Array();
attachedMediaOnTreeOpenUpBehavior[".tif"] = "include";

// if a document is attached to the tree
// and set as 'exclude' in the array above,
// the old content in the content frame will unload, or not
var clearContentFramesThenLoadingADocument = false;

var XVLActive = false;

var showDebugOutput = false;

// loading the application with new gui language by reloading all pages or just the language pack
var softGUILanguageSwitch = true;

var avoidErrorMsg = false;

var csvExportActive = false;

//also need set to true then lexcom images including hotspot informations should be used. Tiff-Images differs.
var useAppletForStandardImageDisplaying = true; 