/* Page Load Fade-in */
$(document).ready(function(){$(document).ready(function () {$('#page_effect').fadeIn(500);});});

/* Slider Settings */
$().ready(function() {
       $('#coda-slider-1').codaSlider();
   });

/* Image Pre-loading */
$.preloadCssImages = function(settings){
	/*overrideable defaults*/
	settings = jQuery.extend({
		 imgDir: '../css/screen/images'
	}, settings);

	/*dump all the css rules into one string*/
	var sheets = document.styleSheets;
	var cssPile = '';
	for(var i = 0; i<sheets.length; i++){
		var thisSheetRules = document.styleSheets[ i ].cssRules;
		for(var j = 0; j<thisSheetRules.length; j++){
			cssPile+= thisSheetRules[ j ].cssText;
		}
	}
	/*parse string for image urls and load them into the DOM*/
	var allImgs = [];/*new array for all the image urls*/
	var imgUrls = cssPile.match(/[^\/]+\.(gif|jpg|jpeg|png)/g);/*reg ex to get a string of between a "/" and a ".filename"*/
	if(imgUrls != null && imgUrls.length>0 && imgUrls != ''){/*loop array*/
		var arr = jQuery.makeArray(imgUrls);/*create array from regex obj*/	 
		$(arr).each(function(k){
			allImgs[ k ] = new Image(); /*new img obj*/
			allImgs[ k ].src = settings.imgDir +'/'+ this;	
		});
	}
	return allImgs;
}
var imagesToLoad = 
  [
     'coda-nav-left-hover.png', 
     'coda-nav-right-hover.png'
  ];
  
/* Colorbox Prefrences */
$(document).ready(function(){
	$("a[rel='example1']").colorbox();
	$("a[rel='example2']").colorbox({transition:"fade"});
	$("a[rel='example3']").colorbox({transition:"fade"});
	$("a[rel='example4']").colorbox({transition:"fade"});
	$(".example5").colorbox();
	$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
	$(".example7").colorbox({width:"60%", height:"90%", iframe:true});
	$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
	$(".example9").colorbox({
		onOpen:function(){ alert('onOpen: colorbox is about to open'); },
		onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
		onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
		onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
		onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
	});
	
	/* Example of preserving a JavaScript event for inline calls. */
	$("#click").click(function(){ 
		$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
		return false;
	});
});

/* qTip Prefrences */
$(document).ready(function() 
{
   /* By suppling no content attribute, the library uses each elements title attribute by default 
   $('#conservatory a[href]').qtip({ content: '<img src="http://thulethemovie.com/public/images/conservatory-films.png" alt="" />', show: 'mouseover', hide: 'mouseout' });*/
});

/*
CSS Browser Selector v0.3.4 (Sep 29, 2009)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

/* Open Link in New Window */
$(function(){
$('a.new').click(function(){
window.open(this.href);
return false;
});
});

