/*

--------------------------------------------------------->8---

AUTHOR		g madison / ohsoso.com
CLIENT		britt-marie trensmar
VERSION		1 alpha

--------------------------------------------------------------

*/

document.documentElement.className += " js";

$(document).ready(function() {

	// HIDE INITIALLY
	
	$('img, .hide').not('#imgs img').hide();
	$('img').one('load', function() {
			$(this).fadeTo(400, 1);
	})
	.each(function(){
			if(this.complete) $(this).trigger('load');
	});
	
	// LOADING

	$(window).load(function() { 
			$('#loading').fadeOut(1800);
	});
	
	$('a').not($('a[target$="_blank"]')).not($('a[href$="#"]')).click(function() { 
			$('#loading').show();
	});
	
	$('[href$="#"]').click(function() { 
			$('#loading').show().fadeOut(1400);
	});

	// SHOW STUFF
	
	$('.box').hover(function() {
			$('p', this).fadeIn(50);
	}, function(){
			$('p', this).fadeOut(300);
	});
	
	$('.more').click(function() {
			$('.hide').toggle();
			$('#imgs, #prev_next').toggle();
			$(this).text($(this).text() == 'Read more' ? 'View images' : 'Read more');
	});

	
	// SLIDE
	
	$('#imgs').cycle( {
			fx:'fade', 
			speed:'200', 
			timeout: 5000, 
			next:'#next', 
			prev:'#prev'
	});
	
	// ADMIN SELECTIONS
	
	$("input[name='img_mov']").change(function() {
			if ($("input[name='img_mov']:checked").val() == 'img') {
					$('#hide_mov').hide();
					$('#hide_img').show();
					
			} else if ($("input[name='img_mov']:checked").val() == 'mov') {
					$('#hide_mov').show();
					$('#hide_img').hide();
			}
	});
	
	$('#admin_menu span').click(function() {
			var section = '.' + $(this).attr('id');
			$('.hide').hide();
			$(section).show();
	});

	// ADMIN CHANGE PAGE TO EDIT
	
	$(function() {
			$("#txt_editmenu").change(function(){
			window.location = '/admin' + this.value
			});
			$("#txt_edit").change(function(){
			window.location = '/admin' + this.value
			});
	});

	// DISABLE SKYPE
	
	window.setTimeout(function() {
			$('.skype_pnh_container').html('');
			$('.skype_pnh_print_container').removeClass('skype_pnh_print_container');
	}, 300);

return false;

});
