$(document).ready(function() {
	//login box
	$('#login, #logindrop').hover(function(){
		$('#logindrop').css('display', 'block');
		$('#loginbox').addClass('down');
	}, function(){
		$('#logindrop').css('display', 'none');
		$('#loginbox').removeClass('down');
	});
	
	
	//home page slideshow - http://malsup.com/jquery/cycle/begin.html
	
	$('#heroleft').cycle({
		fx: 'scrollHorz',
		speed:2000,
	    timeout:7000, 
		pause:1,
		random:1
	});

	
	
	//profile switcher
	$('.profileheaders h3 a').click(function(){
		tab = $(this).attr('alt');
		$('.profileheaders h3 a').removeClass('active');		
		$(this).addClass('active');
		//alert(tab);
		$('.pop-females').css('display', 'none');
		$('.pop-males').css('display', 'none');
		if(tab != "pop-females"){
			$('.pop-males').css('display','block');
			return false;
		}else{
			$('.pop-females').css('display','block');		
			return false;
		}
	});
	
	$('#interested .col1 a').click(function(){
		$('#interested .col1 a').removeClass('on').addClass('off');
		$(this).removeClass('off').addClass('on');
		if($(this).hasClass('man')) {
			$('#genderText').text('dude');
			if($('#interested .col2 a.on').hasClass('man')) {
				$('#sexual_orientation').val('Gay');
			} else {
				$('#sexual_orientation').val('Straight');
			}
		} else {
			$('#genderText').text('chick');
			if($('#interested .col2 a.on').hasClass('man')) {
				$('#sexual_orientation').val('Straight');
			} else {
				$('#sexual_orientation').val('Gay');
			}
		}
		return false;
	});

	$('#interested .col2 a').click(function(){
		$('#interested .col2 a').removeClass('on').addClass('off');
		$(this).removeClass('off').addClass('on');
		if($(this).hasClass('man')) {
			$('#gender').val('M');
			$('#orientationText').text('dudes');
			if($('#interested .col1 a.on').hasClass('man')) {
				$('#sexual_orientation').val('Gay');
			} else {
				$('#sexual_orientation').val('Straight');
			}
		} else {
			$('#gender').val('F');
			$('#orientationText').text('chicks');
			if($('#interested .col1 a.on').hasClass('man')) {
				$('#sexual_orientation').val('Straight');
			} else {
				$('#sexual_orientation').val('Gay');
			}
		}
		return false;
	});
	
	$('.entrybuttons a.fav, .entrybuttons a.date').click(function(){
		lastclass = $(this).attr('class').split('').slice(-1);
		if(lastclass=='d'){ $(this).removeClass('d').addClass('e'); }
		if(lastclass=='e'){ $(this).removeClass('e').addClass('d'); }
		return false;
	});
	
	$('#editprofileright h2').click(function(){
		clicked = $(this).attr('class');
		$('#editprofileright a').removeClass('active');
		$('a', this).addClass('active');
		$('#editprofileright div').css('display', 'none');
		$('#editprofileright #' + clicked).css('display', 'block');
		return false;
	});

});
