/************************************************************************
*   
*   G L O B A L  J A V A S C R I P T  F U N C T I O N S
*   
*   Author:  Sarah Bansak
*   Date:    March MMX
*   Web:     http://www.quirkds.com
*   Email:   info@quirkds.com
* 
*************************************************************************/




/*-----------------------------------------------------------------------
Style Switch
------------------------------------------------------------------------*/

// © copyright Sibran Lens
// Leave this comment if you want to use this script for your website
// http://blog.e-ss.be


function CSSTimeSwitch()
{
 datetoday = new Date();
 timenow=datetoday.getTime();
 datetoday.setTime(timenow);
 thehour = datetoday.getHours();

 if (thehour >= 19)
  display = "night";
 else if (thehour >= 7)
  display = "day";
 else
  display = "night";

 var thebody =	document.getElementById("bodyTag");
 
 thebody.className= display;
								

}




/*-----------------------------------------------------------------------
LocalScroll init - * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
------------------------------------------------------------------------*/

jQuery(function( $ ){


	$.localScroll.defaults.axis = 'xy';
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: '#content_box', // Could be a selector or a jQuery object too.
		queue:true,
		duration:1500
	});
	
	/**
	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
	 * also affect the >> and << links. I want every link in the page to scroll.
	 */
	$.localScroll({
		target: '#content_box', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});
});






/*-----------------------------------------------------------------------
Button Animation
------------------------------------------------------------------------*/

$(document).ready(function(){
			$("#box-leftbg").animate({opacity: 0.4,}, 600 );
			$("#box-leftbg").animate({opacity: 0,}, 600 );
			$("#box-middlebg").animate({opacity: 0.3,}, 600 );
			$("#box-middlebg").animate({opacity: 0,}, 600 );
			$("#box-rightbg").animate({opacity: 0.4,}, 600 );
			$("#box-rightbg").animate({opacity: 0,}, 600 );
		$("#box-left").hover(function(){
			$("#box-leftbg").animate({opacity: 0.4,}, 600 );
			$("#box-leftbg").animate({opacity: 0,}, 600 );
		}, function(){}
		);
		
		$("#box-middle").hover(function(){
			$("#box-middlebg").animate({opacity: 0.3,}, 600 );
			$("#box-middlebg").animate({opacity: 0,}, 600 );
		}, function(){}
		);
		
		$("#box-right").hover(function(){
			$("#box-rightbg").animate({opacity: 0.4,}, 600 );
			$("#box-rightbg").animate({opacity: 0,}, 600 );
		}, function(){}
		);
		
	});
	

/*-----------------------------------------------------------------------
Tabs Animation
------------------------------------------------------------------------*/

$(document).ready(function(){
$("#tab_websitesbg").animate({opacity: 0.40,}, 600 );
$("#tab_websitesbg").animate({opacity: 0,}, 600 );
$("#tab_printbg").animate({opacity: 0.40,}, 600 );
$("#tab_printbg").animate({opacity: 0,}, 600 );
$("#tab_logosbg").animate({opacity: 0.40,}, 600 );
$("#tab_logosbg").animate({opacity: 0,}, 600 );
$("#tab_projectsbg").animate({opacity: 0.4,}, 600 );
$("#tab_projectsbg").animate({opacity: 0,}, 600 );
$("#tab_processbg").animate({opacity: 0.4,}, 600 );
$("#tab_processbg").animate({opacity: 0,}, 600 );
$("#tab_pricingbg").animate({opacity: 0.4,}, 600 );
$("#tab_pricingbg").animate({opacity: 0,}, 600 );



		$("#tab_websites").hover(function(){
			$("#tab_websitesbg").animate({opacity: 0.40,}, 600 );
			
		}, function(){
		$("#tab_websitesbg").animate({opacity: 0,}, 600 );
		});
		
		$("#tab_print").hover(function(){
			$("#tab_printbg").animate({opacity: 0.40,}, 600 );
			
		}, function(){
		$("#tab_printbg").animate({opacity: 0,}, 600 );
		});
		
		$("#tab_logos").hover(function(){
			$("#tab_logosbg").animate({opacity: 0.40,}, 600 );
			
		}, function(){
		$("#tab_logosbg").animate({opacity: 0,}, 600 );
		});
		
				$("#tab_projects").hover(function(){
			$("#tab_projectsbg").animate({opacity: 0.4,}, 600 );
			
		}, function(){
		$("#tab_projectsbg").animate({opacity: 0,}, 600 );
		});
		
		$("#tab_process").hover(function(){
			$("#tab_processbg").animate({opacity: 0.4,}, 600 );
			
		}, function(){
		$("#tab_processbg").animate({opacity: 0,}, 600 );
		});
		
		$("#tab_pricing").hover(function(){
			$("#tab_pricingbg").animate({opacity: 0.4,}, 600 );
			
		}, function(){
		$("#tab_pricingbg").animate({opacity: 0,}, 600 );
		});
		
	});
	
	
	
