jQuery(function(){
//$(window).load(function(){
	/***** shared *****/
	// only enable tipTip plugin if it's not IE6, objectAll is false in IE7/8
	//if (jQuery.support.boxModel || !jQuery.support.objectAll) {
		//alert(jQuery.browser.msie);
		//alert(parseInt(jQuery.browser.version));
	if (!jQuery.browser.msie && parseInt(jQuery.browser.version) != 6) {
		$("*[title]")
			.not("#miniImgNav *")
			.not("#header *")
			.tipTip();
		$("#header *[title]").tipTip({delay:1});
		$("#miniImgNav *[title]").tipTip({delay:3000});
	}
	/*
	
//		.not("#miniImgNav *")
//		.tipTip();
*/
	
	$("#btnLogin").click(function(){
		
		$("#cLogin").slideToggle(300);
		
		$(".popup[id!='" + $(this).attr('id') + "']").hide();
		return false;
	});
	
	$("#btnCancelLogin").click(function(){
		$("#cLogin").slideUp(300);
	});
	
	/*
	$("#btnContact").click(function() {	
		$("#cContact").slideToggle(300);
		$(".popup[id!='" + $(this).attr('id') + "']").hide();
		return false;
	});
	*/

	$("#btnCancelContact").click(function(){
		$("#cContact").slideUp(300);
	});

	//$("#addObj").bind("click", addObj);
	// $("div").live("click", addObj);
	
	
	$("#frmContact").submit(function(){
		if (jQuery.trim($('#contact_name').val())
			&& jQuery.trim($('#contact_message').val())
			) {
				// Pass
		} else {
			alert("Please enter your name and a message!  Thank you!");
			return false;
		}
		//return false;
	});


	
	/***** main page *****/
	
	$("#miniImgNav a").hover(
		function(){
			$("img", this).animate({opacity: 0.5}, 400);
		},
		function() {
			$("img", this).animate({opacity: 1}, 200);
		}
	);
	
	/*
	$('#miniImgNav a').hover(
		function () {
			var strImg = strWebRoot + "/imgs/icn_" + $(this).attr("icn") + "_2.gif";
			$("img", this).attr("src", strImg);
		},
		function() {
			var strImg = strWebRoot + "/imgs/icn_" + $(this).attr("icn") + ".gif";
			$("img", this).attr("src", strImg);
		}
		);
	*/
});


function detectBrowserVersion(){
var userAgent = navigator.userAgent.toLowerCase();
$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
var version = 0;

// Is this a version of IE?
if($.browser.msie){
userAgent = $.browser.version;
userAgent = userAgent.substring(0,userAgent.indexOf('.'));
version = userAgent;
}

// Is this a version of Chrome?
if($.browser.chrome){
userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
userAgent = userAgent.substring(0,userAgent.indexOf('.'));
version = userAgent;
// If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
$.browser.safari = false;
}

// Is this a version of Safari?
if($.browser.safari){
userAgent = userAgent.substring(userAgent.indexOf('safari/') +7);
userAgent = userAgent.substring(0,userAgent.indexOf('.'));
version = userAgent;
}

// Is this a version of Mozilla?
if($.browser.mozilla){
//Is it Firefox?
if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
userAgent = userAgent.substring(0,userAgent.indexOf('.'));
version = userAgent;
}
// If not then it must be another Mozilla
else{
}
}

// Is this a version of Opera?
if($.browser.opera){
userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
userAgent = userAgent.substring(0,userAgent.indexOf('.'));
version = userAgent;
}
return version;
}//end function
