$(document).ready(function(){
	
	//Hide all my forms
	$('#detail-text').hide();

	//Toggle Form
	$("#more-detail a").click(function() {
		// rewrite the text of the link
		if($(this).text() == 'See Detail' && $("div#detail-text:visible")){
			$(this).text('Hide Detail');
		}
		else{
			$(this).text('See Detail');
		}
		
		// toggle visibility
		$("div#detail-text").slideToggle("fast");
		return false;
	});
	
	$("#sidebar ul li").removeClass('alt');
	$("#sidebar ul li:odd").addClass('alt');
	
	// var geturl = "";
	$('.landing h4 a').each(function(){
		var geturl = $(this).attr("href");
		$(this).parent().parent().find('p:last-child').after('<p class="read"><a href="'+geturl+'">Read More &raquo;</a></p>');
	});
	
	/*
	// Homepage Slideshow Cycle
	$('#slide-show').cycle({
		fx: 'scrollLeft',
		timeout: 5000,
		speed: 2000
	});
	*/
	
	// 
	//Homepage News
	$('#newsfeed').cycle({
		fx: 'fade',
		timeout: 6000,
		speed: 1000,
		pause: 1,
		sync: 0,
		containerResize: 1,
		cleartypeNoBg: true 
	});
	
	// Homepage Consulting Cycle
	$('#consulting-slider-inner').cycle({
		fx: 'scrollHorz',
		timeout: 15000,
		speed: 2000,
		prev: '#back',
		next: '#next',
		containerResize: 1,
		cleartypeNoBg: true 
	});
	
	$('#back, #next').click(function(){
		$('#consulting-slider-inner').cycle('pause');
	});
	
	//Clear Inputs
	$(':input').focus(function(){
		if($(this).val() == $(this).attr('title')){
			$(this).val('');
		}
	}).blur(function(){
		if($(this).val() == ''){
			$(this).val($(this).attr('title'));
		}
	});

	$("a[rel='external']").click(function(){window.open(this.href); return false;});
	$("#reset").click(function(){
		if(confirm("Are you sure you want to reset the form?")){
			$('#smart-tools-form')[0].reset();
			$('#smart-tools-form').reset();
			return true;
		}
		else{
			return false;
		}
	});
});//end document.ready