function select_provider() {
	alert("Reporting a claim for: " + $("#claim_prov").val());
	return false;
}
var max_panes = 4;

var ppos = 1;
var moving = 1;
var animating = 0;
lqueue = 0;
rqueue = 0;

function cycle_right() {
	if(animating == 1) {
		rqueue = rqueue+1;
		return false;
	}
	animating = 1;
	
	npos = ppos+1;
	if(npos>max_panes) npos=1;

	$("#hcontent"+ppos).fadeOut(250, function() {
		$("#hcontent"+npos).fadeIn(250);
	});
	
	$(".pframe").animate({left: '-=800px'}, 500, function() {
		moving = moving+1;
		if(moving>max_panes) {
			moving = 1;
			$("#pictures" + ppos).hide();
			$("#pictures" + ppos).animate({left: '+=' + (800 * max_panes)},0,function() {
					$("#pictures" + ppos).show();
					ppos = npos;
					$(".cb").removeClass("active");
					$("#cb"+ppos).addClass("active");
					animating = 0;
					if(rqueue > 0) {
						rqueue = rqueue - 1;
						cycle_right();
					}
			});
		}
	});
}

function cycle_left() {
	if(animating == 1) {
		lqueue = lqueue + 1;
		return false;
	}
	animating = 1;

	npos = ppos-1;
	if(npos<1) npos=max_panes;

	$("#hcontent"+ppos).fadeOut(250, function() {
		$("#hcontent"+npos).fadeIn(250);
	});
	
	ppos=npos;
	
	$("#pictures" + ppos).hide();
	$("#pictures" + ppos).animate({left: '-=' + (800 * max_panes) },0,function() {
			$("#pictures" + ppos).show();
			$(".pframe").animate({left: '+=800px'}, 500, function() {
				$(".cb").removeClass("active");
				$("#cb"+ppos).addClass("active");
				animating = 0;
				if(lqueue > 0) {
					lqueue = lqueue - 1;
					cycle_left();
				}
			});
	});
}

$(document).ready(function() {
	$(".con_container").hide();
	$("#hcontent1").show();
	$("#cb1").addClass("active");
	$("#searchsubmit").val(" ");
	$(".textinput").focus(function() {
		if(this.value == this.defaultValue) {
			this.value = '';
		}
	});
	$(".textinput").blur(function() {
		if(this.value == '') {
			this.value = this.defaultValue;
		}
	});
	
	$("#claim_prov").change(function() {
		$("#claim_info").html($("#claim_prov :selected").text());
	});
	
	$(".pic").click(function() { window.location = "index.php?page=contact"; });
	
	$("#footer li.col1 a").click(function() { window.location = "index.php?page=products"; });
	$("#footer li.col2 a").click(function() { window.location = "index.php?page=products"; });
	$("#footer li.col3 a").click(function() { window.location = "index.php?page=products"; });
	$("#footer li.col4 a").click(function() { window.location = "index.php?page=products"; });

});
