/* --------------------------------------------------------------

  web.js
  * let's fireup the javascript!

-------------------------------------------------------------- */


/* Background Size
-------------------------------------------------------------- */
	function backgroundsize() {
		var contentwidth = $(window).width();
		if ((contentwidth) < '1280'){
			$('html').addClass('w1280');
		}
		if ((contentwidth) > '1280'){
			$('html').removeClass('w1280');
		}
	}

	backgroundsize();

	$(window).bind("resize", function(){
		setTimeout(backgroundsize, 100);
	});


/* Showreel
-------------------------------------------------------------- */
$(document).ready( function() {
	$("#frontpage-showreel").cycle({
    fx: 'fade',
    timeout: 2000,
    speed: 3000,
    pause: 1,
    fit: 1
	});
});


/* Slider
-------------------------------------------------------------- */
$(document).ready(function(){
	$("#frontpage-portfolio").easySlider({
		controlsShow:	false,
		continuous: true
	});
});


/* Tweets
-------------------------------------------------------------- */
$(document).ready(function(){
  $(".bm-tweets").tweet({
    username: "brothersmedia",
    join_text: "auto",
    avatar_size: 32,
    count: 3,
    auto_join_text_default: "<?php _e('[:en]Brothers said,[:nl]Brothers zei,') ?>",
    auto_join_text_ed: "Brothers",
    auto_join_text_ing: "<?php _e('[:en]Brothers was,[:nl]Brothers was,') ?>",
    auto_join_text_reply: "<?php _e('[:en]Brothers replied to,[:nl]Brothers reageerde op,') ?>",
    auto_join_text_url: "<?php _e('[:en]Brothers was checking out,[:nl]Brothers keek naar,') ?>",
    loading_text: "<?php _e('[:en]Loading Tweets...,[:nl]Tweets Laden...,') ?>"
  });
});


/* Portfolio - Author Christopher Wallace -
-------------------------------------------------------------- */
$(document).ready( function() {
	$('.entry-content a span.slide-title').css({
		opacity : '0.0'
	}).parent('a').append('<span class="cover-up"></span>');
	$('.entry-content a').mouseover(function(e){
      jQuery(this).find('img.thumbnail').stop().animate({
	  	marginTop : '-25px'
	  }, 100).parent('a').find('span.slide-title').stop().fadeTo("slow",1.0);
	});
	$('.entry-content a').mouseout(function(e){
      jQuery(this).find('img.thumbnail').stop().animate({
	  	marginTop : '0'
	  }, 100).parent('a').find('span.slide-title').stop().fadeTo("slow",0.0);
	});
});


/* Mobile Apps, Showcase
-------------------------------------------------------------- */
$(document).ready(function(){
	// Engage Showcasereel
	$('div.iphone ul').innerfade({
		speed: 3000,
		timeout: 5000,
		type: 'sequence',
		containerheight: '340px'
	});
});


/* New window
-------------------------------------------------------------- */
$(document).ready( function() {
	$('a[rel="external"]').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});
});
