/*NOTES ---------------------------------

misc javascript

UPDATE INFO ------------------------

Revision number: 1.0.0
Last updated: 12.11.2008
Last update made by: Michael Andrew (michael@hazardmedia.co.nz)

*/

$(document).ready(function(){

//table row striping
$(".stripeMe tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
$(".stripeMe tr:even").addClass("alt");


// set up sIFR header replacement
	// note: HEX shorthand for colour values cannot be used here
	
	$('h1').sifr( {  strSWF: './swf/dinengschriftlt.swf', strColor: '#000000', strWmode: 'transparent' } );
	$('h2').sifr( {  strSWF: './swf/dinengschriftlt.swf', strColor: '#666666', strWmode: 'transparent' } );
	$('blockquote').sifr( {  strSWF: './swf/dinengschriftlt.swf', strColor: '#666666', strWmode: 'transparent' } );
	//$('#pageTitle p').sifr( {  strSWF: './swf/dinengschriftlt.swf', strColor: '#333333', strWmode: 'transparent' });

// Navigation rollovers

$('#nav li a').mouseover(function(){
								  	$('#pageTitle p').text($(this).attr('title'));
									//$('#pageTitle p').sifr( {  strSWF: './swf/dinengschriftlt.swf', strColor: '#333333', strWmode: 'transparent' });
								  });
$('#nav li a').mouseout(function(){
								  	$('#pageTitle p').text($('#nav li a.selected').attr('title'));
									//$('#pageTitle p').sifr( {  strSWF: './swf/dinengschriftlt.swf', strColor: '#333333', strWmode: 'transparent' });
								  });
$('#nav li a').click(function(){
							  	$('#nav li a').removeClass('selected');
								$(this).addClass('selected');
							  });

$('.sidebar li a').mouseover(function(){
								  	$('#pageTitle p').text($(this).attr('title'));
									//$('#pageTitle p').sifr( {  strSWF: './swf/dinengschriftlt.swf', strColor: '#333333', strWmode: 'transparent' });
								  });
$('.sidebar li a').mouseout(function(){
								  	$('#pageTitle p').text($('#nav li a.selected').attr('title'));
									//$('#pageTitle p').sifr( {  strSWF: './swf/dinengschriftlt.swf', strColor: '#333333', strWmode: 'transparent' });
								  });
$('.sidebar li a').click(function(){
							  	$('#nav li a').removeClass('selected');
								$('#nav li a').filter('[href='+$(this).attr('href')+']').addClass('selected');
							  });

//alert('loading flash');
	
	//load monitor
	$("#monitor").flashembed( { 
  		src: 'swf/monitor.swf', 
  		version: [9,0,28,0],
		width: 330,
		height: 330,
		wmode: 'transparent'
		
  });

	//load behind the mask swf
	$("#swf_behind_the_mask").flashembed( { 
  		src: 'slideshow_behind_the_mask.swf', 
  		version: [9,0,28,0],
		width: 530,
		height: 300
		
  });
	
	//load a last stand swf
	$("#swf_a_last_stand").flashembed( { 
  		src: 'slideshow_a_last_stand.swf', 
  		version: [9,0,28,0],
		width: 530,
		height: 300
		
  });
	
	//load northgate swf
	$("#swf_northgate").flashembed( { 
  		src: 'slideshow_northgate.swf', 
  		version: [9,0,28,0],
		width: 530,
		height: 390
		
  });
	
	
var callback = function(e, delta) {
    console.log(e.pageX, e.pageY, delta);

    // optionally you can prevent default behavior
    e.stopPropagation();
    e.preventDefault();
	if (delta == 1){
		$.scrollTo( '+=150px', 1, { axis: 'x'} );
	}else if (delta == -1){
		$.scrollTo( '-=150px', 1, { axis: 'x'} );	
	}
};

$('body').mousewheel(callback);

$('#nav ul li a').click(function(e){
								 	//override default click behaviour
								 	e.stopPropagation();
    								e.preventDefault();
								 });

$('#nav ul li a').click(function(e){
								 	
								 });

$('.next').click(function(e){ 
							//override default click behaviour
							e.stopPropagation();
							e.preventDefault();  
							if( $(this).hasClass('disabled') ){
							}else{
								$.scrollTo( $(this).parent().parent().parent().parent().next(), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine'} );
							}
});

$('.previous').click(function(e){ 
							//override default click behaviour
							e.stopPropagation();
							e.preventDefault();  
							if( $(this).hasClass('disabled') ){
							}else if( $(this).parent().parent().parent().parent().prev().hasClass('first') ){
								$.scrollTo( '0px', 1500, { axis: 'x', easing: 'easeInOutSine'} );
							}else{
								$.scrollTo( $(this).parent().parent().parent().parent().prev(), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine'} );
							}
});

$('#page00').click(function(e){ $.scrollTo( '0px', 1500, { axis: 'x', easing: 'easeInOutSine'} ); });

$('#page01').click(function(e){	$.scrollTo( $('.contentItem:eq(1)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page02').click(function(e){	$.scrollTo( $('.contentItem:eq(2)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page03').click(function(e){	$.scrollTo( $('.contentItem:eq(3)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page04').click(function(e){	$.scrollTo( $('.contentItem:eq(4)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page05').click(function(e){	$.scrollTo( $('.contentItem:eq(5)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page06').click(function(e){	$.scrollTo( $('.contentItem:eq(6)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page07').click(function(e){	$.scrollTo( $('.contentItem:eq(7)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page08').click(function(e){	$.scrollTo( $('.contentItem:eq(8)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });


$('#page09').click(function(e){	$.scrollTo( $('.contentItem:eq(9)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page10').click(function(e){	$.scrollTo( $('.contentItem:eq(10)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page11').click(function(e){	$.scrollTo( $('.contentItem:eq(11)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });

$('#page12').click(function(e){	$.scrollTo( $('.contentItem:eq(12)'), 1500, { axis: 'x', offset: {left: -18}, easing: 'easeInOutSine' } ); });
	
	
});
