(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

jQuery.preLoadImages("<?php bloginfo('template_url'); ?>/images/info.gif", "<?php bloginfo('template_url'); ?>/images/work.gif", "<?php bloginfo('template_url'); ?>/images/loading.gif", "<?php bloginfo('template_url'); ?>/images/this-is-photolink.gif", "<?php bloginfo('url'); ?>/wp-content/plugins/wordpress-gallery-plugin/css/images/loading.gif");

$(window).load(function(){
$('a.control').click(function(){
	url  = $(this).attr("href")
	$(this).toggleClass("active").siblings().removeClass("active");
   var show = this.id;
    $('#mainNav > div.' + show).stop(true,true).slideToggle();
    $('#mainNav > div:not(".'+show+'")').slideUp(function(){
      window.location=url;
    });
    return false;	

});
});

$(document).ready(function(){
	 setTimeout(function(){					   
	 $('#mainNav').slideDown();
	 $('#mainPara').slideUp('slow');
	 }, 4500);
	 
	 $("a#viewServices").click(function(){
	 $('#mainNav').slideDown();
	 $('#mainPara').slideUp('slow');
	 });
});

jQuery(document).ready(function(){
	jQuery(".colorBox").colorbox();
	
	var jQuerygallery = jQuery("a[rel=group1]").colorbox();
	jQuery("a#openGallery").click(function(e){
		e.preventDefault();
		jQuerygallery.eq(0).click();
	});
	
	var jQuerygallery2 = jQuery("a[rel=manifesto]").colorbox();
	jQuery("a#openManifesto").click(function(e){
		e.preventDefault();
		jQuerygallery2.eq(0).click();
	});

	
	jQuery("#playVideo").colorbox({iframe:true, innerWidth:980, innerHeight:551});
	jQuery(".playPortfolioVideo").colorbox({iframe:true, innerWidth:980, innerHeight:551});
	
	jQuery("#playVideo2").colorbox({iframe:true, innerWidth:980, innerHeight:551});
	
	jQuery("#contactPanel-show").click(function () {
		jQuery('#contactPanel').slideToggle();
	});
	
	jQuery("#contactPanel-hide").click(function () {
		jQuery('#contactPanel').slideUp();
	});

});

function mailpage()
{
  mail_str = "mailto:?subject=" + document.title;
  mail_str += "&body= I recommend this page - " + location.href;
  location.href = mail_str;
}

//-------------------------------------------------------------------------------------------------------------------------
//Share with others page links
//-------------------------------------------------------------------------------------------------------------------------
var pageURL = window.location;
var pageTitle = document.title;

function linkedin() {
    var Location = "http://www.linkedin.com/shareArticle?mini=true&url=" + pageURL + "&title=" + pageTitle;
    window.open(Location);
}

function twitter() {
    var Location = "http://twitter.com/home?status=" + pageTitle + pageURL;
    window.open(Location);
}

function facebook() {
    var Location = "http://www.facebook.com/sharer.php?u=" + pageURL + "&t=" + pageTitle;
    window.open(Location);
}


//-------------------------------------------------------------------------------------------------------------------------
// Dropdown Reveal Find Us
//-------------------------------------------------------------------------------------------------------------------------
		
function showHide(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'inline') {
			document.getElementById(shID+'-show').style.display = 'inline';
			document.getElementById(shID).style.display = 'block';
		}
		else {
			document.getElementById(shID+'-hide').style.display = 'inline';
			document.getElementById(shID).style.display = 'none';
			document.getElementById(shID+'-show').style.display = 'block';
		}
	}
}

