var isIE = !window.getComputedStyle ? true : false; var isIE6 = (isIE && navigator.appVersion.match(/MSIE 6.0/)) ? true : false; var selects = false; oyy_context_id = '2889'; function getWidth(elem){ return elem.offsetWidth; } function init_menu(){ var items = $C('m-item', $('main-menu')); items.each( function(item, index){ item.lnk = $T("A", item)[0]; var dd = $C('dropdown', item); if(dd){ dd = dd[0]; item.dropdown = dd; var dditems = $T('LI', dd); dditems.each( function(dditem, ddindex){ dditem.onmouseover = function(){ this.style.backgroundColor = "#aaa"; } dditem.onmouseout = function(){ this.style.backgroundColor = "transparent"; } if($T('UL', dditem)){ dditem.index = ddindex; create3levelMenu($T('UL', dditem)[0], item); } } ); } item.ddmaxheight = $('main-menu').offsetHeight - 42; item.opened = false; item.onmouseover = function(){ if(this.opened) return; this.opened = true; if(!this.pad){ this.pad = createPad(); } this.pad.style.height = this.offsetHeight + 5 + "px"; this.pad.style.width = this.offsetWidth + "px"; this.insertBefore(this.pad, this.lnk); if(this.dropdown){ this.dropdown.style.display = "block"; if(this.dropdown.offsetHeight < this.ddmaxheight){ this.dropdown.style.height = this.ddmaxheight - 20 + "px"; } this.dropdown.style.width = "auto"; if(this.dropdown.offsetWidth < this.offsetWidth){ this.dropdown.style.width = this.offsetWidth + "px"; } } }; item.onmouseout = function(){ if(!this.opened) return; this.opened = false; this.removeChild(this.pad); if(this.dropdown){ this.dropdown.style.display = "none"; } }; } );//each } function createPad(){ var pad = document.createElement("DIV"); pad.style.position = "absolute"; pad.style.backgroundColor = "#FFF"; pad.style.left = "0"; pad.style.top = "-5px"; if(isIE){ pad.style.filter = "alpha(opacity=50)"; }else{ pad.style.opacity = "0.5"; } return pad; } function create3levelMenu(oUl, parent){ var holder = document.createElement('DIV'); holder.className = "dropdown3"; var menuClone = oUl.cloneNode(true); var trigger = oUl.parentNode; trigger.removeChild(oUl); holder.appendChild(menuClone); parent.appendChild(holder); trigger.dropdown = holder; trigger.dropdown.trigger = trigger; //init items hover var items = $T('LI', trigger.dropdown); items.each( function(item){ item.onmouseover = function(){ this.style.backgroundColor = "#929292"; } item.onmouseout = function(){ this.style.backgroundColor = "transparent"; } } );// /************************/ trigger.onmouseover = function(e){ if(this.opened) return; var ev = window.event || e; var target = ev.srcElement || ev.target; var relTarget = ev.toElement || ev.relatedTarget; this.style.backgroundColor = "#aaa"; this.dropdown.style.display = "block"; var left = getMaxWidth($T('A', this.parentNode)); this.dropdown.style.top = 47 + this.index * 20 + "px"; this.dropdown.style.left = left + 40 + "px"; this.opened = true; this.dropdown.onmouseout = function(e){ var ev = window.event || e; var target = ev.srcElement || ev.target; var relTarget = ev.toElement || ev.relatedTarget; if(relTarget == this.trigger || relTarget == this || _isChild(relTarget, this) || _isChild(relTarget, this.trigger)) return; this.trigger.style.backgroundColor = "transparent"; this.style.display = "none"; this.trigger.opened = false; } } trigger.onmouseout = function(e){ if(!this.opened) return; var ev = window.event || e; var target = ev.srcElement || ev.target; var relTarget = ev.toElement || ev.relatedTarget; if(relTarget == this.dropdown || _isChild(relTarget, this.dropdown) || relTarget == this || _isChild(relTarget, this.dropdown)) return; this.style.backgroundColor = "transparent"; this.dropdown.style.display = "none"; this.opened = false; } } function getMaxWidth(links){ var tempHolder = document.createElement("DIV"); links.each( function(link){ tempHolder.appendChild(link.cloneNode(true)); tempHolder.appendChild(document.createElement("BR")); } ) tempHolder.className = "temp-holder"; document.body.appendChild(tempHolder); var children = $A(tempHolder.childNodes); var maxWidth = 0; children.each( function(kinder){ if(kinder.offsetWidth > maxWidth){ maxWidth = kinder.offsetWidth; } } ); document.body.removeChild(tempHolder); return maxWidth; } function init_auth(){ if(!$('auth-block')) return; var root = $('auth-block'); if(root.className == "second"){ root.openTop = 40; root.closeTop = 150; root.menu_div = $('menu-div'); }else{ root.openTop = -70; root.closeTop = 36; } var btn = $('form-button'); var btnH3 = $T('H3', root)[0]; root.bgr = $C('opacity', root)[0]; root.SECOND_INITIALIZED = false; btn.root = root; btn.opened = false; btn.onclick = toggleForm; if (btnH3) btnH3.onclick = toggleForm.bind(btn); } function closeForm(oDiv){ oDiv.style.top = oDiv.closeTop + "px"//"36px"; oDiv.style.zIndex = 0; if(oDiv.menu_div){ oDiv.menu_div.style.zIndex = 1; } } function openForm(oDiv){ if (document.getElementById('autherror')) { if (document.getElementById('autherror').innerHTML && !oDiv.SECOND_INITIALIZED) { oDiv.bgr.style.height = 200 + "px"; oDiv.openTop += -40; oDiv.SECOND_INITIALIZED = true; } } if(oDiv.menu_div){ oDiv.menu_div.style.zIndex = 0; } oDiv.style.top = oDiv.openTop + "px"; oDiv.style.zIndex = 5; } function toggleForm(){ if(this.opened){ closeForm(this.root); this.opened = false; this.style.backgroundPosition = "left top"; }else{ openForm(this.root); this.opened = true; this.style.backgroundPosition = "left -17px"; } } function init_secondary_menu(){ if(!$('secondary-menu')) return; var items = $C('menu-item', $('secondary-menu')); items.each( function(item){ if($C('dropdown', item)){ item.dropdown = $C('dropdown', item)[0]; var pNode = $T('UL', item.dropdown)[0]; var list_items = $T('LI', item.dropdown); var min_index = 0; list_items.each( function(list_item, index){ if(list_item.parentNode == pNode){ list_item.index = index - min_index; }else{ min_index ++; } if($T('UL', list_item)){ var level3dropdown = $T('UL', list_item)[0]; level3dropdown.className = "level3dropdown"; item.appendChild(level3dropdown); list_item.dropdown = level3dropdown; var ddwidth = getMaxWidth($T('A', list_item.dropdown)); list_item.dropdown.trigger = list_item; list_item.dropdown.style.width = ddwidth + 40 + "px"; list_item.menuHolder = item; list_item.dropdown.onmouseout = function(e){ var ev = window.event || e; var relTarget = ev.toElement || ev.relatedTarget; if(relTarget != this && relTarget != this.trigger && !_isChild(relTarget, this) && !_isChild(relTarget, this.trigger)){ this.style.display = "none"; } } } list_item.onmouseover = function(){ this.style.backgroundColor = "#fceeb6"; if(this.dropdown){ if(!this.dropdown.MOUSE_EVENTS_INITIALIZED){ var dd_items = $T('LI', this.dropdown); dd_items.each( function(dd_item){ dd_item.onmouseover = function(){ this.style.backgroundColor = "#fdf6d0"; } dd_item.onmouseout = function(){ this.style.backgroundColor = "transparent"; } } ) this.dropdown.MOUSE_EVENTS_INITIALIZED = true; } this.dropdown.style.display = "block"; this.dropdown.style.left = this.menuHolder.dropdownWidth + "px"; this.dropdown.style.top = 41 + this.index * 23 + "px"; } } list_item.onmouseout = function(e){ this.style.backgroundColor = "transparent"; if(this.dropdown){ var ev = window.event || e; var relTarget = ev.toElement || ev.relatedTarget; if(relTarget != this && relTarget != this.dropdown && !_isChild(relTarget, this) && !_isChild(relTarget, this.dropdown)){ this.dropdown.style.display = "none"; } } } } ) } item.onmouseover = function(){ this.style.backgroundColor = "#fee493"; if(this.dropdown){ if(isIE6){//IE6 Select Over All Bugfix if(selects){ selects.each(function(select){ select.style.visibility = "hidden"; select.style.position = "relative"; select.style.left = "-1000px"; }); } } this.dropdown.style.display = "block"; this.dropdown.style.top = this.offsetHeight + "px"; var links = $T('A', this.dropdown); var list_items = $T('LI', this.dropdown); var maxLinkWidth = 0; links.each( function(link){ if(link.offsetWidth > maxLinkWidth){ maxLinkWidth = link.offsetWidth; } } );// this.dropdown.style.width = maxLinkWidth + 40 + "px"; if(isIE6){ list_items.each( function(l_item){ l_item.style.width = maxLinkWidth + 18 + "px"; if(l_item.dropdown){ l_item.style.paddingTop = 6 + "px"; } } ); } this.dropdownWidth = maxLinkWidth + 40; } } item.onmouseout = function(e){ var ev = window.event || e; var relTarget = ev.toElement || ev.relatedTarget; if(relTarget == this || _isChild(relTarget, this)){ return; } this.style.backgroundColor = "transparent"; if(isIE6){//IE6 Select Over All Bugfix if(selects){ selects.each(function(select){ select.style.visibility = "visible"; select.style.position = "static"; select.style.left = "0"; }); } } if(this.dropdown){ this.dropdown.style.display = "none"; } } } ); } function fixPNG(){ var items = $C('png'); if(!items) return; items.each( function(item){ var pngImage = item.src.substring(item.src.lastIndexOf('\/') + 1); var src = item.src; item.src = item.src.replace(pngImage, "blank.gif"); item.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale'"; setTimeout(function(){this.style.visibility = 'visible';}.bind(item), 20); } ); } function fix_tables(){ try{ var tables = $T('TABLE', $('text-content')); tables.each( function(table){ var trs = $T('tr', table); trs.each( function(tr){ var tds = $T('TD', tr); tds.last().style.borderRight = 'none'; } ) } ); }catch(e){ }//try-catch } window.onload = function(){ init_menu(); init_auth(); init_secondary_menu(); if(isIE6){ fixPNG(); } closeForm($('auth-block')); if($('text-content')){ selects = $T('SELECT', $('text-content')); } //fix_tables(); }