/*
 * 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--;
  });
  
};



jQuery(function(){$ul=jQuery('#slideshow_igallery').hide();jQuery('#slider_igallery').append('<div></div>');$ul.children().each(function(i){jQuery(this).find('img:last').css('margin-right','5px').appendTo(jQuery('#slider_igallery > div:first')).data('full',jQuery(this).find('span:first').text()).attr('inde',i).click(function(){jQuery('#slider_igallery div:first img').removeClass('selected');jQuery(this).addClass('selected');img=jQuery(document.createElement('img'));img.attr({'src':jQuery(this).data('full'),'alt':''});jQuery('#imglink_igallery').empty().append(img);jQuery('#information_igallery h3').empty().append($ul.children().eq(jQuery(this).attr('inde')).find('h3').html());jQuery('#information_igallery p').empty().append($ul.children().eq(jQuery(this).attr('inde')).find('p').html());jQuery('#information_igallery').stop().animate({bottom:0,height:0},400,function(){jQuery(this).animate({bottom:0,height:70},400)});var tOff_left=jQuery(this).offset().left;var tParent=jQuery(this).parent();if(tOff_left>Math.ceil(tParent.width()/1.6))tParent.animate({left:Math.ceil(tParent.position().left-100)},300);if(tOff_left<Math.ceil(tParent.width()/1.6)){if(tParent.position().left>=0){tParent.css('left','0px');return false}tParent.animate({left:Math.ceil(tParent.position().left+100)},300)}});jQuery('#slider_igallery div:first img:first').click()});jQuery('#slideright_igallery').click(function(){totalW=jQuery('#slider_igallery div:first').width();cur_left=jQuery('#slider_igallery div:first').position().left;cur_off=jQuery('#slider_igallery div:first').offset().left;if(parseInt(cur_off)<=parseInt(-60))return false;jQuery('#slider_igallery div:first').stop().animate({left:(cur_left-100)},300)});jQuery('#slideleft_igallery').click(function(){var cur_left=jQuery('#slider_igallery div:first').position().left;if(cur_left>=0){jQuery('#slider_igallery div:first').stop().animate({left:0},100);return false}jQuery('#slider_igallery div:first').stop().animate({left:(cur_left+100)},300,function(){if(cur_left>=0){jQuery('#slider_igallery div:first').stop().animate({left:0},100);return false}})});jQuery('#imgprev_igallery').click(function(){jQuery('#slider_igallery div:first img.selected').prev().click()});jQuery('#imgnext_igallery').click(function(){jQuery('#slider_igallery div:first img.selected').next().click()});jQuery('#wrapper_igallery').show()});

jQuery.noConflict(); jQuery(document).ready(function($){ 

$(".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;}}}
