/*
 * Droppy 0.1.2
 * (c) 2008 Jason Frame (jason@onehackoranother.com)
 */
   var startIndex = 900;
jQuery.fn.droppy = function(options) {
    
  options = jQuery.extend({speed: 150}, options || {});
  this.each(function() {
    var root = this, zIndex = 1000;    
    function getSubnav(ele) {
      if (ele.nodeName.toLowerCase() == 'li') {
        var subnav = jQuery('> ul', ele);
        return subnav.length ? subnav[0] : null;
      } else {
        return ele;
      }
    }
    
    function getActuator(ele) {
      if (ele.nodeName.toLowerCase() == 'ul') {
        return jQuery(ele).parents('li')[0];
      } else {
        return ele;
      }
    }
    
    function hide() {
      var subnav = getSubnav(this);
      if (!subnav) return;
      jQuery.data(subnav, 'cancelHide', false);
      setTimeout(function() {
        if (!jQuery.data(subnav, 'cancelHide')) {
          jQuery(subnav).slideUp(options.speed);
        }
      }, 250);
    }
  
    function show() {
      var subnav = getSubnav(this);
      if (!subnav) return;
      jQuery.data(subnav, 'cancelHide', true);
      jQuery(subnav).css({zIndex: zIndex++}).slideDown(options.speed);
      if (this.nodeName.toLowerCase() == 'ul') {
        var li = getActuator(this);
        jQuery(li).addClass('hover');
        jQuery('> a', li).addClass('hover');
      }
    }
   jQuery('ul, li', this).hover(show, hide);
    jQuery('li', this).hover(
						function() { jQuery(this).addClass('hover'); jQuery('> a', this).addClass('hover'); },
      function() { jQuery(this).removeClass('hover'); jQuery('> a', this).removeClass('hover'); }
						);
	jQuery(this).css({"z-index" : startIndex});
	startIndex--;
  });
  
};



(function($){jQuery.fn.wpHCSlider=function(options){opt={speed:500,width:650};var options=$.extend(opt,options);this.each(function(){var $root=$(this);options.width=$root.width();var current_pos=0;var slides=$('.wphpw_hcslider_content',$root).children();var total_slides=slides.length;var content_width=options.width-80;var elem_heights=new Array();slides.wrapAll('<div class="wphpw_hcslider_wrapper"></div>').css({'float':'left','width':content_width});slides.each(function(){elem_heights.push($(this).height())});total_height=Math.max.apply(Math,elem_heights);$root.prepend('<span class="control leftControl">Clicking moves left</span>').append('<span class="control rightControl">Clicking moves right</span>');$('.rightControl',$root).css({'left' : options.width-$('.rightControl',$root).width()-10});wphpw_hcSlider_manageControls(current_pos,$root,total_slides);slides.each(function(){$(this).height(total_height)});total_height=total_height+20;$root.css({'width':options.width,'height':total_height,'overflow':'hidden'});$('.control',$root).height(total_height);$('.wphpw_hcslider_wrapper',$root).css({'width':content_width*(total_slides+1),'height':total_height});$('.control',$root).bind('click',function(){current_pos=($(this).hasClass('rightControl'))?current_pos+1:current_pos-1;wphpw_hcSlider_manageControls(current_pos,$root,total_slides);$('.wphpw_hcslider_wrapper',$root).animate({'marginLeft':(options.width)*(-current_pos)},options.speed)});return this});function wphpw_hcSlider_manageControls(position,rootElem,num_slides){if(position==0){$('.leftControl',rootElem).hide()}else{$('.leftControl',rootElem).show()}if(position==num_slides-1){$('.rightControl',rootElem).hide()}else{$('.rightControl',rootElem).show()}}}})(jQuery);

jQuery.noConflict(); jQuery(document).ready(function($){ 
$('#homeslider_wpHCSlider').wpHCSlider();
var li_ind = 0; $('.wphpw_magpl_3c_ul').children().each(function(){ if(li_ind == 3) { $(this).css('clear','both'); li_ind = 0;} li_ind = li_ind+1; });
$(".page_menu").each(function(){ $(this).find("ul:first").droppy(); });
});
function fixWidth($){content=$("#wp_content");sidebar=$("#wp_sidebar");aditional=$("div.wp_aditional_sidebar");content.width(content.width()-Math.ceil(content.outerWidth(true)-content.outerWidth()));sidebar.width(sidebar.width()-Math.ceil(sidebar.outerWidth(true)-sidebar.outerWidth()));aditional.width(aditional.width()-Math.ceil(aditional.outerWidth(true)-aditional.outerWidth()));} function position_footer($){$footer_inside = $("#container").find("#wp_footer");$footer_outside = $("#wp_footer");if($footer_inside.length > 0 ){return false;}else{if($footer_outside.length == 1 ){total_height = Math.ceil($("#container").outerHeight(true) + $footer_outside.outerHeight(true)); if((total_height + 10) < $(document).height()){ margin_foot = Math.ceil($(document).height() - total_height); $footer_outside.css({"margin-top": margin_foot});}else return false;}}}
