/***************************** Image rollovers ****************************/
$(function() {
	$('.rollover').hover(function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('hover'));
		$(this).attr('hover', currentImg);
	}, function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('hover'));
		$(this).attr('hover', currentImg);
	});
});

/***************************** About Us page ******************************/
$(function() {
	$('.reveal_inot').click(function() {
		if ( $('#' +$(this).attr('name')).height() == 0 ) {
			$('#' + $(this).attr('name')).animate({"height": $('#' + $(this).attr('name')).children('div').height() + "px" });
			sizeadjustaboutdn($('#' + $(this).attr('name')).children('div').height());
		}
		else {
			$('#' +$(this).attr('name')).animate({'height': '0'});
			sizeadjustaboutup($('#' + $(this).attr('name')).children('div').height());
		}
	});
});
$(function() {
	$('.reveal_inot').hover(function() {
		$(this).css("border-bottom","2px solid #76adb0");
	}, function() {
		// if ( $(this).attr('id') != currentInotID )
			$(this).css("border-bottom","none");
	});
});

/***************************** News page ********************************/
$(function() {
	$('.reveal_news').click(function() {
		if ( $('#' +$(this).attr('name')).height() == 0 ) {
			$('#' + $(this).attr('name')).animate({"height": $('#' + $(this).attr('name')).children('div').height() + "px" });
			sizeadjustnewsdn($('#' + $(this).attr('name')).children('div').height());
		}
		else {
			$('#' +$(this).attr('name')).animate({'height': '0'});
			sizeadjustnewsup($('#' + $(this).attr('name')).children('div').height());
		}
	});
});

/***************************** Claims page ******************************/
var originalexpander;
var originalframe;
$(function() {
	$('.reveal_info').click(function() {
		if ( $('#' +$(this).attr('name')).height() == 0 ) {
			$('#' + $(this).attr('name')).animate({"height": ( $('#' + $(this).attr('name')).children('div').height() + 15)  + "px" });
			// Now adjust the page height dynamically
			originalexpander = $(".expander").height();
			var contentheight = $('#' + $(this).attr('name')).children('div').height();
			originalframe = $(".claimsframe").height();
			$(".expander").css("height", (originalexpander + contentheight ));
			$(".claimsframe").animate({'height': originalframe + contentheight});
		}
		else {
			$('#' +$(this).attr('name')).animate({'height': '0'});
			// Now adjust the page height dynamically
			$(".expander").css("height", (originalexpander));
			$(".claimsframe").animate({'height': originalframe});
		}

	});
});

/***************************** Contact page *****************************/
var locName = '';
$(function() {
	$('.locations').hover(function() {
		locName = $(this).attr('name');
		$('#' + locName).css("display","block");
	}, function() {
		$('#' + locName).css("display","none");
	});
});

$(function() {
	$('#submitlbform').click(function() {

		$('#form10').css("visibility","hidden");

		var firstname = $("input#firstname").val();
		var lastname = $("input#lastname").val();
		var title = $("input#title").val();
		var company = $("input#company").val();
		var address = $("input#address").val();
		var city = $("input#city").val();
		var zip = $("input#zip").val();
		var phone = $("input#phone").val();
		var fax = $("input#fax").val();
		var email = $("input#email").val();
		var msgbox = $("textarea#msgbox").val();
		var state = $("select#state").val();
		var xpbbm = $("input#xpbbm").val();

		var dataString = 
		'firstname=' + firstname + 
		'&lastname=' + lastname + 
		'&title=' + title + 
		'&company=' + company + 
		'&address=' + address + 
		'&city=' + city + 
		'&zip=' + zip + 
		'&phone=' + phone + 
		'&fax=' + fax + 
		'&email=' + email + 
		'&msgbox=' + msgbox + 
		'&state=' + state + 
		'&xpbbm=' + xpbbm;

		$.ajax(
			{
				type: "POST",
				url: "connectus.php",
				data: dataString,
				success: function(html) {
					$("#form1").html(html);
			}
		});

	});
});

/**************************** Menu bars ******************************/
$(function() {
	$('.item1').hover(function() {
		$('.highlightbar1').css("background-color","#711313");
	}, function() {
		$('.highlightbar1').css("background","none");
	});
});
$(function() {
	$('.item2').hover(function() {
		$('.highlightbar2').css("background-color","#bea96e");
	}, function() {
		$('.highlightbar2').css("background","none");
	});
});
$(function() {
	$('.item3').hover(function() {
		$('.highlightbar3').css("background-color","#445b68");
	}, function() {
		$('.highlightbar3').css("background","none");
	});
});
$(function() {
	$('.item4').hover(function() {
		$('.highlightbar4').css("background-color","#5d5d41");
	}, function() {
		$('.highlightbar4').css("background","none");
	});
});
$(function() {
	$('.item5').hover(function() {
		$('.highlightbar5').css("background-color","#445b68");
	}, function() {
		$('.highlightbar5').css("background","none");
	});
});
$(function() {
	$('.item6').hover(function() {
		$('.highlightbar6').css("background-color","#5d5c41");
	}, function() {
		$('.highlightbar6').css("background","none");
	});
});
$(function() {
	$('.item7').hover(function() {
		$('.highlightbar7').css("background-color","#935453");
	}, function() {
		$('.highlightbar7').css("background","none");
	});
});
$(function() {
	$('.item8').hover(function() {
		$('.highlightbar8').css("background-color","#5c5c40");
	}, function() {
		$('.highlightbar8').css("background","none");
	});
});
/************************ end menu bars ******************************/

var currentImg;
function showtitle (indx) {
	currentImg = $('#tst1').html();
	$('#tst1').html(projectTitles[indx]);
}
function showprev () {
		$('#tst1').html(currentImg);
}

