$frameInit = true;
$scrollTop = 600;
$autoScroll = true;
$(function() {
	
	// Set up Collapseable Containers
	animatedcollapse.addDiv('pc-compare', 'fade=1')
	animatedcollapse.addDiv('contact-form-wrapper', 'fade=1')
	animatedcollapse.init();
	
	// Add in links
	$("#proCon").click(function() {
		animatedcollapse.toggle('pc-compare');
	});
	$("#startReport").click(function() {
		animatedcollapse.toggle('contact-form-wrapper');
		return false;
	});
	
	// Set up iframe
	if (document.getElementById && document.createTextNode){
		var contactFrame = document.getElementById('contactFrame');
		addEvent(contactFrame,'load', doIframe); 
		addEvent(contactFrame,'load', clearDefaultHeight);
	}
	
	$("#contactFrame").addClass('default-height');
	
	// Set form default values
	$('#first_name').defaultValue($required);
	$('#last_name').defaultValue($required);
	$('#company').defaultValue($required);
	$('#phone').defaultValue($required);
	$('#email').defaultValue($required);
	$('#notes').defaultValue($notes);
	
	$(".openForm").click(function(){
		adjustScroll();						  
		animatedcollapse.show('contact-form-wrapper');
		
		return false;
	});
	
	$(".closeForm").click(function(){	
		animatedcollapse.hide('contact-form-wrapper');
		
		return false;
	});
	
	$(".btn_link").click(function(){
		adjustScroll();						  
		
		return false;
	});
});

function clearDefaultHeight() {
	if ($frameInit) {
		$frameInit = false;
	}
	else {
		$("#contactFrame").removeClass('default-height');
		adjustScroll();
	}
}

function adjustScroll() {
	if ($autoScroll) {
		$('html, body').animate({scrollTop:$scrollTop}, 'fast');
	}
}
