1/** 2* Library of commonly used javascript functions 3**/ 4 5/* Show or hide a section based on the current display state - i.e. toggle the display state */ 6function showhidesection(sectionname) { 7 if(document.getElementById(sectionname).style.display == 'block') { 8 document.getElementById(sectionname).style.display = 'none'; 9 } 10 else { 11 document.getElementById(sectionname).style.display = 'block'; 12 } 13} 14 15/* Hide a section no matter what */ 16function hidesection(sectionname) { 17 document.getElementById(sectionname).style.display = 'none'; 18} 19 20/* Show a section no matter what */ 21function showsection(sectionname) { 22 document.getElementById(sectionname).style.display = 'block'; 23} 24 25/* Confirm an action before proceeding */ 26function confirmAction(confirmtext,nextlink) { 27 var agree=confirm(confirmtext); 28 if(agree) location=nextlink; 29 else return false; 30} 31 32/* Clears search box when clicked on */ 33function clearDefault(el) { if (el.defaultValue==el.value) el.value=""; } 34 35 36 37/** 38* Relocated from cp_head3.php by Stewart B 18/02/2008 39**/ 40 41//Swipe Menu : 1.9 42function Is() { 43 agent = navigator.userAgent.toLowerCase(); 44 this.major = parseInt(navigator.appVersion); 45 this.minor = parseFloat(navigator.appVersion); 46 this.ns = ((agent.indexOf('mozilla') != -1) && 47 (agent.indexOf('spoofer') == -1) && 48 (agent.indexOf('compatible') == -1) && 49 (agent.indexOf('opera') == -1) && 50 (agent.indexOf('webtv') == -1) && 51 (agent.indexOf('hotjava') == -1) && 52 (agent.indexOf("msie") == -1)); 53 this.ns2 = (this.ns && (this.major == 2)); 54 this.ns3 = (this.ns && (this.major == 3)); 55 this.ns4 = (this.ns && (this.major == 4)); 56 this.ns6 = (this.ns && (this.major >= 5)); 57 this.ie = ((agent.indexOf("msie") != -1) && 58 (agent.indexOf("opera") == -1)); 59 this.ie3 = (this.ie && (this.major < 4)); 60 this.ie4 = (this.ie && (this.major == 4) && 61 (agent.indexOf("msie 4") != -1)); 62 this.ie5 = (this.ie && (this.major == 4) && 63 (agent.indexOf("msie 5") != -1) && 64 (agent.indexOf("msie 5.5") == -1) && 65 (agent.indexOf("mac") == -1)); 66 this.iem5 = (this.ie && (this.major == 4) && 67 (agent.indexOf("msie 5.") != -1) && 68 (agent.indexOf("mac") != -1)); 69 this.ie55 = (this.ie && (this.major == 4) && 70 (agent.indexOf("msie 5.5") != -1)); 71 this.ie6 = (this.ie && (this.major == 4) && 72 (agent.indexOf("msie 6") != -1)); 73 this.moz = (agent.indexOf("gecko")!= -1) 74 this.nsdom = (this.ns4 || this.ns6); 75 this.win = (agent.indexOf("win") != -1); 76 this.iestrict = (this.win && this.ie6 && document.compatMode == "CSS1Compat"); 77 this.macstrict = (this.ie5 && this.iemac && document.doctype && document.doctype.name.indexOf(".dtd") != -1); 78 this.strict = (this.iestrict || this.macstrict); 79 this.iemac =(this.iem5); 80 this.iewin = ((this.ie5 && !this.iemac || this.ie55 || this.ie6) && this.win); 81 this.dom = (this.iewin || this.ns6 || this.moz); 82} 83var is = new Is(); 84var css_px = (is.ns4 || is.ie4) ?"" : "px"; 85function menuObj(obj, par, nst, p) { 86 page = new Object(); 87 page.width = (is.ns6 || is.ns6x || is.ns4 || is.moz) ? innerWidth : document.body.clientWidth; 88 page.height = (is.ns6 || is.ns6x || is.ns4 || is.moz) ? innerHeight : document.body.clientHeight; 89 if (!is.ns4) { 90 this.lyr = (is.dom) ? document.getElementById(obj) : document.all[obj]; 91 } else { 92 this.lyr = (!nst) ? document.layers[obj] : document.layers[nst].document.layers[obj]; 93 } 94 this.sty = (!is.ns4) ? this.lyr.style : this.lyr; 95 this.parent = par; 96 this.obj = obj + "SwipeLayer"; 97 eval(this.obj + "= this"); 98} 99menuObj.prototype.timer = null; 100menuObj.prototype.wipe = 0; 101if (is.iemac){ 102menuObj.prototype.offX = Function('oX = this.lyr.offsetLeft -6+-(mAtt.border)+0; return oX'); 103menuObj.prototype.offY = Function('oY = this.lyr.offsetTop-2+-(mAtt.border)+0+(0);return oY;'); 104} else { 105menuObj.prototype.offX = Function('oX = (is.ie || is.ns6x || is.moz) ? this.lyr.offsetLeft : parseInt(this.sty.left);return oX'); 106menuObj.prototype.offY = Function('oY = (is.ie || is.ns6x || is.moz) ? this.lyr.offsetTop : parseInt(this.sty.top);return oY;'); 107} 108menuObj.prototype.offW = Function('oW = (!is.ns4) ? this.lyr.offsetWidth : this.lyr.clip.width; return oW;') 109menuObj.prototype.offH = Function('oH = (!is.ns4) ? this.lyr.offsetHeight : this.lyr.clip.height; return oH;') 110menuObj.prototype.maxWipe = function() { 111 if(is.dom) return this.offH()+10;
112 if(is.ns4) return (sAtt.height*this.lyr.document.layers.length)+10; 113} 114var pd = "padding:0px 6px 0px 6px;" 115wipeMenu.prototype.addMain = function(name, hasSub, txt, url) { 116 menuName = this.name, wipePos = this.pos, mAtt = this.mAtt, sAtt = this.sAtt; 117 var pf = Math.ceil(((mAtt.height-mAtt.font_size)/2)-2); 118 var styStr2 = "position:absolute; visibility:hidden; border:solid 1px "+sAtt.border_color+"; border-width:"+sAtt.border+"px 0px 0px 0px; cursor:default;" 119 if(this.main[name]) return; 120 if(is.ns4) { 121 var mainMenu = new Layer(mAtt.width); 122 var styStr = "text-decoration:none; font-weight:"+mAtt.font_weight+"; z-index:7; color:"+mAtt.fg_off+"; padding:"+((mAtt.height/2)-(mAtt.font_size/2)-1)+"px 0px 0px 0px; font-size:"+mAtt.font_size+"px; font-family:"+mAtt.font+";" 123 mainMenu.document.write('<div align="'+mAtt.align+'" style="'+pd+'"><a href="'+url+'" style="'+styStr+'">'+txt+'</a></div>'); 124 mainMenu.document.close(); 125 var mainMenu1 = new Layer(mAtt.width); 126 mainMenu.captureEvents(Event.MOUSEUP); 127 mainMenu.resizeTo(mAtt.width,mAtt.height+(mAtt.border*2)); 128 if(mAtt.bg_off.indexOf("url") != -1) { 129 mainMenu.background.src = mAtt.bg_off.substring(4,mAtt.bg_off.length-1); 130 mainMenu.background.src = mAtt.bg_off.substring(4,mAtt.bg_off.length-1); 131 } else mainMenu.bgColor = mAtt.bg_off; 132 mainMenu.visibility = "visible"; 133 } 134 if(is.dom) { 135 var mainMenu = document.createElement("DIV"); 136 var wf = (is.ns6x || is.moz || is.strict) ? 12 : 0; 137 var pf2 = (mAtt.height%2 == 0) ? 1 : 0; 138 var styStr = "position:absolute; font-weight:"+mAtt.font_weight+"; z-index:7; width:"+(mAtt.width-wf)+"px; border:solid "+mAtt.border+"px "+mAtt.border_color+"; color:"+mAtt.fg_off+"; text-align:"+mAtt.align+"; font-size:"+mAtt.font_size+"px; font-family:"+mAtt.font+"; padding:"+pf+"px 6px "+(pf+pf2)+"px 6px; background:"+mAtt.bg_off+"; cursor:pointer; cursor:hand;" 139 mainMenu.innerHTML = txt; 140 mainMenu.id = name+menuName; 141 mainMenu.style.cssText = styStr; 142 mainMenu.setAttribute("style", styStr); 143 document.body.appendChild(mainMenu); 144 } 145 if(is.ie4) { 146 var mainMenu = document.createElement("DIV"); 147 var wf = 12; 148 var pf2 = (mAtt.height%2 == 0) ? 1 : 0; 149 var styStr = "position:absolute; font-weight:"+mAtt.font_weight+"; z-index:6; width:"+(mAtt.width-wf)+"px; border:solid "+mAtt.border+"px "+mAtt.border_color+"; color:"+mAtt.fg_off+"; text-align:"+mAtt.align+"; font-size:"+mAtt.font_size+"px; font-family:"+mAtt.font+"; padding:"+pf+"px 6px "+(pf+pf2)+"px 6px; background:"+mAtt.bg_off+"; cursor:pointer; cursor:hand;" 150 mainMenu.innerHTML = txt; 151 mainMenu.id = name+menuName; 152 mainMenu.style.cssText = styStr; 153 mainMenu.setAttribute("style", styStr); 154 document.body.insertAdjacentHTML("beforeEnd", mainMenu); 155 var mainMenu = document.all[name+menuName]; 156 } 157 mainMenu.onmouseover = Function('if('+hasSub+')'+menuName+'.subs["'+name+'"].show("'+wipePos+'"); over_out(this, "'+mAtt.bg_on+'", "'+mAtt.fg_on+'")'); 158 mainMenu.onmouseout = Function('if('+hasSub+')'+menuName+'.subs["'+name+'"].hide();over_out(this, "'+mAtt.bg_off+'", "'+mAtt.fg_off+'")'); 159 mainMenu.onmousedown = Function('location.href = "'+url+'"'); 160 this.main[name] = new menuObj(mainMenu.id); 161 this.mainNum[this.mainNum.length] = this.main[name]; 162 if(!hasSub) return; 163 if(is.ns4) { 164 var subC = new Layer(sAtt.width); 165 subC.resizeTo(175,225); 166 } 167 if(is.dom) { 168 var subC = document.createElement("DIV"); 169 subC.id = name+menuName+"Sub"; 170 var wf = (is.ns6x || is.moz) ? 4 : 0; 171 subC.style.cssText = styStr2; 172 subC.setAttribute("style", styStr2); 173 document.body.appendChild(subC); 174 } 175 if(is.ie4) { 176 var sC = '<div id="'+name+menuName+'Sub" "style="position:absolute; width:120px; height:20px; font-weight:bold; z-index:1;color:red; text-align:left; font-size:12px; font-family:Arial; padding:0px 6px 0px 6px; background:black; cursor:pointer; cursor:hand;"></div>'; 177 document.body.insertAdjacentHTML("beforeEnd", sC); 178 var subC = document.all[name+menuName+"Sub"]; 179 } 180 this.subs[name] = new menuObj(subC.id, this.main[name]); 181 subC.onmouseover = Function(menuName+'.subs["'+name+'"].show("'+wipePos+'");'); 182 subC.onmouseout = Function(menuName+'.subs["'+name+'"].hide();'); 183} 184wipeMenu.prototype.addSub = function(name, parent, txt, url) { 185 var pf2 = (mAtt.height%2 == 0) ? 1 : 0;
186 var pf = Math.ceil(((sAtt.height-sAtt.font_size)/2)-2); 187 if(is.ns4) { 188 var tempsub = new Layer(sAtt.width, this.subs[parent].lyr); 189 var styStr = "text-decoration:none; font-weight:"+sAtt.font_weight+"; color:"+sAtt.fg_off+"; padding:"+((sAtt.height/2)-(sAtt.font_size/2)-2)+"px 0px 0px 0px; font-size:"+sAtt.font_size+"px; font-family:"+sAtt.font+";" 190 tempsub.document.write('<div align="'+sAtt.align+'" style="'+pd+'"><a href="'+url+'" style="'+styStr+'">'+txt+'</a></div>'); 191 tempsub.document.close(); 192 tempsub.captureEvents(Event.MOUSEUP); 193 tempsub.resizeTo(sAtt.width,sAtt.height+(sAtt.border*2)); 194 tempsub.moveTo(0,(sAtt.height*(this.subs[parent].lyr.document.layers.length-1))); 195 if(sAtt.bg_off.indexOf("url") != -1) { 196 tempsub.background.src = sAtt.bg_off.substring(4,sAtt.bg_off.length-1); 197 tempsub.background.src = sAtt.bg_off.substring(4,sAtt.bg_off.length-1); 198 } 199 else tempsub.bgColor = sAtt.bg_off; 200 tempsub.visibility = "inherit"; 201 } 202 if(is.dom) { 203 var tempsub = document.createElement("DIV"); 204 var wf = (is.ns6x || is.moz || is.strict) ? 12 : 0; 205 var styStr = "width:"+(sAtt.width-wf)+"px;font-weight:"+sAtt.font_weight+"; border:solid "+sAtt.border+"px "+sAtt.border_color+"; border-top-width:0px; color:"+sAtt.fg_off+"; text-align:"+sAtt.align+"; font-size:"+sAtt.font_size+"px; font-family:"+sAtt.font+"; padding:"+pf+"px 6px "+(pf+pf2)+"px 6px; background:"+sAtt.bg_off+"; cursor:pointer; cursor:hand;" 206 tempsub.id = name+menuName+"SubItem"; 207 tempsub.innerHTML = txt; 208 tempsub.style.cssText = styStr; 209 tempsub.setAttribute("style", styStr); 210 this.subs[parent].lyr.appendChild(tempsub); 211 } 212 if(is.ie4) { 213 var wf = 12; 214 var tempsub = document.createElement("DIV"); 215 var styStr = "width:"+(sAtt.width-wf)+"px; font-weight:"+sAtt.font_weight+"; border:solid "+sAtt.border+"px "+sAtt.border_color+"; border-top-width:0px; color:"+sAtt.fg_off+"; text-align:"+sAtt.align+"; font-size:"+sAtt.font_size+"px; font-family:"+sAtt.font+"; padding:"+pf+"px 6px "+(pf+pf2)+"px 6px; background:"+sAtt.bg_off+"; cursor:pointer; cursor:hand;" 216 tempsub.id = name+menuName+"SubItem"; 217 tempsub.innerHTML = txt; 218 tempsub.style.cssText = styStr; 219 tempsub.setAttribute("style", styStr); 220 this.subs[parent].lyr.appendChild(tempsub); 221 this.subs[parent].lyr.insertAdjacentHTML("beforeEnd", tempsub); 222 } 223 tempsub.onmouseover = Function('over_out(this, "'+sAtt.bg_on+'", "'+sAtt.fg_on+'")'); 224 tempsub.onmouseout = Function('over_out(this, "'+sAtt.bg_off+'", "'+sAtt.fg_off+'")'); 225 tempsub.onmousedown = Function('location.href = "'+url+'"'); 226 } 227menuObj.prototype.show = function(p) { 228if( is.ie4 && p == "v") { 229 this.sty.left = this.parent.offX()+css_px; 230 this.sty.top = this.parent.offY()+css_px; 231 } else if( is.iemac && p == "v") { 232 this.sty.left = this.parent.offX()+mAtt.width+css_px; 233 this.sty.top = this.parent.offY()+(mAtt.height%2); 234 } else if (p=="h") { 235 this.sty.left = this.parent.offX()+ css_px; 236 this.sty.top = this.parent.offY()+ this.parent.offH()+css_px; 237 } else { 238 this.sty.left = this.parent.offX()+this.parent.offW()+css_px; 239 this.sty.top = this.parent.offY()+css_px; 240 } 241 this.sty.visibility = "visible"; 242 this.sty.zIndex = "7"; 243 this.doShow(); 244} 245menuObj.prototype.doShow = function() { 246 clearTimeout(this.timer); 247 this.timer = setTimeout(this.obj + ".doShow()",100); 248} 249menuObj.prototype.hide = function() { 250 this.sty.visibility = "hidden"; 251 } 252function over_out(obj, bg, fg) { 253 if(is.ns4) { 254 if(bg.indexOf("url") != -1) obj.background.src = bg.substring(4,bg.length-1) 255 else obj.background.src = "", obj.bgColor = bg; 256 } 257 else { 258 if(bg.indexOf("url") != -1) obj.style.backgroundImage = bg; 259 else obj.style.backgroundImage = "url(#FFFFFF)", obj.style.backgroundColor = bg; 260 obj.style.color = fg; 261 } 262} 263wipeMenu.prototype.buildMenu = function(x,y,spacing) { 264 this.mainNum[0].sty.left = x+css_px; 265 this.mainNum[0].sty.top = y+css_px; 266 if(!is.ns4 && spacing == 0) var spacing = -this.mAtt.border; 267 for(i = 1; i < this.mainNum.length; i++) { 268 if(this.pos == "h") { 269 this.mainNum[i].sty.left = this.mainNum[i-1].offX()+this.mainNum[i-1].offW()+spacing+css_px; 270 this.mainNum[i].sty.top = this.mainNum[i-1].offY()+css_px; 271 } else { 272 this.mainNum[i].sty.left = this.mainNum[i-1].offX()+css_px; 273 this.mainNum[i].sty.top = this.mainNum[i-1].offY()+this.mainNum[i-1].offH()+spacing+css_px; 274 } 275 } 276} 277function wipeMenu(menu, p, ma, sa) { 278 this.name = menu; 279 this.pos = p; 280 this.mAtt = ma; 281 this.sAtt = (!sa) ? ma : sa; 282 this.main = []; 283 this.mainNum = []; 284 this.subs = []; 285} 286function macGo(){ 287if (is.iemac) { 288history.go(0); 289} 290} 291if(document.layers) { 292var pX = innerWidth;
293var pY = innerHeight; 294 onresize= function(){ 295 if(pX!= innerWidth || pY!= innerHeight) history.go(0); 296 } 297} 298image1 = new Image() 299image1.src = "/images/go3.gif" 300image2 = new Image() 301image2.src = "" 302image3 = new Image() 303image3.src = "" 304image4 = new Image() 305image4.src = "" 306//M2Preload 307//FinishM2 308 309function Start2(page) { 310OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=yes,scrollbars=no,resizable=no,width=340, height=270"); 311} 312function go() 313{ 314mygoto = "search.php?cat=" + document.forms[1].jcat.value + "~0~10"; 315self.parent.location=mygoto; 316return true; 317} 318function locate(){ 319if (document.searchs.prodid.value.length == 0){ 320 return false; 321}else{ 322 mygoto = "showdetails.php?id=" + document.searchs.prodid.value; 323} 324self.parent.location=mygoto; 325return true; 326} 327function quickfinds(){ 328if (document.search.quicksearch.value.length > 1){ 329 mygoto = "search.php?cat=EVERYTHING~" + document.search.quicksearch.value + "~NULL" + "~0~1000"; 330 self.parent.location=mygoto; 331 return true; 332} 333} 334function subfinds(){ 335if (document.search.jcat.value.length < 1 && document.search.prodcat.value < 1){ 336 return false 337} 338 if (document.search.prodcat.value.length == 0){ 339 mygoto = "search.php?cat=LIKE~" + document.search.jcat.value + "~ALL~0~1000"; 340 }else if (document.search.jcat.value.length == 0){ 341 mygoto = "search.php?cat=CATEGORY~" + "ALL" + "~" + document.search.prodcat.value + "~0~1000"; 342 } else{ 343 mygoto = "search.php?cat=BOTH~" + document.search.jcat.value + "~" + document.search.prodcat.value + "~0~1000"; 344 } 345 self.parent.location=mygoto; 346 return true; 347} 348function MM_swapImgRestore() { //v3.0 349 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; 350} 351function MM_preloadImages() { //v3.0 352 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); 353 var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) 354 if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} 355} 356function MM_findObj(n, d) { //v4.01 357 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 358 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} 359 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 360 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 361 if(!x && d.getElementById) x=d.getElementById(n); return x; 362} 363function MM_swapImage() { //v3.0 364 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) 365 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 366} 367function printPage() { 368 var section = document.getElementById('printSection'); 369 var printPage = document.getElementById('txtLink'); 370 myArgs = 'width=600,' + 'height=400,' + 'location=0,' + 'menubar=1,' + 'resizable=0,' + 'scrollbars=1,' + 'status=0,' + 'titlebar=1,' + 'toolbar=0,' + 'hotkeys=0,' + 'screenx=10,' + 'screeny=10,' + 'left=10,' + 'top=10'; 371 var newWindow = window.open('print.htm','printPage',myArgs);
372 newWindow.document.write('<html><head><link href="http://www.millteksport.com/media/css/forms.css" rel="stylesheet" type="text/css"><link href="http://www.millteksport.com/media/css/print.css" rel="stylesheet" type="text/css"><body bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0" marginheight="0" marginwidth="0" onload="window.print();"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="8" colspan="3"> </td></tr><tr><td width="8"> </td><td><a href="javascript:window.print();"><img border="0" src="media/images/milltek_trans_printable.gif" width="216" height="49"></a></td><td width="8"> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td>' + section.innerHTML + '<br><br></td><td> </td></tr><tr><td> </td><td align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="50%"></td><td width="50%" align="right"><a href="javascript:window.close()" class="close">Close Window</a></td></tr></table></td><td> </td></tr><tr class="underhang_bottom"><td height="19"> </td><td align="center" class="bolden">Printed from: http://www.millteksport.com/index.cfm</td><td> </td></tr></table></body></html>'); } 373 374if (document.images) { 375image1on = new Image(); 376image1on.src = "/images/banner_r2_c2_over.jpg"; 377image1off = new Image(); 378image1off.src = "/images/banner_r2_c2.jpg"; 379} 380function changeImages() { 381if (document.images) { 382for (var i=0; i<changeImages.arguments.length; i+=2) { 383document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src"); 384}}} 385 386function clearQuickText(){ 387 document.search.quicksearch.value = ""; 388} 389 390function clearUserText(){ 391 document.logon.username.value = ""; 392} 393 394function clearPassText(){ 395 document.logon.password.value = ""; 396} 397 398var pos=270; 399function ScrollBestSellers() { 400 if (!document.getElementById) return; 401 obj=document.getElementById("BestSellersText"); 402 pos -=1; 403 if (pos < 0-obj.offsetHeight+0) pos=270; 404 obj.style.top=pos; 405 window.setTimeout("ScrollBestSellers()",25); 406} 407 408function ScrollFeatured() { 409 if (!document.getElementById) return; 410 obj=document.getElementById("FeaturedText"); 411 pos -=1; 412 if (pos < 0-obj.offsetHeight+0) pos=270; 413 obj.style.top=pos; 414 window.setTimeout("ScrollFeatured()",25); 415} 416 417function MM_openBrWindow(theURL,winName,features) { //v2.0 418 window.open(theURL,winName,features); 419}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.