(function($){var defaults={};var options={};var objCache=[];var mnuCache=[];var mnuOpen=false;var mnuActiv=0;var $mnuActiv=null;$.fn.dropDown=function(ddOpts){options=$.extend(defaults,ddOpts);$.fn.dropDown.buildCache();return this.each(function(){$(this).bind('mouseenter',$.fn.dropDown.events.focus);$(this).bind('mouseleave',$.fn.dropDown.events.blur);});};$.fn.dropDown.events={focus:function(event){var event,aID=$(this).attr('id').split('-'),cacheID=aID[2];if(mnuOpen){$.fn.dropDown.toggleBackground($mnuActiv,mnuActiv,false);$.fn.dropDown.toggleDropDown(mnuActiv,false);}
$.fn.dropDown.toggleBackground($(this),cacheID,true);$.fn.dropDown.toggleDropDown(cacheID,true);$mnuActiv=$(this);mnuActiv=cacheID;mnuOpen=true;$(document).bind('mousemove',$.fn.dropDown.events.blur);},blur:function(event){var event,regexp=/(.*)dropDown(.*)/gi;if($(event.target).attr('id').match(regexp)||$(event.target).attr('class').match(regexp)){return;}else{$mnuActiv.css('color','#fff');$.fn.dropDown.toggleBackground($mnuActiv,mnuActiv,false);$.fn.dropDown.toggleDropDown(mnuActiv,false);$mnuActiv=null;mnuActiv=false;mnuOpen=false;$(document).unbind('mousemove',$.fn.dropDown.events.blur);}}};$.fn.dropDown.toggleBackground=function($obj,cacheID,tBG){var $obj,$parent=$obj.parent(),cacheID,wrapHTML,bgHTML,bgW=0,tBG;if(tBG){if(objCache[cacheID]){bgHTML=objCache[cacheID].bgHTML;}else{bgHTML='<div class="dropDown-bg" id="dropDown-bg-'+cacheID+'" style="width:'+($obj.innerWidth()-10)+'px;"><div class="dropDown-bg-right"></div></div>';objCache[cacheID]={};objCache[cacheID].bgHTML=bgHTML;}
$obj.css('color','#0b5259');$obj.css('background','none');$('.wrap-dropDown').css('left',($parent.offset().left)+'px');$('.wrap-dropDown').css('display','block');$parent.append(bgHTML);return;}
$obj.css('color','#fff');$obj.css('background','url(/assets/img/head-nav-arrow.gif) 100% 18px no-repeat');$('.wrap-dropDown').css('display','none');$('#dropDown-bg-'+cacheID).remove();};$.fn.dropDown.toggleDropDown=function(cacheID,tDD){var cacheID,tDD,ghostW=0,ghostH=0;if(tDD){$('.wrap-dropDown').append('<ul class="dropDown-list" id="dropDown-list-'+cacheID+'">'+mnuCache[cacheID].html+'</ul>');$('.dropDown-ruler-notForUse').append('<ul class="dropDown-list-ghost" id="dropDown-list-'+cacheID+'-ghost">'+mnuCache[cacheID].html+'</ul>');ghostW=$('.dropDown-ruler-notForUse').innerWidth();ghostH=$('.dropDown-ruler-notForUse').innerHeight()
if((ghostW+8)<=($('#dropDown-bg-'+cacheID).innerWidth()+10)){}
$('.wrap-dropDown').css('width',(ghostW+8)+'px').css('height',(ghostH+8)+'px');$('.wrap-dropDown-left').css('height',(ghostH+8)+'px');$('.wrap-dropDown-right').css('height',(ghostH+3)+'px');$('.wrap-dropDown-top').css('width',(ghostW-$('#dropDown-bg-'+cacheID).innerWidth())-3+'px');$('.wrap-dropDown-bottom').css('width',(ghostW-8)+'px');return;}
$('#dropDown-list-'+cacheID).remove();$('#dropDown-list-'+cacheID+'-ghost').remove();};$.fn.dropDown.buildCache=function(){$.each(options.dropDownData,function(key,data){var cB=-1,html=[];mnuCache[key]={};$.each(data,function(keyB,dataB){html[++cB]='<li><a href="'+dataB.url+'" class="dropDown-list-item">';html[++cB]=dataB.name;html[++cB]='</a></li>';});mnuCache[key].html=html.join('');});};})(jQuery);
