//------------------------------------------------------------- //-- store.js //------------------------------------------------------------- function ClearSearch() { if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); divs['SearchStr'].value=''; } else SearchStr.value=''; } function IsEmailValid() { var EMAIL_A = 'none' if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); EMAIL_A = divs['IEMAIL'].value; } else EMAIL_A = IEMAIL.value; var AtSym = EMAIL_A.indexOf('@') var Period = EMAIL_A.lastIndexOf('.') var Space = EMAIL_A.indexOf(' ') var Length = EMAIL_A.length - 1 // Array is from 0 to length-1 if ((AtSym < 1) || // '@' cannot be in first position (Period <= AtSym+1) || // Must be atleast one valid char btwn '@' and '.' (Period == Length ) || // Must be atleast one valid char after '.' (Space != -1)) // No empty spaces permitted { alert('Please enter a valid e-mail address!'); if (document.getElementById) divs['IEMAIL'].focus(); else IEMAIL.focus(); } } function strip1(inval) { retval = ""; var oneChar = ""; for (var idx = 0; idx < inval.length; idx++) { oneChar = inval.charAt(idx); if ((oneChar == " ") || (oneChar==",")) { retval = retval + "+"; } else if ((oneChar == "#") || (oneChar=="+") || (oneChar=="%")) { retval = retval + "_"; } else { retval = retval + oneChar; } } return retval; } function stripControlChar(inval) { retval = ""; var oneChar = ""; for (var idx = 0; idx < inval.length; idx++) { oneChar = inval.charAt(idx); if ((oneChar == "\'") || (oneChar=="\"") || (oneChar=="&") || (oneChar=="%") || (oneChar=="+") || (oneChar=="#")) { retval = retval + " "; } else { retval = retval + oneChar; } } return retval; } function MakeIntoParameter(inStr) { retStr = ""; var a1Char = ""; for (var ix = 34; ix < inStr.length-22; ix++) { a1Char = inStr.charAt(ix); if (a1Char == "\'") { retStr = retStr + "@1"; } else if (a1Char == ",") { retStr = retStr + "@2"; } else { retStr = retStr + a1Char; } } return retStr; } function doPopupPPolicy() { url = "http://www.b-f.co.uk/BFL_Privacy_Policy.htm"; width = 500; // width of window in pixels height = 500; // height of window in pixels windowprops = "left=10,top=10,width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes"; preview = window.open(url, "PrivacyPolicy", windowprops); } function doPopupToU() { url = "http://www.b-f.co.uk/BFL_Terms_Of_Use.htm"; width = 500; // width of window in pixels height = 500; // height of window in pixels windowprops = "left=10,top=10,width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes"; preview = window.open(url, "TermsOfUse", windowprops); } function doPopupMailShopping() { url = "http://www.b-f.co.uk/mail_shopping.htm"; width = 540; // width of window in pixels height = 350; // height of window in pixels windowprops = "left=10,top=10,width=" + width + ",height=" + height + ",scrollbars=no,resizable=yes"; preview = window.open(url, "MailShopping", windowprops); } function doPopupMail() { url = "http://www.b-f.co.uk/mail.htm"; width = 540; // width of window in pixels height = 410; // height of window in pixels windowprops = "left=10,top=10,width=" + width + ",height=" + height + ",scrollbars=no,resizable=yes"; preview = window.open(url, "MailShopping", windowprops); } function doXinfo(ManufPartNo) { var PartNo = strip1(ManufPartNo); if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=Display_Extended_Info'"+ PartNo +"','"+divs['fIP'].value+"'&contenttype=text/html"; } else url = "http://businessforce.ltd.uk/S?sql=Display_Extended_Info'"+ PartNo +"','"+fIP.value+"'&contenttype=text/html"; window.location=url; } function doTechSheet(ManufPartNo) { var PartNo = strip1(ManufPartNo); if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=Display_Tech_Sheet'"+ PartNo +"','"+divs['fIP'].value+"'&contenttype=text/html"; } else url = "http://businessforce.ltd.uk/S?sql=Display_Tech_Sheet'"+ PartNo +"','"+fIP.value+"'&contenttype=text/html"; window.location=url; } function doIXinfo(IngPartNo) { var PartNo = strip1(IngPartNo); width = 560; // width of window in pixels height = 480; // height of window in pixels windowprops = "left=10,top=10,width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes"; preview = window.open("http://uk.ingrammicro.com/UK/corporate/jsp/CNet/product.jsp?Lookup="+PartNo+"&customerType=0", "ExtendedInformation", windowprops); } function doDXinfo(IdlPartNo) { var PartNo = strip1(IdlPartNo); width = 590; // width of window in pixels height = 480; // height of window in pixels windowprops = "left=10,top=10,width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes"; preview = window.open("http://pid.ideal.co.uk/product.aspx?product="+PartNo, "ExtendedInformation", windowprops); } function doNotify(ManufPartNo) { var PartNo = strip1(ManufPartNo); if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=eNotifyMe'"+divs['fIP'].value+"','"+PartNo+"'&contenttype=text/html"; } else url = "http://businessforce.ltd.uk/S?sql=eNotifyMe'"+fIP.value +"','"+PartNo +"'&contenttype=text/html"; window.location=url; } function doAC(Action,ManufPartNo) { var PartNo = strip1(ManufPartNo); var Quantity = 1; if (Action == 'A') { alert("ERROR: doAC() ADD called"); } else if (Action == 'C') // Chg quantity { //Quantity = document.basket.elements['Q'+ManufPartNo].value; Quantity = document.forms['Q'+ManufPartNo].elements['Q'+ManufPartNo].value; if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=eCart'C','"+ PartNo +"','"+divs['fIP'].value+"','"+Quantity+"'&contenttype=text/html"; } else url = "http://businessforce.ltd.uk/S?sql=eCart'C','"+ PartNo +"','"+fIP.value+"','"+Quantity+"'&contenttype=text/html"; window.location=url; } else if (Action == 'D') { if (confirm("Are you sure to delete this product?")) { if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=eCart'D','"+ PartNo +"','"+divs['fIP'].value+"','"+Quantity+"'&contenttype=text/html"; } else url = "http://businessforce.ltd.uk/S?sql=eCart'D','"+ PartNo +"','"+fIP.value+"','"+Quantity+"'&contenttype=text/html"; window.location=url; } else document.forms['D'+ManufPartNo].elements['D'+ManufPartNo].checked = false; } else if (Action == 'G') { if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=eCart'G','"+ divs['Qno'].value +"','"+divs['fIP'].value+"'&contenttype=text/html"; } else url = "http://businessforce.ltd.uk/S?sql=eCart'G','"+ Qr.Qno.value +"','"+fIP.value+"'&contenttype=text/html"; window.location=url; } else { if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=eCart'"+ Action +"','"+ PartNo +"','"+divs['fIP'].value+"','"+Quantity+"'&contenttype=text/html"; } else url = "http://businessforce.ltd.uk/S?sql=eCart'"+ Action +"','"+ PartNo +"','"+fIP.value+"','"+Quantity+"'&contenttype=text/html"; window.location=url; } } //------------------------------------------------------------- function RegisterEmail() { if (document.getElementById) { inps = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=SendMail'"+ inps['IEMAIL'].value + "', '', '', '', '" + inps['fax'].value + "', '', '', 'B1'&contenttype=text/html"; } else { url = "http://businessforce.ltd.uk/S?sql=SendMail'"+ document.forms['MailUs'].elements['IEMAIL'].value + "', '', '', '', '" + document.forms['MailUs'].elements['fax'].value + "', '', '', 'B1'&contenttype=text/html"; } document.location = url; } //------------------------------------------------------------- // jobs@b-f.co.uk function Email_Quote(inval) { mprod = strip1(inval); if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url = "http://businessforce.ltd.uk/S?sql=Add_Quote'" +divs['email'].value+ "','"+ mprod +"'&contenttype=text/html"; } else url = "http://businessforce.ltd.uk/S?sql=Add_Quote'" +email.value+ "','"+ mprod +"'&contenttype=text/html"; width = 380; // width of window in pixels height = 230; // height of window in pixels windowprops = "left=10,top=10,width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes,status=yes"; preview = window.open(url, "eMail", windowprops); } function Email_Clear() { if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); divs['email'].value = ""; } else { email.value = ""; } } //------------------------------------------------------------- function Vote(inval) { var RefURL = MakeIntoParameter(window.location.href); if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url="http://businessforce.ltd.uk/S?sql=eVote'" +inval+ "','"+divs['fIP'].value+"','"+RefURL+"'&contenttype=text/html"; } else url="http://businessforce.ltd.uk/S?sql=eVote'" +inval+ "','"+fIP.value+"','"+RefURL+"'&contenttype=text/html"; // Replaced by following AJAX call: window.location=url; /* Set up the request */ var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET', url, true); /* The callback function */ xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if (xmlhttp.status != 200) alert("An error occurred: "+url); // else alert('Done it'); } } /* Send the POST request */ xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(null); if(document.getElementById){ divs = document.getElementsByTagName("div"); divs['VoteMsg'].style.display = "none"; divs['VoteDone'].style.display = "" } else { VoteMsg.style.display = "none"; VoteDone.style.display = ""; } } //------------------------------------------------------------- function DisplayHide(obj, visibility) { ObjShrink = obj + "_S"; ObjExpand = obj + "_E"; if(document.getElementById) { divs = document.getElementsByTagName("div"); divs[obj].style.display = visibility; if ( visibility == "inline" ) { divs[ObjShrink].style.display = "inline"; divs[ObjExpand].style.display = "none"; } else { divs[ObjShrink].style.display = "none"; divs[ObjExpand].style.display = "inline"; } } else { document.elements[obj].style.display = visibility; alert('DisplayHide: review'); if ( visibility == "inline" ) { document.elements[ObjShrink].style.display = "inline"; document.elements[ObjExpand].style.display = "none"; } else { document.elements[ObjShrink].style.display = "none"; document.elements[ObjExpand].style.display = "inline"; } } var RefURL = MakeIntoParameter(window.location.href); if (document.getElementById) { divs = document.getElementsByTagName("INPUT"); url="http://businessforce.ltd.uk/S?sql=eRHSupdate'" +obj+ "','" +visibility+ "','" +divs['fIP'].value+"'&contenttype=text/html"; } else url="http://businessforce.ltd.uk/S?sql=eRHSupdate'" +obj+ "','" +visibility+ "','" +fIP.value+"'&contenttype=text/html"; /* Set up the request */ var xmlhttp = new XMLHttpRequest(); xmlhttp.open('GET', url, true); /* The callback function */ xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if (xmlhttp.status != 200) alert("An error occurred: "+url); // else alert('Done it'); } } /* Send the POST request */ xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(null); }