

//Initialize first demo:
ddaccordion.init({
	headerclass: "news-header", //Shared CSS class name of headers group
	contentclass: "news-article", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["", "openpet"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})



//Initialize first demo:
ddaccordion.init({
	headerclass: "strategy-header", //Shared CSS class name of headers group
	contentclass: "strategy-article", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "openpet"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})


$(document).ready(function() {

	//When page loads...
	$(".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 href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

});


$(document).ready(function(){
       
        //Hide div w/id extra
       //$("#extra").css("display","none");

        // Add onclick handler to checkbox w/id checkme
       $("#school_billed").click(function(){
       
        // If checked
        if ($("#school_billed").is(":checked"))
        {
            //show the hidden div
            $("#extra-cctype").hide("fast");
            $("#extra-ccname").hide("fast");
            $("#extra-ccnumber").hide("fast");
            $("#extra-ccexpiry").hide("fast");
            $("#show-hide").hide("fast");
        }
        else
        {     
            //otherwise, hide it
            $("#extra-cctype").show("fast");
            $("#extra-ccname").show("fast");
            $("#extra-ccnumber").show("fast");
            $("#extra-ccexpiry").show("fast");
            $("#show-hide").show("fast");
        }
      });
   
    });
    

$(document).ready(function(){
 $("input[type=file]").filestyle({ 
     image: "/inc/img/upload_file.png",
     imageheight : 23,
     imagewidth : 73,
     width : 116
 });
});





$(document).ready(function(){
	var text = $('#author-text').html();
	var extract = text.substring(0,800) + "...";
	$('#author-text').html(extract);
	$('#button').html('<a href="#" class="more">+ Read More</a>');
	more(text);					
});	

this.more = function(text){	
$('.more').click(function () {
		$('#author-text').html(text);
		$('#author-text').append('<div class="position"></div>');
		position();
		$('#button').html('<a href="#" class="less">- Read Less</a>');
		return false;
	});
}

this.position = function(){	
	var p = $(".position");
	var position = p.position();
	var pos_top = position.top;
	$('#author-text').animate({height:pos_top+'px'}, function(){
		less();
	});	
}

this.less = function(){	
$('.less').click(function () {
	$('#author-text').animate({height:'210px'}, function(){
		var text = $('#author-text').html();
		var extract = text.substring(0,800) + "...";
		$('#author-text').html(extract);
		$('#button').html('<a href="#" class="more">+ Read More</a>');
		more(text);
		});	
		return false;
	});
}
