$(document).ready(function(){
	//FADE
	$('#fade').innerfade({
		speed: 1500,
		timeout: 8000,
		type: 'sequence',
		containerwidth: '800px',
		containerheight: '258px'
	});

	//INPUT ELEMENTS	
		var st = '#ffffff';
		var en = '#727272';
		
		$('input[type=hidden]').each(function(){
			$(this).css('display', 'none');
		});
			
		$(':input').focus(function(){
			if($(this).val() == $(this).attr('rel')){
				$(this).css('color', en);
				$(this).keydown(function(){
					if($(this).val() == $(this).attr('rel')){					
						$(this).val('');
						$(this).css('color', st);
					}
				});
			}
		}).blur(function(){
			if($(this).val() == '' || $(this).val() == $(this).attr('rel')){
				var atty = $(this).attr('rel');
				$(this).val(atty).css('color', st);
			}
		});
		
		//CHECKBOX
		$('input[type=checkbox]').each(function(){
			$(this).css({'display' : 'inline', 'width' : 'auto', 'padding' : '0px', 'margin-right' : '5px'});
		});
	//INPUT ELEMENTS
	
	//FIND LOGO
	$('#logo').css('cursor', 'pointer').bind({
		click: function(){
			window.location = './?page=home';	
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
		
	//DROPDOWN MENU
	$('#nav li').hover(
		function () {
			//show its submenu
			$('ul', this).slideDown(300);
		},function(){
			//hide its submenu
			$('ul', this).slideUp(100);
		}
	);
	
	//FIXING MARGINS
	$('#nav li:first').css({'margin-right' : '8px', 'width' : '20px', 'height' : '42px', 'background-image' : 'url(images/bolt.png)', 'background-repeat' : 'no-repeat'});
	$('#nav li:last').css({'float' : 'right', 'margin-right' : '8px', 'width' : '20px', 'height' : '42px', 'background-image' : 'url(images/bolt.png)', 'background-repeat' : 'no-repeat'});
	$('#right div:first').css({'margin-top' : '0px', 'padding-top' : '0px', 'border-top' : 'none'});
	
	//NEWSLETTER
	$('.clickMore').click(function(){
		$(this).next().slideToggle('slow');
	});
	$('#top .docs:last').css('border-bottom', 'none');
	$('.holder .docs:last').css('border-bottom', 'none');
	
	//DOCS
	$('.moreStaff').click(function(){
		$(this).prev().slideToggle('slow');
	});
	$('.docs:last').css('border-bottom', 'none');
	
	//SHOW MORE OF HIDDEN STUFF
	$('.more:first').html('hide').attr('rel', 'showing').parent().next().next().css('display', 'block');
	
	$('.more').click(function(){
		if($(this).attr('rel') == 'showing'){
			$(this).html('show').attr('rel', '').parent().next().next().slideUp('medium');
		}else{
			$('.more').each(function(){
				if($(this).attr('rel') == 'showing'){
					$(this).html('show').attr('rel', '').parent().next().next().slideUp('medium');
				}
			});
			
			$(this).html('hide').attr('rel', 'showing').parent().next().next().slideDown('medium');
		}
	});

	//SHOW SESSION
	$('.showSession').toggle(function(){
		dd = $(this).html();
		$(this).next().slideDown('slow');
		$(this).html('[hide info]');
	},function(){
		dd = $(this).html();
		$(this).next().slideUp('fast');
		$(this).html(dd);	
	});
	
	//GET LINE HEIGHT
	var h1 = $('#left').height();
	var h2 = $('#right').height();
	if(h1 > h2){
		$('#line_vert').css('height', h1+'px');
	}else{
		$('#line_vert').css('height', h2+'px');	
	}	
});
