﻿(function(A){
	var B=jQuery;B.fn.mullinx=function(D){
		var D=B.extend({},B.fn.mullinx.defaults,D);
		var C=new Date().getTime();
		return this.each(function(K,F){
			var L=jQuery(this);
			L.status="bottom";
			var M=L.offset();
			var I={
				w:L.width(),h:L.height()
			};
			var J={};
			var G=L.attr("rev").split(D.separator);
			if(G.length>0&&G[0]!=""){
				var N=B("<div></div>").attr("id","mux_"+K+"_"+C).css({
					position:"absolute",top:M.top+I.h+"px",backgroundColor:"transparent",display:"none",fontFamily:D.fontFamily,letterSpacing:"-0.025em",fontWeight:"bold",fontSize:D.fontSize
				}).bind("mouseleave",function(P){
					N.hide()
				});
				var O='<div><a href="'+L.attr("href")+'" style="color:'+D.color+';display:block;text-decoration:none;white-space:nowrap;" target="'+L.attr("target")+'">'+L.html()+"</a></div>";
				B.each(G,function(){
					var P=this.split(D.sub_separator);
					O+='<div style="margin:2px 0;"><a href="'+B.trim(P[0])+'" style="color:'+D.color+';display:block;text-decoration:none;white-space:nowrap;" target="'+L.attr("target")+'">'+B.trim((P[1]?P[1]:P[0]))+"</a></div>"});
					/*O='<ul style="margin:0;padding:0;list-style:none;list-style-image:none;">'+O+"</ul>";*/
					B(N).roundbox({
						id:"mux_"+K+"_"+C+"_rc",content:O,bgcolor:D.bgcolor,opacity:D.opacity
					});
					N.appendTo(B(document.body));N.find("div a").hover(function(){
						B(this).css({
							"text-decoration":"underline",color:D.hoverColor
						})
					},function(){
						B(this).css({
							"text-decoration":"none",color:D.color
						})
					}).click(function(P){
						N.hide()
					});
					function H(){N.find("div").each(function(){
						A(this).prependTo(A(this).parent())
					})
				}
				function E(P){
					if(P<0){
						if(L.status!="top"){
							H();L.status="top";N.find("div.arrow").css({
								top:J.h+"px",height:"12px"
							}).find("span").eq(0).html("v").css({
								top:"-52px",marginLeft:"11px"
							})
						}
					}
					else{
						if(L.status!="bottom"){
							H();
							L.status="bottom";
							N.find("div.arrow").css({
								top:"-8px",height:"8px"
							}).find("span").eq(0).html("A").css({
								top:"0px",marginLeft:"0px"
							})
						}
					}
				}
				B("<div></div>").addClass("arrow").html('<span style="position:relative;top:0px;margin-left:0px;">A</span>').css({
					position:"absolute",color:D.bgcolor,width:"40px",left:"-15px",top:"-8px",height:"8px",fontSize:"86px",lineHeight:"56px",fontFamily:"Times New Roman",fontWeight:"bold",overflow:"hidden",opacity:D.opacity
				}).appendTo("#"+N.attr("id")+"_rc");
				L.bind("mouseenter",function(Q){M=L.offset();
				N.show();
				J=(J.w)?J:{
					w:N.children("div").eq(0).width(),h:N.children("div").eq(0).height()
				};
				var R=B(window).width()-(M.left+J.w);
				var P=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;
				P=(B(window).height()+P)-(M.top+I.h+J.h);
				E(P);
				N.css({
					left:M.left+(R<0?(R-5):0)+"px",width:J.w+"px",top:(P<0)?(M.top-19-J.h+"px"):(M.top+I.h+"px")
				}).children("div").eq(0).css({
					top:"8px"
				}).children("div.arrow").eq(0).css({
					left:(R<0?(-R):-15)+"px"
				})
			}).bind("mouseleave",function(P){
				if(L.status=="bottom"&&!(P.pageY>=M.top+I.h)){
					N.hide()
				}
				if(L.status=="top"&&!(P.pageY<=M.top)){
					N.hide()
				}
			});
			B(window).resize(function(P){
				M=L.offset();
				N.css({
					top:M.top+I.h+"px"
				})
			})
		}
	})
};
jQuery.fn.roundbox=function(){
	var C=jQuery.extend({
		bgcolor:"#000",color:"#fff"
	},arguments[0]||{});
	var D='<em class="ctl"><b>&bull;</b></em><em class="ct">&nbsp;</em><em class="ctr"><b>&bull;</b></em><em class="cl">&nbsp;</em><em class="c_box">&nbsp;</em><em class="cr">&nbsp;</em><em class="cbl"><b>&bull;</b></em><em class="cb">&nbsp;</em><em class="cbr"><b>&bull;</b></em><div style="z-index:1002;margin:5px;padding:8px;color:'+C.color+';position:relative;">'+C.content+'</div><div style="clear:both;"></div>';
	var E=jQuery("<div>"+D+"</div>").attr("id",C.id).css("position","absolute").appendTo(this).children(".ctl,.ctr,.cbl,.cbr").css({
		width:"6px",height:"6px",color:C.bgcolor,background:"transparent",overflow:"hidden",fontStyle:"normal",zIndex:1
	}).end().find("em").css({
		position:"absolute",zIndex:1001,color:C.bgcolor,opacity:C.opacity
	}).end().find(".ct,.cr,.cb,.cl,.c_box").css("background",C.bgcolor).end().find(".ct").css({
		top:"0",height:"6px",left:"6px",right:"6px"
	}).end().find(".cl").css({
		top:"6px",width:"6px",left:"0",bottom:"6px"
	}).end().find(".c_box").css({
		top:"6px",bottom:"6px",left:"6px",right:"6px"
	}).end().find(".cr").css({
		top:"6px",bottom:"6px",width:"6px",right:"0"
	}).end().find(".cb").css({
		height:"6px",bottom:"0",left:"6px",right:"6px"
	}).end().find(".ctl").css({
		top:"0",left:"0",height:"6px"
	}).end().find(".cbl").css({
		bottom:"0",left:"0"
	}).end().find(".ctr").css({
		top:"0",right:"0",height:"6px"
	}).end().find(".cbr").css({
		bottom:"0",right:"0"
	}).end().find("em b").css({
		position:"absolute",fontSize:"60px",fontFamily:"arial",lineHeight:"16px",fontWeight:"normal",color:C.bgcolor
	}).end().find(".ctl b").css({
		left:"-3px",top:"0px"
	}).end().find(".ctr b").css({
		left:"-12px",top:"0"
	}).end().find(".cbl b").css({
		left:"-3px",top:"-9px",bottom:"0"
	}).end().find(".cbr b").css({
		left:"-12px",top:"-9px",bottom:"0"
	}).end();
	if(jQuery.browser.msie&&jQuery.browser.version<7){
		E.css("background-color",C.bgcolor)
	}
	return this
};
B.fn.mullinx.defaults={
	separator:";",sub_separator:"|",bgcolor:"#97C9DD",color:"#000000",hoverColor:"#00447c",fontSize:"0.8em"
}
})(jQuery);
