$(document).ready(function() {

	
$('.fFrame').css({float:'left'});				   				   
$('ul#formProg > li:last').css({backgroundImage:'none',padding:'11px 5px 11px 10px'});
$('.fFrame:gt(0)').css({height:'300px'}).find('input,textarea').attr({disabled:'disabled'});
$('div.fLabel:eq(4),div.fLabel:eq(5),div.fLabel:eq(7),div.fLabel:eq(8),div.fLabel:eq(9),div.fLabel:eq(12),div.fLabel:eq(13),div.fLabel:eq(14),div.fLabel:eq(15)').css({height:'65px'});
$('div.fLabel:eq(16)').css({height:'125px'});
$('.nextButton').css({backgroundImage:'url(../images/button-sprite.png)',width:'106px'});
$('a.prevButton').css({display:'none'});
$('ul#formProg li').hover(function() { $(this).css({cursor: 'pointer'}); }, function() { $(this).css({cursor: 'default'}); });



/*
$('.fFrame').css({float:'left'});				   				   
$('ul#formProg > li:last').css({backgroundImage:'none',padding:'12px 10px 12px 10px'});
$('.fFrame:gt(0)').css({height:'300px'}).find('input,textarea').attr({disabled:'disabled'});
$('.nextButton').css({backgroundImage:'url(../images/button-sprite.png)',width:'106px'});
$('a.prevButton').css({display:'none'});
*/

var curMar = 0;
var curFrame = 1;
var numFrames = 3;
var theW = 440;

$('.nextButton').click(function() {

if (curFrame < numFrames) {
	$('ul#formProg li').removeClass('progSel');	
	
	curMar = curMar + theW;
	$('.fFrame').css({height:'300px'}).find('input,textarea').attr({disabled:'disabled'});
	$('.fFrame:eq('+curFrame+')').css({height:'auto'}).find('input,textarea').removeAttr('disabled');
	$('#formFrames').animate({'margin-left':'-'+curMar+'px'},750);
	$('ul#formProg li:eq('+curFrame+')').addClass('progSel');
	$('a.prevButton').fadeIn(750);
	curFrame = curFrame + 1;
	
	if ((numFrames - curFrame) == 0) {
		$('.nextButton').css({backgroundImage:'url(../images/button-sub-sprite.png)',width:'92px'});
	}
	 
	return false;
}
else {
	$('.fFrame').find('input,textarea').removeAttr('disabled');	
	return true;
}

});

$('.prevButton').click(function() {

if (curFrame > 1) {
	$('ul#formProg li').removeClass('progSel');	
	$('.fFrame').css({height:'300px'}).find('input,textarea').attr({disabled:'disabled'});
	forAuto = curFrame - 2;
	$('.fFrame:eq('+forAuto+')').css({height:'auto'}).find('input,textarea').removeAttr('disabled');
	curMar = curMar - theW;
	curFrame = curFrame - 1;
	curLink = curFrame - 1;
	$('ul#formProg li:eq('+curLink+')').addClass('progSel');
	$('#formFrames').animate({'margin-left':'-'+curMar+'px'},750);
	if (curFrame == 1) {
	$('a.prevButton').fadeOut(750);	
	}
	if (curFrame == 2) {
		$('.nextButton').css({backgroundImage:'url(../images/button-sprite.png)',width:'106px'});
	}
	return false;
}
});

$('ul#formProg li').click(function() {
	var theIndex = $(this).index();
	$('ul#formProg li').removeClass('progSel');
	var item = $(this);
	item.addClass('progSel');
	$('.fFrame').css({height:'300px'}).find('input,textarea').attr({disabled:'disabled'});
	curFrame = theIndex;
	$('.fFrame:eq('+curFrame+')').css({height:'auto'}).find('input,textarea').removeAttr('disabled');
	curMar = theIndex * theW;
	curFrame = theIndex+1;
	
	$('#formFrames').animate({'margin-left':'-'+curMar+'px'},750);
	
	if ((numFrames - curFrame) == 0) {
		$('.nextButton').css({backgroundImage:'url(../images/button-sub-sprite.png)',width:'92px'});
	}
	else {
		$('.nextButton').css({backgroundImage:'url(../images/button-sprite.png)',width:'106px'});
	}
	if (theIndex == 0) {
	$('a.prevButton').fadeOut(750);	
	}
	else {
	$('a.prevButton').fadeIn(750);	
	}
	return false;

});

$('ul#formProg > li').hover(function() {
	$(this).css({color: '#0C6DBE'});
	$(this).children('span').css('color', '#666666');								 
  },function(){
	  $(this).css('color', '#bcd2dc');
	  $(this).children('span').css('color', '#b2b7b5');
	  });
 
$('.nextButton').mousedown(function() {
									if (curFrame == 3) {
									$(this).css({backgroundPosition: '-92px 0'});
									} else {
									$(this).css({backgroundPosition: '-106px 0'});	
									}
									}).mouseup(function() {
									if (curFrame == 3) {
									$(this).css({backgroundPosition: '0 0'});
									} else {
									$(this).css({backgroundPosition: '0 0'});	
									}
									});

	
		
});

