var brow = ""; var normalimg = new Image(); normalimg.src = 'images/redtextbox.jpg'; var overimg = new Image(); overimg.src = 'images/new_about.jpg'; var spacerimg = new Image(); spacerimg.src = 'images/spacer.gif'; var disable_report = new Array(); var allowedType = new Array(); var disableEvent = new Array(); var levelPrint = 0; var clickStatus = false; var category_data = ""; //This is hack for displaying mouseover images properly on higher resolution if((screen.width >1024) && (screen.width <=1152)){ var divPosLeft = "100px"; var defaultOffsetLeft = 83; }else if(screen.width > 1152){ var divPosLeft = "80px"; var defaultOffsetLeft = 153; }else{ var divPosLeft = "20px"; var defaultOffsetLeft = 23; } function findPosX(obj){ var curleft = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x) curleft += obj.x; return curleft; } function findPosY(obj){ var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.x) curtop += obj.x; return curtop; } function addMenuItem(contObj, name, url, jsid, cssItemClass, cssContClass, innerCount, level, cnt, counter, filename){ var itemDiv = document.createElement('DIV'); contObj.appendChild(itemDiv); itemDiv.style.width = '118px'; if(level == 1){ var itemDivtop = document.createElement('DIV'); itemDivtop.style.height = '47px'; itemDivtop.style.width = "120px"; itemDivtop.style.position = "absolute"; itemDivtop.style.top = "152px"; //itemDivtop.style.border = "1px solid #ff0000"; itemDivtop.className = 'left'; if(brow == 'ie'){ if(counter == 1){ itemDivtop.style.left = divPosLeft; }else{ itemDivtop.style.left = defaultOffsetLeft + itemDiv.offsetLeft +"px"; } } if(category_data == jsid){ itemDivtop.style.backgroundImage = 'url('+ "binary_data/" + filename + ')'; itemDivtop.style.backgroundRepeat = 'no-repeat'; } itemDiv.appendChild(itemDivtop); itemDiv.className = 'left'; if(category_data == jsid){ itemDiv.style.backgroundImage = 'url(' + overimg.src + ')'; }else{ itemDiv.style.backgroundImage = 'url(' + normalimg.src + ')'; } itemDiv.style.backgroundRepeat = 'no-repeat'; itemDiv.style.height = '49px'; itemDiv.style.width = "118px"; //itemDiv.style.border = "1px solid #ffff00"; } itemDiv.id = jsid; itemDiv.className = cssItemClass; itemDiv.cssItemClass = cssItemClass; itemDiv.level = level; itemDiv.contObj = contObj; itemDiv.innerCount = innerCount; itemDiv.disable = false; if(innerCount > 0) { if(level > 1) { itemDiv.style.backgroundRepeat = 'no-repeat'; itemDiv.style.backgroundPosition = '98% 50%'; itemDiv.style.width = '118px'; } var containerObj = document.createElement('DIV'); containerObj.id = 'cont_' + jsid; if(level > 1) { containerObj.className = 'containerIn'; }else{ containerObj.className = cssContClass; } containerObj.style.zIndex = level; itemDiv.appendChild(containerObj); var returnObj = containerObj; }else{ var returnObj = contObj; } var itemNameDiv = document.createElement('DIV'); itemNameDiv.id = 'name_' + jsid; itemDiv.insertBefore(itemNameDiv, itemDiv.firstChild); if(level==1){ firstItem = 0; tabObj = document.createElement('TABLE'); tabObj.style.width = '100px'; tabObj.align = 'center'; tabObj.style.height = '35px'; tabObj.cellPadding = '1'; var tbodyObj = document.createElement('TBODY'); tabObj.appendChild(tbodyObj); var numRows = tabObj.rows.length; var TrObj = tabObj.insertRow(numRows); var TdObj = TrObj.insertCell(0); var divBotObj = document.createElement('DIV'); if(category_data == jsid){ divBotObj.className = 'divBotselected'; }else{ divBotObj.className = 'divBot'; } divBotObj.id = jsid + 'txt'; divBotObj.innerHTML = name; TdObj.appendChild(divBotObj); itemNameDiv.appendChild(tabObj); }else{ if(name!=''){ if((level==2)&&(firstItem==0)){ var topSpacer = document.createElement('DIV'); topSpacer.style.width = '118px'; topSpacer.style.height = '20px'; topSpacer.style.position = 'absolute'; topSpacer.style.top = topSpacer.style.top - 1; itemNameDiv.appendChild(topSpacer); firstItem = 1; } itemNameDiv.style.textAlign = 'center'; itemNameDiv.style.width = '118px'; itemNameDiv.style.color = '#000000'; itemNameDiv.style.fontSize = '13px'; itemNameDiv.innerHTML = itemNameDiv.innerHTML + ' ' + name; if((level==2)&&(firstItem==0)){ //alert(name); firstItem=1; } } } if(url == '') { itemDiv.disable = true; } var selectObj = document.getElementsByTagName('SELECT'); itemDiv.selectObj = selectObj; itemDiv.itemNameDiv = itemNameDiv; itemDiv.itemDivtop = itemDivtop; itemDiv.onmouseover = function(e){ if(this.disable == true) { return false; } for(var i=0; i1) { this.itemNameDiv.style.color = '#000000'; this.style.backgroundColor = '#CA0D14'; var reqWidth = this.parentNode.offsetWidth - 23; if(reqWidth > this.offsetWidth) { this.style.width = reqWidth; } } if(this.level == 1){ this.style.backgroundImage = 'url(' + overimg.src + ')'; this.style.backgroundRepeat = 'no-repeat'; this.style.height = '43px'; this.style.width = "118px"; this.style.backgroundColor ='#ffffff'; this.itemDivtop.style.backgroundImage = 'url('+ "binary_data/" + filename + ')'; this.itemDivtop.style.height = '47px'; // this.itemDivtop.style.border = '1px solid #ffff00'; this.itemDivtop.style.backgroundRepeat = 'no-repeat'; this.itemDivtop.style.width = '118px'; } var containerObj = document.getElementById('cont_' + this.id); this.className = this.cssItemClass + 'In'; if(containerObj){ containerObj.itemDiv = this; containerObj.style.visibility = 'visible'; containerObj.style.display = 'block'; containerObj.style.color = '#000000'; if(containerObj.childNodes.length > 0) { containerObj.style.marginLeft = '-1px'; } if(this.level == 1) { if(brow == 'saf'){ containerObj.style.top = this.offsetTop + this.offsetHeight + 193; }else{ containerObj.style.top = this.offsetTop + this.offsetHeight + 193; } containerObj.style.left = findPosX(containerObj.parentNode); }else{ containerObj.style.top = this.offsetHeight - 15; containerObj.style.left = this.offsetWidth ; //containerObj.style.border = "1px solid #ff0000"; } containerObj.onmouseover = function(e){ this.itemDiv.className = this.itemDiv.cssItemClass + 'In'; this.style.visibility = 'visible'; } } } itemDiv.onmouseout = function(e){ if(this.disable == true) { return false; } if(this.level > 1) { this.itemNameDiv.style.color = '#000000'; this.style.backgroundColor = '#ED1C24'; } var containerObj = document.getElementById('cont_' + this.id); this.className = this.cssItemClass; for(var i=0; i 0 && this.level > 1) { itemDiv.style.backgroundRepeat = 'no-repeat'; itemDiv.style.backgroundPosition = '98% 50%'; } if(containerObj){ containerObj.itemDiv = this; containerObj.style.visibility = 'hidden'; containerObj.onmouseout = function(e){ this.itemDiv.className = this.itemDiv.cssItemClass; } } } itemDiv.url = url; itemDiv.onclick = function(e) { if(this.disable == true) { return false; } if(clickStatus == false) { if(this.url != '#' && this.url != 'javascript:void(0)'){ clickStatus = true; location.href = this.url; } } }; // itemDiv.style.border = '1px solid #FF0'; // alert(itemDiv.innerHTML); return returnObj; } function loadMenu(){ var contObj = document.getElementById('topmenu'); // contObj.style.position = 'absolute'; var contObj = addMenuItem(contObj, "About Us", "articles.php?link_id=26", 'menu_C01', 'left mainItem', 'container', 1, 1, 7,1,"_"); var contObj = contObj.parentNode.parentNode; var contObj = addMenuItem(contObj, "Demolition & Recycling", "#", 'menu_C02', 'left mainItem', 'container', 3, 1, 6,2,"7_layer1.gif"); var contObj = addMenuItem(contObj, "Concrete Crusher", "articles.php?link_id=1", 'menu_C001', 'subItem', 'container', 1, 2, 1,1,""); var contObj = contObj.parentNode.parentNode; var contObj = addMenuItem(contObj, "Concreting", "articles.php?link_id=2", 'menu_C002', 'subItem', 'container', 1, 2, 0,1,""); var contObj = contObj.parentNode.parentNode; var contObj = contObj.parentNode.parentNode; var contObj = addMenuItem(contObj, "Agricultural Services", "articles.php?link_id=8", 'menu_C03', 'left mainItem', 'container', 1, 1, 5,3,"9_layer2.gif"); var contObj = contObj.parentNode.parentNode; var contObj = addMenuItem(contObj, "Agricultural Machine Hire", "articles.php?link_id=16", 'menu_C04', 'left mainItem', 'container', 1, 1, 4,4,"11_layer3.gif"); var contObj = contObj.parentNode.parentNode; var contObj = addMenuItem(contObj, "Groundworks", "articles.php?link_id=20", 'menu_C05', 'left mainItem', 'container', 1, 1, 3,5,"13_layer4.gif"); var contObj = contObj.parentNode.parentNode; var contObj = addMenuItem(contObj, "Drainage Systems", "articles.php?link_id=25", 'menu_C06', 'left mainItem', 'container', 1, 1, 2,6,"15_layer5.gif"); var contObj = contObj.parentNode.parentNode; var contObj = addMenuItem(contObj, "For Sale", "articles.php?link_id=29", 'menu_C07', 'left mainItem', 'container', 1, 1, 1,7,"17_layer6.gif"); var contObj = contObj.parentNode.parentNode; var contObj = addMenuItem(contObj, "Contact Us", "articles.php?link_id=27", 'menu_C08', 'left mainItem', 'container', 1, 1, 0,8,"19_layer7.gif"); var contObj = contObj.parentNode.parentNode; }