
var $j = jQuery.noConflict();
jQuery(document).ready(function() {
	jQuery('#submitNieuws').live('click',function(){
		jQuery.post(
			"http://easypromotions.nl/admin/modules/newsletter/submit.php",
			{
				'email': jQuery('.nieuwsbrief input[name=email]').val(),
				'company': jQuery('.nieuwsbrief input[name=company]').val(),
				'lang': 'nl'
			},
			function(data){
				jQuery('.nieuwsbrief').html(data);
			}
		);
		jQuery.post(
			"http://easypromotions.us4.list-manage.com/subscribe/post?u=1deb86461f1d44355b8864df6&amp;id=6b357911ca",
			{
				'EMAIL': jQuery('.nieuwsbrief input[name=email]').val(),
				'MMERGE1': jQuery('.nieuwsbrief input[name=company]').val()
			}
		);
	});
	jQuery("#main-menu ul li.active, div.he2 h2, div.post input[type=button], .menu_menu_1 ul li.active").each(function(){
		jQuery(this).css('behavior','url(img/pie.htc);');
	});
	jQuery("a[rel^='prettyPhoto']").prettyPhoto();
    jQuery('a.banner_stats').click(function(){
    	jQuery.post("../banner_stats.php",{rel : jQuery(this).attr('rel')},function(data) {
    		// nothing
    	});    
    });
	var exists = false;
	jQuery('.menu_menu_1 ul li').mouseover(function(){
		exists = true;
		if(!jQuery(this).hasClass('active')){
			exists = false;
			jQuery(this).addClass('active');
		}
	}).mouseout(function(){
		if(exists==false)
			jQuery(this).removeClass('active');
	});
	$j('ul#mainmenu li.parent').each(function(){
		$j(this).mouseenter(function(){
			ShowMenu($j(this).find('ul.sub_menu'),250,true);
		}).mouseleave(function(){
			ShowMenu($j(this).find('ul.sub_menu'),250,false);
		});
	});
	$j('ul.sub_menu li.subparent').each(function(){
		$j(this).mouseenter(function(){
			ShowMenu($j(this).find('ul.sub_sub_menu'),250,true);
		}).mouseleave(function(){
			ShowMenu($j(this).find('ul.sub_sub_menu'),250,false);
		});
	});

});
function ShowMenu(el,duration,dir){
	var $el = $j(el);
	xx = $el.attr('id');
	yy = xx.split('_');
	height = yy[1];
	if(dir){
		$el.show().stop().animate({height: height}, {duration: duration,complete:function(){
				$el.css({'visibility':'visible','width':'auto'});
			}
		});
	}else{
		$el.stop().animate({height: 0}, {duration: duration, complete:function (){
	        $el.hide();
	      }
	    });
	}
}

function slideToggle(el, bShow){
	var $jel = $j(el), height = $jel.data("originalHeight"), visible = $jel.is(":visible");

	// if the bShow isn't present, get the current visibility and reverse it
	if( arguments.length == 1 ) bShow = !visible;

	// if the current visiblilty is the same as the requested state, cancel
	if( bShow == visible ) return false;

	//alert(height);
	//height = $jel.innerHeight();
	// get the original height
	if( !height ){
		// get original height
		height = $jel.show().height();
		// update the height
		$jel.data("originalHeight", height);
		// if the element was hidden, hide it again
		if( !visible ) $jel.hide().css({height: 0});
	  }

	  // expand the knowledge (instead of slideDown/Up, use custom animation which applies fix)
	  if( bShow ){
	    $jel.show().animate({height: height}, {duration: 400});
	  } else {
	    $jel.animate({height: 0}, {duration: 400, complete:function (){
	        $jel.hide();
	      }
	    });
	  }
	}
        
