$(function() 
{
	$("#nav").lavaLamp(
	{
    	fx: "backout", 
        speed: 700,
        click: function(event, menuItem) { return true; }
    });
});
		
$(document).ready(function() 
{
	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() 
	{
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
});	

/* Fade effect */

$(function() 
{
	// OPACITY OF BUTTON SET TO 50%
	$(".testimonialgreybox").css("opacity","0.5");
	 
	// ON MOUSE OVER
	$(".testimonialgreybox").hover(function () 
	{
		// SET OPACITY TO 100%
		$(this).stop().animate({
		opacity: 1.5
		}, "slow");
	},
	 
	// ON MOUSE OUT
	function () {
		// SET OPACITY BACK TO 50%
		$(this).stop().animate({
		opacity: 0.5
		}, "slow");
	});
});

function popUp(URL)
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1574,height=1072,left = 0,top = -24');");
}

function checkContactForm()
{
	var name = document.getElementById("name").value;
	var email = document.getElementById("email").value;
	var subject = document.getElementById("subject").value;
	var message = document.getElementById("message").value;
	
	document.getElementById("showerror").innerHTML = "";
	document.getElementById("showerror").style.display = "none";
	
	if (name == "")
	{
		document.getElementById("showerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your name.</strong>";
		document.getElementById("showerror").style.display = "inline";
		document.getElementById("showerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("name").focus();
		return false;		
	}
	
	if (email == "")
	{
		document.getElementById("showerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your e-mail address.</strong>";
		document.getElementById("showerror").style.display = "inline";
		document.getElementById("showerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("email").focus();
		return false;		
	}
	
	if (subject == "")
	{
		document.getElementById("showerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter a subject.</strong>";
		document.getElementById("showerror").style.display = "inline";
		document.getElementById("showerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("subject").focus();
		return false;		
	}
	
	if (message == "")
	{
		document.getElementById("showerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter a message.</strong>";
		document.getElementById("showerror").style.display = "inline";
		document.getElementById("showerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("message").focus();
		return false;		
	}
}

function isEmailAddr(Email)
{
	var result = false
	var theStr = new String(Email)
	var index = theStr.indexOf("@");
	if (index > 0)
	{
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index+1) && (theStr.length > pindex+1))
		result = true;
	}
	return result;
}

function checkIRForm()
{
	document.getElementById("showirerror").innerHTML = "";
	document.getElementById("showirerror").style.display = "none";

	if (document.getElementById("FirstName").value == "")
	{
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your first name.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("FirstName").select();
		return false;
	}
	if (document.getElementById("LastName").value == "")
    {
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your last name.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("LastName").select();
        return false;
    }
	if (!isEmailAddr(document.getElementById("Email").value))
	{
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your e-mail address.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("Email").select();
		return false;
	}
	if (document.getElementById("Address1").value == "")
    {
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your address.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("Address1").select();
        return false;
    }
    if (document.getElementById("City").value == "")
    {
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your city.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("City").select();
        return false;
    }
    if (document.getElementById("State").value == "")
    {
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your state or province.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("State").select();
        return false;
    }
    if (document.getElementById("PostalCode").value == "")
    {
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your ZIP or postal code.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("PostalCode").select();
        return false;
    }
    if (document.getElementById("Country").value == "")
    {
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your country.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("Country").select();
        return false;
    }
    if (document.getElementById("WorkPhone").value == "")
    {
		document.getElementById("showirerror").innerHTML  = "<span style='color: red; font-weight: bold'>Please enter your phone number.</strong>";
		document.getElementById("showirerror").style.display = "inline";
		document.getElementById("showirerror").style.backgroundcolor = "#F8F8F8";
		document.getElementById("WorkPhone").select();
        return false;
    }
}

