/*
CITAC AFRICA LLP: WEB SITE 2008
-----------------------------------------------------
Designed and created by Jesson Yip. www.jessonyip.com
-----------------------------------------------------
*/


$(document).ready( function() {


	// ACCORDIAN

	// Select accordian elements
	var hd  = $(".ce_accordion > h3");
	var ct  = $(".ce_accordion > *:not(h3)");
	var cte = $(".ce_accordion > *:not(h3) > *:nth-child(even)");

	// Make accordian header and link for accordian specific styles
	hd.addClass("accordion_header");
	hd.wrapInner("<a></a>");

	// Accordian focus on click
	hd.click ( function() {
		// Toggle active header class
		$(this).toggleClass("active").siblings("h3").removeClass("active");
		// Reveal clicked headers content and hide others
		$(this).next("*:not(h3)").slideToggle(400).siblings("*:not(h3)").slideUp(600);
	});
	
	// Hide content
	ct.hide();

	// Label even content
	cte.addClass("even");


	// MEMBERS LOGIN

	// Push label into content
	var $uLabel = $('#username').prev().html();
	$('#username').attr('value',$uLabel);
	$('#username').css ("color","#aaaaaa");
	$('#username').focus( function() {
		if ($(this).attr('value')==$uLabel){
			$(this).attr('value','');
			$(this).css ("color","#222222");
		}
	});
	$('#username').blur( function() {
		if ($(this).attr('value')==''){
			$(this).attr('value',$uLabel);
			$(this).css ("color","#aaaaaa");
		}
	});

	// Repeat to a text verson of password field
	var $pLabel = $('#password').prev().html();
	$('#password').after('<input id="password2" class="field" name="pword2" type="text" />');
	$('#password').css("display","none");
	$('#password2').css ("color","#aaaaaa");
	$('#password2').attr("value",$pLabel);
	$('#password2').focus( function() {
		$(this).css("display","none");
		$('#password').css("display","block");
		$('#password').focus();
	});
	$('#password').blur( function() {
		if ($(this).attr('value')==''){
			$(this).css("display","none");
			$('#password2').css("display","block");
		}
	});


});