$(document).ready(function() { 
	
	$('#header_imgs').innerfade({
		speed: 2000,
		timeout: 7000,
		type: 'sequence',
		containerheight: '201px'	
	});
	
	$('#testimonials').innerfade({
		speed: 500,
		timeout: 8000,
		type: 'random',
		containerheight: '84px',
		animationtype: 'slide'
	});
	
	var rnheight = $('#recent_news').height();
	var rpheight = $('#recent_projects').height();
	if(rnheight > rpheight) {
		$('#recent_projects').css({'height':rnheight+'px'});
		//$('#recent_news').css({'height':rnheight+'px'});
	} else {
		//$('#recent_projects').css({'height':rpheight+'px'});
		$('#recent_news').css({'height':rpheight+'px'});
	}
	
	var tips;
	
	$.ajax({
			type : "GET",
			url : 'tooltips/home_left.php',
			dataType : "html",
			success: function(data) {
				tips = data;
			},
			error : function() {
				tips = "Sorry, The requested property could not be found.";
			},
			async: false
	});
			  
	// Setup the tooltip with the content
	$('.help_list a').each(function() {
		$(this).qtip({
			style: { 
				width: 400,
				padding: 5,
				//background: '#ffffff',
				color: '#444444',
				textAlign: 'left',
				border: {
					width: 3,
					radius: 3,
					color: '#a7aaac'
				},
				tip: 'leftTop',
				title: {
					'background': '#ebebeb',
					'font-size': '1.4em',
					'line-height': '1.3em'
				}
			},
			name: 'light', // Inherit the rest of the attributes from the preset dark style
			show: {
				effect: {
					length: 500
				}
			},
			hide: {
				when: 'mouseout',
				fixed: true,
				effect: {
					length: 500
				},
				delay: 500
			},
			content: {
			   text: getContent(this,tips),
			   title: {
				  text: $(this).html()
				  //button: '<img src="https://fedorahosted.org/echo-icon-theme/export/f3da1be0d69c2e53acb18cc81d15ba6002b7413c/base/256x256/actions/dialog-close.png" width="30" style=" position:absolute; top:-7px; left:-20px;" />'
			   }
			},
			position: {
				corner: {
					target: 'rightMiddle'
				},
				adjust: {
					y: -4
				}
			}
		});
	});
	
}); //End document ready function

function getContent(tag,html) {
	if($(tag).attr('url')) {
		return $(html).find($(tag).attr('tag')).html();
	}
	if($(tag).attr('txt')) {
		return $(tag).attr('txt');
	}
	
}

function testupdate() {
	$('.contact a').qtip('api').updateContent('This is new content.');
}
