// cufon font conversions
Cufon.replace('.helvetica-neue-53', { fontFamily: 'helvetica-neue-53' });
Cufon.replace('.helvetica-neue-23', { fontFamily: 'helvetica-neue-23' });
Cufon.replace('#info-panel h2', { fontFamily: 'helvetica-neue-23' });
Cufon.replace('#info-panel div.info', { fontFamily: 'helvetica-neue-45' });
Cufon.replace('h1.post-title, h2.post-title', { fontFamily: 'helvetica-neue-23' });
Cufon.replace('#customers p.title', { fontFamily: 'helvetica-neue-53' });
Cufon.replace('#info-panel h3', { fontFamily: 'helvetica-neue-43' });
Cufon.replace('#post-2 .top .link-name', { fontFamily: 'helvetica-neue-53' });
Cufon.replace('#post-2 .top .link-title', { fontFamily: 'helvetica-neue-43' });


$(document).ready(function() {
	// preload over state for btns
	var ckuk_btn_left_over = new Image(); var ckuk_btn_right_over = new Image();
	ckuk_btn_left_over.src = 'http://ckvo.production.tectonic.net.au/assets/images/ckuk-btn-left-over.png';
	ckuk_btn_right_over.src = 'http://ckvo.production.tectonic.net.au/assets/images/ckuk-btn-right-over.png';
	
	$('#client-login-btn').mouseover(function(){
		$(this).attr('src', 'http://ckvo.production.tectonic.net.au/assets/images/media-client-login-over.gif');
		return false;
	});
	$('#client-login-btn').mouseout(function(){
		$(this).attr('src', 'http://ckvo.production.tectonic.net.au/assets/images/media-client-login.gif');
		return false;
	});
	
	// embed flash video player
	/*var flashvars = {};
	var params = { wmode:'transparent', allowscriptaccess:'always' };
	var attributes = { id:'vid', name:'vid' };
	swfobject.embedSWF("http://ckvo.production.tectonic.net.au/assets/swf/ckuk-player.swf?xml_file=http://ckvo.production.tectonic.net.au/assets/xml/ckuk.xml", "vid", "480", "270", "9.0.0", false, flashvars, params, attributes, swfcallback);
	
	function swfcallback(e) {
		//console.log(e.success);
		if (e.success == false) {
			$('#vid object').attr('data', 'http://ckvo.production.tectonic.net.au/assets/videos/screenshot.jpg');
			$('#vid object param[name="src"]').attr('value', 'http://ckvo.production.tectonic.net.au/assets/videos/screenshot.jpg');
			$('#vid object param[name="href"]').attr('value', 'http://ckvo.production.tectonic.net.au/assets/videos/video.mp4');
		}
	}*/
	
	// keep updating shadows for 2 seconds, 10 times per second
	var interval = setInterval(updateShadows, 100);
	setTimeout(function(){ clearInterval(interval); }, 2000);
});


// remove 'selected' attribute from the current nav button, and put it on the newly selected page
function selectPage(page) {
	// reset all links and set clicked item as selected page
	$('#page_navigation ul li').each(function(i) {
		$(this).attr('class', '');

		if ( $(this).children('a').text().toLowerCase() == page) {
			$(this).attr('class', 'selected');
		}
	});
}

function updateShadows() {
	var h = 1;
	if 		($.browser.webkit)	{ h = 1; }
	else if ($.browser.msie)	{ h = 1; }
	
	$('#shadow-left, #shadow-right').css({ 'min-height' : $('#container').height() + h });
}

function highlightCurrentVideo(id) {
	// do nothing
}
