/***************/ function ltrim(argvalue) { while (1) { if (argvalue.substring(0, 1) != " ") break; argvalue = argvalue.substring(1, argvalue.length); } return argvalue; } function check_dropdownVisible() { // check to see how many dropdown list should be visible productcategory = handle.thisproductcategory.value // First dropdown list prodcat = productcategory if (productmain.value != "") { temp = productmain.value.split(';') for (i=0;i < temp.length; i++) { temp2 = temp[i].split('~') if (prodcat == ltrim(temp2[1])) { if (temp2[2] == "Disable Product Area") { hide_dropdown2(); } else { show_dropdown2(); } } } } } function show_dropdown2() { if (DropDown2IsHidden) { span_dropdown2.visibility = "visible" span_dropdown3.top = dropdown3Top } DropDown2IsHidden = false } function hide_dropdown2() { if (DropDown2IsHidden == false) { span_dropdown2.visibility = "hidden" span_dropdown3.top = dropdown3Top+2 } DropDown2IsHidden = true } /***************/ function setproductcategory(){ // productmain = handle.productmain // hidden field displaying all product categories productcategory = handle.thisproductcategory.value // First dropdown list selecttxt = handle.selectlookup // contains all the translation, "Select product catagory", "select product group etc." defaultindexAt = 0 if (productmain.value != ""){ // First set "Select product category" and dotted line txttemp1 = selecttxt.value.split('~') txttemp2 = txttemp1[0] temp = productmain.value.split(';') // productcategory.options.length = 2 // productcategory.options[0].text = txttemp2 // insert default text // productcategory.options[1].text = handle.selectfieldlength.value // insert dotted line to scale the select-box // Fill out the first dropdown list with values // for (i=0;i < temp.length; i++){ // len = productcategory.options.length // productcategory.options.length = ++len // temp2 = temp[i].split('~') // productcategory.options[len-1].text = ltrim(temp2[0]) // productcategory.options[len-1].value = temp2[1] // if (productcategory.options[len-1].value == handle.thisproductcategory.value) // { // defaultindexAt = len-1 // } // } } // productcategory.options.selectedIndex = defaultindexAt } /***************/ function updateproductlist() { productlisttotal = handle.titlelisttotal // content from the third column in the view parentlist = dropdown2 // Second drop down list productname = dropdown3 // Third drop down list if (parentlist.options.selectedIndex == -1) { parentlist.options.selectedIndex = 0 } prodcat = productcategory // value of the first column var parent = parentlist.options[parentlist.options.selectedIndex].text // text of the second column var productlisttemp = productlisttotal.value.split(';') selecttxt = handle.selectlookup defaultindexAt = 0 //check if the dotted line is selected in the parentlist, if so point to the default selection-text if (parentlist.options[parentlist.options.selectedIndex].value ==""){ parentlist.options.selectedIndex = 0 } // First set "Select product group" and dotted line txttemp1 = selecttxt.value.split('~') txttemp2 = txttemp1[2] productname.options.length = 2 productname.options[0].text = txttemp2 // insert default text productname.options[1].text = handle.selectfieldlength.value // insert dotted line to scale the select-box // Update the third drop down list for (i=0; i < productlisttemp.length; i++) { temp2 = productlisttemp[i] temp2 = temp2.split('~') if (temp2.length > 0 ){ temp2[0]= ltrim(temp2[0]) if (temp2[0]==parent && temp2[3]==prodcat) { // insert content in the third dropdown list len = productname.options.length productname.options.length = ++len productname.options[len-1].text = temp2[1] productname.options[len-1].value = temp2[2] if (productname.options[len-1].text == handle.thisproduct.value) { defaultindexAt = len-1 } } } } productname.options.selectedIndex = defaultindexAt if (defaultindexAt !=0) { if (parent !=handle.thisparent.value) { VisitPage() } } } /***************/ function updateparentlist(){ productcategory = handle.thisproductcategory.value // first dropdown list parentlist = dropdown2 // Second drop down list parentlisttotal = handle.parentlisttotal // retreive values from the second column in the view selecttxt = handle.selectlookup defaultindexAt = 0 txttemp1 = selecttxt.value.split('~') txttemp2 = txttemp1[1] var prodcat = productcategory //check if the dotted line is selected in the product-categorylist, if so point to the default selection-text if (prodcat =="") { // productcategory.options.selectedIndex = 0 } var parentlisttemp = parentlisttotal.value.split(';') parentlist.options.length = 2 parentlist.options[0].text = txttemp2 // insert default text parentlist.options[1].text = handle.selectfieldlength.value // insert dotted line to scale the select-box for (i=0; i < parentlisttemp.length; i++){ temp2 = parentlisttemp[i] temp2 = temp2.split('~') if (temp2.length > 0 ){ temp2[0]= ltrim(temp2[0]) if (temp2[0]==prodcat) { len = parentlist.options.length parentlist.options.length = ++len parentlist.options[len-1].text = temp2[1] parentlist.options[len-1].value = temp2[1] if (parentlist.options[len-1].text == handle.thisparent.value) { defaultindexAt = len-1 } } } } // Should this hide the second dropdown list check_dropdownVisible() if (DropDown2IsHidden) { // Second dropdown list is hidden set the selected index to 2 in the second column parentlist.options.selectedIndex = 2 } else { parentlist.options.selectedIndex = defaultindexAt } updateproductlist() } /***************/ function getRef() { var urlParam = location.search; var loc = urlParam.indexOf( "Ref" ); if( loc != -1 ) { var tmp = urlParam.substr( loc ); var tmp2 = tmp.split( "=" ); var findOD = urlParam.indexOf( "OpenDocument'"); if( findOD != -1 ) { var result = "&Ref="+tmp2[ 1 ]; } else { var result = "?OpenDocument&Ref="+tmp2[ 1 ]; } return( result ); } return( "" ); } /***************/ function getRefUID() { var urlParam = location.search; var loc = urlParam.indexOf( "&unid" ); if( loc != -1 ) { var tmp = urlParam.substr( loc ); var tmp2 = tmp.split( "=" ); var findOD = urlParam.indexOf( "OpenDocument'"); if( findOD != -1 ) { var result = "&unid="+tmp2[ 1 ]; } else { var result = "?OpenDocument&unid="+tmp2[ 1 ]; } return( result ); } return( "" ); } function VisitPage(){ productname = dropdown3 selecttxt = handle.selectlookup txttemp1 = selecttxt.value.split('~') txttemp2 = txttemp1[2] i = productname.options.selectedIndex //check if the dotted line is selected in the productlist, if so point to the default selection-text and quit if (productname.options[i].text != txttemp2) { if (productname.options[i].text != handle.selectfieldlength.value) { window.location="/"+handle.path.value+"/"+handle.view.value+"/"+productname.options[i].value+getRef()+getRefUID(); } else { productname.options.selectedIndex = 0 } } } function checkBrowser(){ this.ver=navigator.appVersion /*this.dom=document.getElementById?1:0 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; this.ie4=(document.all && !this.dom)?1:0; this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)*/ return this } bv=new checkBrowser() if (bv.ns5 || bv.ns4) { // Get a reference to first drop down list var handle = document._PRODJAVA // Get a reference to second drop down list var dropdown2 = document.Span_Outer.document.Span_DropDown2.document.forms[0].ParentList // Get a reference to the third drop down list var dropdown3 = document.Span_Outer.document.Span_DropDown3.document.forms[0].ProductName // Get a reference to control the layer setting on the second and third dropdown list // Old var span_dropdown2 = document.Span_Outer.document.Span_DropDown2 var span_dropdown3 = document.Span_Outer.document.Span_DropDown3 var productmain = document.forms[0].productmain var dropdown3Top = span_dropdown3.top } else { // Get a reference to first drop down list var handle = document._PRODJAVA // Get a reference to second drop down list var dropdown2 = document.all.item("ParentList") // Get a reference to the third drop down list var dropdown3 = document.all.item("ProductName") var span_outer = document.all.Span_Outer.style var span_dropdown2 = document.all.Span_DropDown2.style var span_dropdown3 = document.all.Span_DropDown3.style var dropdown3Top = span_dropdown3.top var productmain = handle.productmain } var DropDown2IsHidden = false setproductcategory(); updateparentlist();