function containsDOM(n,t){var i=!1;do{if(i=n==t)break;t=t.parentNode}while(t!=null);return i}function checkMouseEnter(n,t){return n.contains&&t.fromElement?!n.contains(t.fromElement):t.relatedTarget?!containsDOM(n,t.relatedTarget):void 0}function checkMouseLeave(n,t){return n.contains&&t.toElement?!n.contains(t.toElement):t.relatedTarget?!containsDOM(n,t.relatedTarget):void 0}function changeColour(n,t,i){el=document.getElementById(n);var r="#"+toHex(t)+toHex(t)+toHex(t);el.style.backgroundColor=r,t<i?t+=1:t-=1,t!=i&&setTimeout('changeColour("'+n.toString()+'",'+t.toString()+","+i.toString()+");",50)}function toHex(n){var i="0123456789ABCDEF",t;return n<0?"0":n>16?"F":(t=n%16,i.charAt(t))}function closePopUp(){for(sels=document.getElementsByTagName("select"),selI=0;selI<sels.length;selI++)sels[selI].style.visibility="visible";el=document.getElementById("poptpop"),el.style.display="None",changeOpacity("poptBc",8,0),el=document.getElementById("ctl00_ContentPlaceHolder1_selectDD"),el==null&&(el=document.getElementById("ctl00_CP_selectDD")),el!=null&&(el.style.visibility="visible")}function showPopUp(n){reSizePopUp(700,218),changeOpacity("poptBc",0,8),getData(n)}function swapInformation(n){reSizePopUp(700,218),getData(n)}function reSizePopUp(n,t){for(sels=document.getElementsByTagName("select"),selI=0;selI<sels.length;selI++)sels[selI].style.visibility="hidden";var u,f,i=document,e,r;typeof window.scrollWidth!="undefined"?(u=window.scrollWidth,f=window.scrollHeight,e=window.innerHeight,r=window.scrollTop):i.documentElement&&typeof i.documentElement.scrollWidth!="undefined"&&i.documentElement.clientWidth!=0?(u=i.documentElement.scrollWidth,f=i.documentElement.scrollHeight,e=i.documentElement.clientHeight,r=i.documentElement.scrollTop,r==0&&i.body.scrollTop&&(r=i.body.scrollTop)):i.body&&typeof i.body.scrollWidth!="undefined"&&(u=i.body.scrollWidth,f=i.body.scrollHeight,e=i.body.clientHeight,r=i.body.scrollTop),el=document.getElementById("poptBc"),el.style.display="Block",el.style.height=f+"px",el.style.width=u+"px",el=document.getElementById("poptpop"),el.style.display="Block",topwidth=u/2-n/2,topheight=e/2-t/2+r,el.style.width=n+"px",el.style.left=topwidth+"px",el.style.top=topheight+"px",el=document.getElementById("ctl00_ContentPlaceHolder1_selectDD"),el==null&&(el=document.getElementById("ctl00_CP_selectDD")),el!=null&&(el.style.visibility="hidden")}function changeOpacity(n,t,i){var u,r=document;typeof window.scrollWidth!="undefined"?u=window.scrollHeight:r.documentElement&&typeof r.documentElement.scrollWidth!="undefined"&&r.documentElement.clientWidth!=0?u=r.documentElement.scrollHeight:r.body&&typeof r.body.scrollWidth!="undefined"&&(u=r.body.scrollHeight),u>1700&&(t=i),el=document.getElementById(n),el.style.filter="alpha(opacity="+t*10+")",el.style.opacity="0."+t,t<i?t+=1:t>i&&(t-=1),t!=i?setTimeout('changeOpacity("'+n.toString()+'",'+t.toString()+","+i.toString()+");",25):t<=0&&(el=document.getElementById("poptBc"),el.style.display="None")}function serverHtmlReturn(n){n.length>0&&(strArr=n.split("##"),document.getElementById("poptpop").innerHTML=strArr[0],strArr.length>1&&(testEL=document.getElementById("bhTxtI"),testEL!=null&&(testEL.src="/images/basket"+strArr[1]+".jpg",document.getElementById("bhTxtH").innerHTML=strArr[2],document.getElementById("bhTxtP").innerHTML=strArr[3],document.getElementById("bhTxtV").innerHTML=strArr[4])))}function serverHtmlError(){document.getElementById("poptpop").innerText="An error occured whilst communicating. Please retry"}function showLarger(){el=document.getElementById("poptpop"),el.style.top="0px",el=document.getElementById("popt1iX"),el.style.display=="none"?(el.style.display="block",el=document.getElementById("popt1i"),el.style.display="none",reSizePopUp(800,645)):(el.style.display="none",el=document.getElementById("popt1i"),el.style.display="block",reSizePopUp(700,218))}function addToBasket(n){document.getElementById("poptpop").innerHTML="<center><img src='/Images/wait.gif' alt='Waiting...' /></center>",serverHtmlRequest("A"+n.toString(),2)}function getData(n){document.getElementById("poptpop").innerHTML="<center><img style='padding-top:80px' src='/Images/wait.gif' alt='Waiting...' /></center>",serverHtmlRequest("P"+n.toString(),1)}function getPartHistory(n){getDataFromServer(n,"H")}function basketHistory(n){getDataFromServer(n,"B")}function customerHistory(n){getDataFromServer(n,"C")}function basketNotes(n){getDataFromServer(n,"N")}function sortHighlighting(n){lastClickedRow!=null&&(lastClickedRow.parentNode.parentNode.style.background=""),lastClickedRow=n,lastClickedRow!=null&&(lastClickedRow.parentNode.parentNode.style.background="#eeaaaa")}function getPH(n,t){reSizePopUp(800,600),changeOpacity("poptBc",0,8),document.getElementById("poptpop").innerHTML="<center><img style='padding-top:80px' src='/Images/wait.gif' alt='Waiting...' /></center>",PageMethods.getPartHistory(t,"Totals",phCreateTable,vhPerformSearchFailure)}function showPopUp(n){reSizePopUp(700,218),changeOpacity("poptBc",0,8),getData(n)}function getSI(n,t,i,r){reSizePopUp(700,550),changeOpacity("poptBc",0,8),document.getElementById("poptpop").innerHTML="<center><img style='padding-top:80px' src='/Images/wait.gif' alt='Waiting...' /></center>",PageMethods.getSuppInfo(i,r,t,phGenBack,vhPerformSearchFailure)}function changeSO(n,t,i){PageMethods.changeSuggestedPartSupplier(n,t,i,changeSOSuccess,vhPerformSearchFailure)}function changeSOSuccess(){closePopUp()}function getPHYear(n,t){PageMethods.getPartHistory(n,t,phCreateTable,vhPerformSearchFailure)}function getMove(n){reSizePopUp(700,550),changeOpacity("poptBc",0,8),document.getElementById("poptpop").innerHTML="<center><img style='padding-top:80px' src='/Images/wait.gif' alt='Waiting...' /></center>",PageMethods.getMovement(n,phGenBack,vhPerformSearchFailure)}function vhPerformSearchSuccess(n){alert(n)}function phCreateTable(n){html=n.substring(0,n.indexOf("###")),java=n.substring(n.indexOf("###")+3,n.length),document.getElementById("poptpop").innerHTML=html,eval(java)}function phGenBack(n){document.getElementById("poptpop").innerHTML=n}function vhPerformSearchFailure(){alert("An unexpected error has occured whilst searching. Please retry.")}function getDataFromServer(n,t){reSizePopUp(700,300),changeOpacity("poptBc",0,8),document.getElementById("poptpop").innerHTML="<center><img src='/Images/wait.gif' alt='Waiting...' /></center>",serverHtmlRequest(t+n.toString(),3)}function saveBasketNotes(n){var t=document.getElementById("txtArea1");serverHtmlRequest("S"+n+"#"+t.value),closePopUp(),noteElement=document.getElementById("bnoteS"+n),noteElement==null&&(noteElement=document.getElementById("ctl00_CP_CreateNotesHyperLink")),noteElement.innerText=t.value.trim()==""||t.value.trim()=="No notes exist for this basket"?"Create some basket notes":"View basket notes"}function createExploded(n,t){var r,u,f;if(el=document.getElementById(n.replace("ContentPlaceHolder1","CP")),elIM=document.getElementById(t.replace("ContentPlaceHolder1","CP")),getPosition(elIM),offX-=10,offY-=21,explodedString!=""&&el!=null&&elIM!=null)for(mySplit=explodedString.split(","),i=0;i<mySplit.length;i+=3)r=document.createElement("p"),u=mySplit[i],u.substr(0,1)=="#"&&(u=u.substr(1),r.style.background="Red"),r.id="exPl",f=document.createElement("a"),r.style.left=parseInt(offX)+parseInt(mySplit[i+1])+"px",r.style.top=parseInt(offY)+parseInt(mySplit[i+2])+"px",f.href="javascript:showPopUp("+u+");",f.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",r.appendChild(f),el.appendChild(r)}function getPosition(n){n!=null&&(offX+=n.offsetLeft,offY+=n.offsetTop,n.parentElement!=null&&getPosition(n.parentElement))}function repToggle(n){var t=document.getElementById(n);t.style.display=t.style.display=="none"?"block":"none"}function advanceFocus(n,t){if(n.keyCode==13){var i=document.getElementById(t);i==null&&(i=document.getElementById(t.replace("ContentPlaceHolder1","CP"))),i!=null&&i.focus()}}function advanceFocusWait(n,t){n.keyCode==13&&SetControlFocus(t)}function SetControlFocus(n){var t=setTimeout("var control = document.getElementById('"+n+"'); if (control != null) control.focus();",300)}function enterAsTab(n){n.keyCode==13&&(n.keyCode=9)}function markRow(n,t){t?$("#"+n).addClass("highlightRow"):$("#"+n).removeClass("highlightRow")}function toggleMark(n){$("#"+n).toggleClass("highlightRow")}function markBox(n,t){var i=document.getElementById(n),u,r;t&&i.className.indexOf("highlightBox")<0&&(i.className+=" highlightBox",u=i.offsetWidth-2,r=i.offsetHeight-6,i.style.height=r)}function add_map(){var n=new google.maps.LatLng(51.415251,-.530536),r={center:n,zoom:13,mapTypeId:google.maps.MapTypeId.ROADMAP},i=new google.maps.Map(document.getElementById("map_canvas"),r),t=new google.maps.MarkerImage("../images/map_arrow.png",new google.maps.Size(16,16),new google.maps.Point(0,0),new google.maps.Point(8,16)),u=new google.maps.Marker({position:n,map:i,icon:t})}var lastClickedRow,offX=0,offY=0
