﻿window.addEvent('domready', function(){
var list = $$('#mpd dd');
list.each(function(element) {
var fx = new Fx.Styles(element, {duration:500, wait:false});
element.addEvent('mouseenter', function(){
fx.start({
'background-color': '#ebefee',
'color': '#f33'
});
element.style.border='1px solid #2e4c53';
element.style.cursor='pointer';
var eih=element.innerHTML;
ddrivetip(eih.replace(/,/g,",<br>") + '<br>Click to this catalogue page.', '166');
});
element.addEvent('mouseleave', function(){
fx.start({
'background-color': '#fff',
'color': '#000'
});
element.style.border='1px solid #fff';
element.style.cursor='default';
hideddrivetip();
});
element.addEvent('click', function(){
window.location.href=element.className+'.html';
});
});


//--
var xdiv=document.createElement("div");
xdiv.id="listdiv";
xdiv.style.cssText='border-bottom:1px solid #8bb;border-left:1px solid #7aa;margin:16px 0 12px 0';
var xdl=document.createElement("dl");
xdl.style.cssText='height:28px';
var divlist = $$('#secatas div');
divlist.each(function(element,i) {
var xdd=document.createElement("dd");
xdd.innerHTML=(element.id).replace(/_/g," ");
xdd.style.cssText=((element.id)?'font-weight:bold;':'')+'display:block;background-color:#f0f6f6;color:#33f;line-height:16px;padding:5px 8px;border:1px solid #7aa;border-left:0;cursor:pointer;float:left';
xdd.onmouseover=function(){
$$('#listdiv dd').each(function(ed){ed.style.backgroundColor='#f0f6f6';ed.style.color='#33f'});
divlist.each(function(et){et.style.display='none'});
xdd.style.backgroundColor='#9c9';
xdd.style.color='#000';
element.style.display='';
ddrivetip('Click to "<strong>' + xdd.innerHTML + '</strong>" index page.');
}
xdd.onmouseout=function(){
hideddrivetip();
}
xdd.onclick=function(){
var af=$$('a.fpa');
window.location.href=af[i].href;
}
xdl.appendChild(xdd);
element.style.display='none';
if (!i) {
xdd.style.backgroundColor='#9c9';
xdd.style.color='#000';
element.style.display=''
}
});


//--
var plist = $$('#secatas p');
plist.each(function(element) {
element.addEvent('mouseenter', function(){
element.style.cssText='background-color:#dee;cursor:default';
});
element.addEvent('mouseleave', function(){
element.style.cssText='background-color:#fff';
});
});


//--
var n_line = $('navline');
var f_tnav = $('ftnav');
if (n_line && f_tnav) {
n_line.style.cssText = 'margin:6px 0 0 0;padding:0 0 12px 12px';
n_line.innerHTML = f_tnav.innerHTML;
if ($('elsemore')) $('elsemore').style.cssText = 'margin-top:-20px';
if (f_tnav.parentNode) f_tnav.parentNode.removeChild(f_tnav);
if ($('cieh').parentNode) $('cieh').parentNode.removeChild($('cieh'));
}

var xss=$('secatas');
xdiv.appendChild(xdl);
if (xss.parentNode) xss.parentNode.insertBefore(xdiv,xss);


//--
var offsetxpoint=0;
var offsetypoint=22;
var ie=document.all;
var ns6=document.getElementById && !document.all;
var enabletip=false;
if (ie||ns6){
var tipobj=document.createElement("div");
tipobj.style.cssText='position:absolute;border:1px solid #363;padding:2px 5px;background:#ffffe0;visibility:hidden;z-index:100;font:11px verdana'; //white-space:nowrap
document.body.appendChild(tipobj);
}
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
}
function ddrivetip(thetext, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px";
tipobj.innerHTML=thetext;
enabletip=true;
return false;
}
}
function positiontip(e){
if (enabletip){
var curX=(ns6) ? e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6) ? e.pageY : event.clientY+ietruebody().scrollTop;
var rightedge=ie&&!window.opera ? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
var bottomedge=ie&&!window.opera ? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;
var leftedge=(offsetxpoint<0) ? offsetxpoint*(-1) : -1000;
if (rightedge<tipobj.offsetWidth)
tipobj.style.left=ie ? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
else if (curX<leftedge)
tipobj.style.left="5px";
else
tipobj.style.left=curX+offsetxpoint+"px";
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie ? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
else
tipobj.style.top=curY+offsetypoint+"px";
tipobj.style.visibility="visible";
}
}
function hideddrivetip(){
if (ns6||ie){
enabletip=false;
tipobj.style.visibility="hidden";
tipobj.style.left="-1000px";
tipobj.style.width='';
}
}
document.onmousemove=positiontip;


//--
var mmm = new Array();
mmm[0] = '\
<dd><a href="resistors.html">RESISTORS</a></dd>\
<dd><a href="piezo-ceramic.html">FILTERS &amp; RESONATORS</a></dd>\
<dd><a href="inductors.html">INDUCTORS &amp; COILS</a></dd>\
';
var wlhsa=window.location.href.split("/");
var whsct=wlhsa[wlhsa.length-1];
var dbk = function(a){this.style.display='block';a.style.backgroundColor='#2E4C53';a.style.color='#fff';a.style.paddingLeft='6px';a.style.paddingRight='7px';a.style.textDecoration='none';};
var dne = function(a){this.style.display='none';a.style.backgroundColor='#fff';a.style.color='#33f';a.style.paddingLeft='0';a.style.paddingRight='13px';a.style.textDecoration='underline';};
$('gtvlk').setStyles('position:relative;z-index:1;');
var nvea = $$('#navline a'); var alft = 12;
nvea.each(function(ak,m){
var thdl = new Element('dl', {'class': 'menudl', 'styles': {'position': 'absolute','zIndex': 999+m,'border': '1px solid #245','padding': '0','backgroundColor': '#fffff8','top': 14,'left': alft}, 'events': {'mouseenter': function(){dbk.bind(thdl)(ak);},'mouseleave': function(){dne.bind(thdl)(ak);}}}).setHTML(mmm[m]).injectAfter(ak);
new Element('div', {'styles': {'position': 'absolute','zIndex': '-1','backgroundColor': '#356','width': thdl.getCoordinates().width,'height': thdl.getCoordinates().height,'top': 3,'left': 3}}).setOpacity(0.5).inject(thdl);
alft+=ak.getCoordinates().width+6;
ak.addEvent('mouseenter', function(){dbk.bind(thdl)(ak);});
ak.addEvent('mouseleave', function(){dne.bind(thdl)(ak);});
});
$$('.menudl a').each(function(a){if(a.href.test(whsct)){a.addClass('c');}});
$$('.menudl').each(function(idl){idl.style.display='none';});


});
