
//Chrome Drop Down Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: June 14th, 06' v2.0

var bb2_={
disappeardelay: 500, //set delay in miliseconds before menu disappears onmouseout
//disablemenuclick: false,
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10); 
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)";
}
else
return
this.swipetimer=setTimeout("bb2_.swipeeffect()", 10);
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px";
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
obj.visibility="visible";
}
else if (e.type=="click")
obj.visibility="hidden";
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0;
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth;
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth;
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset;
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight;
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight+15;
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge;
}
}
return edgeoffset;
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden"; //hide menu
this.clearhidemenu();
if (this.ie||this.firefox){
obj.onmouseout=function(){bb2_.delayhidemenu()};
//obj.onclick=function(){return !bb2_.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID);
this.dropmenuobj.onmouseover=function(){bb2_.clearhidemenu()};
this.dropmenuobj.onmouseout=function(e){bb2_.dynamichide(e)};
this.dropmenuobj.onclick=function(){bb2_.delayhidemenu()};
this.showhide(this.dropmenuobj.style, e);
this.dropmenuobj.x=this.getposOffset(obj, "left");
this.dropmenuobj.y=this.getposOffset(obj, "top");
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px";
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px";
}
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e;
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu();
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu();
},

delayhidemenu:function(){
this.delayhide=setTimeout("bb2_.dropmenuobj.style.visibility='hidden'",this.disappeardelay); //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide);
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a");
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel");
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event;
bb2_.dropit(this,event,this.getAttribute("rel")); 
};
}
}
}
}

}











function bb1_(p){
	
	var url=location.href;
	var title=document.title;
	
if(p == 0){ // do Favorites
	if (window.sidebar)window.sidebar.addPanel(title, url, "");else if(window.opera && window.print){var elem = document.createElement('a');elem.setAttribute('href',url);elem.setAttribute('title',title);elem.setAttribute('rel','sidebar');elem.click();}else if(document.all)window.external.AddFavorite(url, title);
    
} else if (p > 0) { 

window.location.href="http://bookmarkbutton.com/b.php?r="+p+"&u="+encodeURIComponent(url)+"&t="+encodeURIComponent(title);

} else {// do other things
    //delicious
	//wykop
 var bb2=new Array( );
 bb2[0]=['favorites',null];
 bb2[1]=['email',null];
 bb2[2]=['delicious'];//'http://del.icio.us/post?url='+encodeURIComponent(url)];
 bb2[3]=['digg'];//,'http://digg.com/submit?phase=2&url='];
 bb2[4]=['myspace'];//,'http://digg.com/submit?phase=2&url='];
 bb2[5]=['facebook'];//,'http://digg.com/submit?phase=2&url='];
 bb2[6]=['live'];//,'http://digg.com/submit?phase=2&url='];
 bb2[7]=['wykop'];//,'http://www.wykop.pl/dodaj?url='+encodeURIComponent(url)+'&title='+title];
 bb2[8]=['more...'];//,'http://www.wykop.pl/dodaj?url='+encodeURIComponent(url)+'&title='+title];
 //bb2[8]=['gwar','http://www.gwar.pl/DodajGwar.html?u='+encodeURIComponent(url)];
 

	
if(p=='init' && document.getElementById('bb1_')== null){
	
	
	
var mid = document.createElement('div');
mid.id="bb1_";
mid.className="bb2";

var ul = document.createElement('ul');

var li1 = document.createElement('li');
li1.className="t";
li1.innerHTML = '<a href="http://bookmarkbutton.com">by BookmarkButton.com</a>Bookmark & Share';
ul.appendChild(li1);



for (var n = 0; n < bb2.length; n++){
var li = document.createElement('li');
var a = document.createElement('a');
a.href="javascript:bb1_("+n+")";
//	RightDivEdit.onclick = function() { edit(iiD,module) } ;
//var src = "bb/images/"+bb2[n][0]+".gif";
a.innerHTML = "<img src='http://bookmarkbutton.com/images/"+bb2[n][0]+".gif' />"+bb2[n][0];
li.appendChild(a);
ul.appendChild(li);

}
					
mid.appendChild(ul);	
//document.body.appendChild(mid); 
//document.lastChild.firstChild.appendChild(mid);
document.body.insertBefore(mid,document.body.firstChild);




document.writeln("<style>.bb2,a.bb1{margin:0;padding:0;border:0;outline:0;text-decoration:none;text-align:left;}.bb2{position:absolute;top:0;visibility:hidden;z-index:999999;border:1px solid #EEE;padding:1px;font:11px Tahoma,Geneva,Arial,sans-serif;background:#fff}.bb2 ul{margin:0;padding:0;list-style:none;width:246px;display:block}.bb2 li{display:inline;margin:0;padding:0;vertical-align:middle}.bb2 img{border:0;margin-right:4px;vertical-align:middle}.bb2 li.t{padding:3px;display:block;background:#EEE;color:#666}.bb2 a{width:72px;color:#000;margin:0;padding:0;text-decoration:none;float:left;display:inline;line-height:16px;border:1px solid #fff;margin:1px;padding:3px;height:16px;font:11px Tahoma,Geneva,Arial,sans-serif}.bb2 a:hover{text-decoration:none;color:#F00;border:1px solid #ccc}.bb2 .t a{float:right;width:auto;padding:0;margin:1px;border:none;font-size:9px;color:#999}</style>");
}
 
}
}
bb1_('init');