//Globals
	var pageurl = "pages/" + pagenow + ".php";
	var pages = new Array();
	pages[0] = "news";
	pages[1] = "bio";
	pages[2] = "live";
	pages[3] = "media";
	pages[4] = "contact";
	
	var news_now = 1;
	var news_count = 0;

//Audio player setup
	AudioPlayer.setup("http://stroave.com/audio/player/player.swf", {  
		width: 560,  
		initialvolume: 80,  
		transparentpagebg: "yes", 
		bg: "111111",
		leftbg: "111111",
		lefticon: "80a2ac",
		voltrack: "222222",
		volslider: "80a2ac",
		rightbg: "111111",
		rightbghover: "111111",
		righticon: "a0a686",
		righticonhover: "f1f1f1",
		loader: "222222",
		track: "222222",
		tracker: "444444",
		border: "222222",
		skip: "bbbbbb",
		text: "f1f1f1"
	});
	
//Load BIO rollovers if BIO is loaded directly
$(document).ready(function(){
	if(pagenow == "bio") {
		change_sight('bio');
	}
});

$(window).resize(function() {
	center();
});
	
//Center content on page
function center() {
		width = $(window).width();
		height = $(window).height();
		
		divwidth = $('#center').width();
		divheight = $('#center').height();
					
		var left = width / 2 - 495;
		var top = height / 2 - 340;
		
		if(divheight >= top) {
			top = 100;
		}
			
		$('#center').css('left', left);
		$('#center').css('top', top);
}


//Load pages
function laad(wat) {
	var page = false;

	if(wat != pagenow) {
		$.get('includes/check.php?p=' + wat, function(data) {
			
			var	page = data;
			pageurl = "pages/" + page + ".php";
			
			if(page) {
				pagenow = page;
				change_sight(page);

				if(wat != "news") {
					$('#social').hide();
				}
				
				$('#variable').load(pageurl, {ajax: 'true'}, function() {
					mark_page(page);

					if(wat == "news") {
						$('#social').show();
					}
				})
			} 
		})
	}
}

//Mark page in navigation
function mark_page(wat) {
	if(wat == pagenow) {
		$('#a_' + wat).css('color', '#80a2ac');
		$('#a_' + wat).css('border-bottom-color', '#888888');
	
		for (x in pages) {
			if(pages[x] != wat) {
				$('#a_' + pages[x]).css('color', '#a0a686');
				$('#a_' + pages[x]).css('border-bottom-color', '#eeeeee');
			}
		}
	}	
}

//Change picture on page change
function change_sight(wat) {
	phpurl = "includes/get_sight.php?page=" + wat;
		
	$("#sight").load(phpurl, function() { 
		if(wat == "bio") {
			roteet();
		}
	});
	
}

//Puts site into update status
function update_status(wat) {
	if(wat == "yes") {
		if(confirm("Are you sure you want to put the website INTO update status?")) {
			window.location = "?update=yes";
		}
	} else if(wat == "no") {
		if(confirm("Are you sure you want to take the website OUT OF update status?")) {
			window.location = "?update=no";
		}	
	}
}

//BIO rollovers
rotate = true;

release_pieter = true;
release_tim = true;
release_tom = true;
release_joe = true;
	
function roteet() {
	if(rotate) {
		rotate = false;
		$('#pic_pieter').fadeIn('slow', function() {
			$('#pic_tim').fadeIn('slow', function() {
				$('#pic_pieter').hide();
				$('#pic_tom').fadeIn('slow', function() {
					$('#pic_tim').hide();
					$('#pic_joe').fadeIn('slow', function() {
						$('#pic_tom').hide();
						$('#pic_joe').fadeOut('slow');
					})
				})
			})
		})
	}
}

function feedIn(wim) {
	if(!rotate) {
		if(window['release_'+wim]) {
			window['release_'+wim] = false;
			$('#pic_'+wim).fadeIn('slow');
		}
	}
}

function feedOut(wim) {
	$('#pic_'+wim).fadeOut('slow',function() {
		window['release_'+wim] = true;
	});
}

//Change video
function load_vid(wat) {
	phpurl = "pages/sight/get_vid.php?v=" + wat;
	
	$("#sight").load(phpurl, {ajax: 'true'});
}
