/**
 * @author gerald
 */
var prevLink = '<a class="prev" href="#">&lt;&lt; Prev</a> | ';
		var nextLink = '<a class="next" href="#">Next &gt;&gt;</a>';
		var navHTML = '<div class="prev-next">' +
					  	 prevLink +
						 nextLink +
					  '</div>';
		var errorField = -1;
		
		$(function(){
			//
			// init
			$('#frm > div')
				.hide()
				.append(navHTML);
			$('#first-step .prev').remove();
			$('#last-step .next').remove();

			// show first step
			$('#first-step').show();


			$('a.next').click(function(){
				var whichStep = $(this).parent().parent().attr('id');
				

				if( whichStep == 'first-step' )
				{
					
					//validate first-step
					//checkForif(m();
					
					 
				}
				else if( whichStep == 'second-step' )
				{
					// validate second-step
				}
				else if(whichStep == 'third-step'){
					//validate third step
				}
				else if( whichStep == 'last-step' )
				{
					// validate last-step
				}
				$(this).parent().parent().hide().next().show();

			});

			$('a.prev').click(function(){
				$(this).parent().parent().hide().prev().show();
			});
		});
		
		function checkRadioArray(radioButtons){
		 for (var i=0; i < radioButtons.length; i++) {
		  if (radioButtons[i].checked) {
		   return true;
		  }
		 }
		 return false;
		}



		var state = 'hidden';

		function showhide(layer_ref) {

		if (state == 'visible') {
		state = 'hidden';
		}
		else {
		state = 'visible';
		}
		if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.visibility = state");
		}
		if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].visibility = state;
		}
		if (document.getElementById && !document.all) {
		maxwell_smart = document.getElementById(layer_ref);
		maxwell_smart.style.visibility = state;
		}
		}
		
$(document).ready(function() {
	$("#frm").click(function(){	
	      $("#frm").validate({
	      	errorLabelContainer: $("#RegisterErrors"),
		rules: {
		  q11: "required",// simple rule, converted to {required:true}
		  q12: {// compound rule
		  required: true
		},
		q13: {
		  required: true
		},
		q14: {
		  required: true
		},
		q15: {
		  required: true
		},
		q16: {
		  required: true
		},
		q17: {
		  required: true
		},
		q18: {
		  required: true
		},
		q19: {
		  required: true
		},
		q110: {
		  required: true
		},
		q113: {
		  required: true
		},
		q116: {
		  required: true
		},
		q117: {
		  required: true
		},
		q119: {
		  required: true
		},
		q120: {
		  required: true
		}
		},
		messages: {
		  q11: "Question 1",
		  q12: "Question 2",		  
		  q13: "Question 3",
		  q14: "Question 4",
		  q15: "Question 5",		  
		  q16: "Question 6",
		  q17: "Question 7",
		  q18: "Question 8",		  
		  q19: "Question 9",
		  q110: "Question 10",	  
		  q113: "Question 13",
		  q116: "Question 16",		  
		  q117: "Question 17",
		  q119: "Question 19",
		  q120: "Question 20"
		}

	    });
    
    });
});
