//Add A Row
var C = $('.childrow').size() +1;

$(document).ready(function() {
   
  $("#addrow").click(function(){
  
	C++;
	
	if (C<=10)
	  {
	  	$(".childrow:last").after('<tr class="childrow" ><th><div class="delete-wpr"><a class="delete" href="javascript:;" title="Remove row">X</a></div><label>Child '+C+':</label><br /><input name="C'+C+'name" type="text" class="" value="" size="20" /></th><td><br /><select name="C'+C+'gender" class="select" ><option value="" selected="selected">Gender</option><option value="Male">Male</option><option value="Female">Female</option></select></td><td><label>MM-DD-YYYY</label><br /><input name="C'+C+'dob" type="text" class="" value="" size="10" /></td><td><label>Disability if Any</label><input name="C'+C+'disability" type="text" class="" value="" size="20" /></td></tr>');
	  }
    if ($(".delete").length > 0) $(".delete").show();
    if (C>10) {$('#addrow').hide();}
  });
    
  $(".delete").live('click',function(){
    $(this).parents('.childrow').remove();
    if ($(".delete").length < 2) $(".delete").hide();
  });
      
});


/*
//Schedule Tabs v1
//Simple Tabs with CSS & jQuery [sohtanaka.com]
$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

});
*/

//Schedule Tabs v2
//jQuery tabs v2 2010-05-08 http://jqueryfordesigners.com/jquery-tabs/
$(function () {
	var tabContainers = $('div.tabs > div');
	tabContainers.hide().filter(':first').show();
	
	$('div.tabs ul.tabNavigation a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).show();
		$('div.tabs ul.tabNavigation a').removeClass('selected');
		$(this).addClass('selected');
		return false;
	}).filter(':first').click();
});

//zebra stripe table
$(document).ready(function(){
$(".stripeMe tr:even").addClass("alt");
});

//table row link with jQuery
$(document).ready(function() {
	
	//if tr has a href, show pointer 
    $('.schedule tr').mouseover(function() {
        var hashref = $(this).find("a").attr("href");
        if(hashref) {
            $('.tab_content tr.alt td:hover').css("cursor","pointer");
        }
    });
    //if tr has href, use to link row
    $('.schedule tr.alt').click(function() {
        var href = $(this).find("a").attr("href");
        if(href) {
            window.location = href;
        }
    });

});