/*-----------------------------------------------------------------------
Slider
------------------------------------------------------------------------*/	

document.getElementsByClassName = function(className)
{
var children = document.getElementsByTagName('*') || document.all;
var elements = new Array();
for (var i = 0; i < children.length; i++)
{
var child = children[i];
var classNames = child.className.split(' ');
for (var j = 0; j < classNames.length; j++)
{
if (classNames[j] == className)
{
elements.push(child);
break;
}
}
}
return elements;
}



$(document).ready(function(){
				//To switch directions up/down and left/right just place a "-" in front of the top/left attribute

				//Caption Sliding (Partially Hidden to Visible)
				$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({height:'350px'},{queue:false,duration:160});
					$("#more_info_bg, #more_info_bg2, #more_info_bg3, #more_info_bg3b, #more_info_bg3c, #more_info_bg4, #more_info_bg5, #more_info_bg6, #more_info_bg7, #more_info_bg8, #more_info_bg9").animate({opacity: 0,}, 600 );
					document.getElementById('more_info').innerHTML = '<h4><a href="http://cariannshimsham.com" target="_blank">visit the website</a></h4>';
					document.getElementById('more_info2').innerHTML = '<h4><a href="http://fairefroufrou.com" target="_blank">visit the website</a></h4>';
					document.getElementById('more_info3').innerHTML = '<h4><a href="http://anecrabtree.com" target="_blank">visit the website</a></h4>';
					document.getElementById('more_info3b').innerHTML = '<h4><a href="http://tomportermusic.com" target="_blank">visit the website</a></h4>';
					document.getElementById('more_info3c').innerHTML = '<h4><a href="http://lakestreetcreamery.com" target="_blank">visit the website</a></h4>';
					document.getElementById('more_info4').innerHTML = '<h5>space</h5>';
					document.getElementById('more_info5').innerHTML = '<h5>space</h5>';
					document.getElementById('more_info6').innerHTML = '<h5>space</h5>';
					document.getElementById('more_info7').innerHTML = '<h5>space</h5>';
					document.getElementById('more_info8').innerHTML = '<h5>space</h5>';
					document.getElementById('more_info9').innerHTML = '<h5>space</h5>';
					
				}, function() {
					
				});
				
				$('.boxgrid.anticaption').hover(function(){
				
				}, function() {
					$(".cover", this).stop().animate({height:'85px'},{queue:false,duration:160});
					$("#more_info_bg, #more_info_bg2, #more_info_bg3, #more_info_bg3b, #more_info_bg3c, #more_info_bg4, #more_info_bg5, #more_info_bg6, #more_info_bg7, #more_info_bg8, #more_info_bg9").animate({opacity: 100,}, 600 );
					document.getElementById('more_info').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info2').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info3').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info3b').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info3c').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info4').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info5').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info6').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info7').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info8').innerHTML = '<h4>see more</h4>';
					document.getElementById('more_info9').innerHTML = '<h4>see more2</h4>';
				});
				
			});
			


/*-----------------------------------------------------------------------
Firefox Mac fix
------------------------------------------------------------------------*/				
 
function hashScroll(){
	$.localScroll.hash({
		target: '#content_box', // Could be a selector or a jQuery object too.
		queue:true,
		duration:1500
	});}

function fixFire()
{
CSSTimeSwitch();
hashScroll();

} 


			
			
/*-----------------------------------------------------------------------
IE
------------------------------------------------------------------------*/				
 
function shadowbox_ie(){

    Shadowbox.init({
        // let's skip the automatic setup because we don't have any
        // properly configured link elements on the page
        skipSetup: true
    });

    // open a welcome message
    Shadowbox.open({
        player:     'iframe',
        title:      'Welcome',
        content:    'ie.html',
        width:      739,
        height:     537
        
    });
    

};

var openShadowbox = function(content, player, title){
    Shadowbox.open({
        content:    content,
        player:     player,
        title:      title
    });
}; 


function fixIE()
{
CSSTimeSwitch();
shadowbox_ie();

} 










