(function($){$.fn.extend({WG_Rotate:function(options){var defaults={type:'cycle',cycle_fx:'fade',cycle_direction:'right',cycle_speed:1500,cycle_timeout:4000,cycle_random:1,cycle_cleartype:false,cycle_cleartype_no_bg:false,content_align:'center',nav_next:'',nav_prev:'',nav_play:'',nav_pause:'',cb:function(){}};var options=$.extend(defaults,options);return $(this).each(function(idx){if($(this).is('*'))
{var counted_li=$(this).find("li").get().length;var all_available_items=$(this).find("img, li").not('li img').get();$(this).empty();var holder_items=$('<div/>');var collection_items=counted_li>0?$(all_available_items).filter('li'):all_available_items;$.each(collection_items,function(){var item_html=counted_li>0?($.trim($(this).html())).length>0?$(this).html():null:$('<img/>').attr({'src':$(this).attr('src'),'border':'0'});if(item_html!=null)
{holder_items.append($('<div/>').addClass('rot_item').append(item_html));}});all_available_items=holder_items.find('div.rot_item');if(all_available_items.length<=1){$.log('Too few items '+options.source_container+"="+all_available_items.length+" items");}
var container_cycle_elements=$('<div/>').addClass('container_cycle_elements').css('overflow','hidden').WG_SizeElemAsElem(this).append(all_available_items.WG_SizeElemAsElem(this));switch(options.type)
{case'cycle':var all_cycle_properties={};var hasNavControls=false;if(($(options.nav_pause)).is('*')&&($(options.nav_play)).is('*')&&($(options.nav_next)).is('*')&&($(options.nav_prev)).is('*'))
{hasNavControls=true;}
$(this).html(container_cycle_elements);var cycle_properties={fx:options.cycle_fx,speed:options.cycle_speed,timeout:options.cycle_timeout,random:hasNavControls?0:options.cycle_random,next:options.nav_next,prev:options.nav_prev,prevNextClick:onPrevNextClickCovering,cleartype:options.cycle_cleartype,cleartypeNoBg:options.cycle_cleartype_no_bg}
var cycle_properties_new;switch(options.cycle_fx)
{case'scrollRight':case'scrollLeft':cycle_properties_new={fx:hasNavControls?"scrollHorz":options.cycle_fx};break;case'scrollDown':case'scrollUp':cycle_properties_new={fx:hasNavControls?"scrollVert":options.cycle_fx};break;case'cover':case'uncover':cycle_properties_new={direction:options.cycle_direction};break;}
$.extend(all_cycle_properties,cycle_properties,cycle_properties_new);$(container_cycle_elements).cycle(all_cycle_properties);if(hasNavControls)
{$(options.nav_pause+", "+options.nav_next+", "+options.nav_prev).click(function(){container_cycle_elements.cycle('pause');return false;});$(options.nav_play).click(function(){container_cycle_elements.cycle('resume');return false;});}
break;case'random':var rndItem=Math.ceil(Math.random()*all_available_items.length)-1;$(this).html(all_available_items[rndItem]);break;}
$(all_available_items).css({'margin':'0px','padding':'0px','text-align':options.content_align});options.cb.call();}});function onPrevNextClickCovering()
{};}});})(jQuery);(function($){$.fn.log=function(msg){if(typeof(console)=="undefined"){console={log:function(){}};}
if(console){console.log("%s: %o",msg,this);}
return this;}})(jQuery);jQuery.log=function(msg){if(typeof(console)=="undefined"){console={log:function(){}};}
if(console){console.log("%s: %o",msg,this);}};(function($){$.fn.WG_SizeElemAsElem=function(elem2imitate){return this.each(function(){$(this).css({'height':$(elem2imitate).height()+'px','width':$(elem2imitate).width()+'px'})});}})(jQuery);(function($){$.fn.WG_CenterText=function(){return this.each(function(){var pos_top_txt=($(elem).height()-$(this).height())/2;$(this).css({'text-align':'center','top':pos_top_txt+'px','position':'absolute','left':'0px','width':$(this).width()+'px'})});}})(jQuery);
