        $(document).ready(function(){
            $(".formContainer input[type=text], .formContainer select, .formContainer input[type=checkbox], .formContainer textarea ").focus(function(){
                $(this).parent().find(".error").css("display", "none");
                $(this).parent().find(".info").css("display", "block");
                $(this).parent().css("background-color", "#000000");
                $(this).parent().css("color", "#E6CC00");
            }).blur(function(){
                $(this).parent().find(".info").css("display", "none");
                $(this).parent().css("background-color", "#CFDEFF");
                $(this).parent().css("color", "#000000");
            });
            $("#CorporationDisplay input[type=text], #CountryDisplay select").focus(function(){
                $(this).parent().parent().find(".error").css("display", "none");
                $(this).parent().parent().find(".info").css("display", "block");
                $(this).parent().parent().css("background-color", "#000000");
                $(this).parent().parent().css("color", "#E6CC00");
            }).blur(function(){
                $(this).parent().parent().find(".info").css("display", "none");
                $(this).parent().parent().css("background-color", "#CFDEFF");
                $(this).parent().parent().css("color", "#000000");
            });

 
        });
        
        function validateForm()
        {
        	var errorCount = 0;
            $(".formContainer input[type=text]").each(function(){
            
                var text = $(this).attr("value");
                if (text == "")
                {
                    $(this).parent().find(".error").css("display", "block");
                    $(this).parent().find(".error").parent().css("background-color", "#000000");
                    $(this).parent().find(".error").parent().css("color", "#E6CC00");
                    if ($(this).parent().find(".error").html()) {
                        errorCount++;
                    }
                } else if ($(this).attr("name") == 'frmEmail') {
                	var regexContent = /^[a-zA-Z0-9_\.\-]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/i;
                	if (!regexContent.test(text)) {
                        $(this).parent().find(".error").parent().css("background-color", "#000000");
                        $(this).parent().find(".error").parent().css("color", "#E6CC00");
                    	$(this).parent().find(".error").html(text+' is an Invalid Email');
                        $(this).parent().find(".error").css("display", "block");
                    	errorCount++;
                	}
                }
            });
			
			$(".formContainer select[type=select-one]").each(function(){
            
                var text = $(this).attr("value");

                if (text == "")
                {
                    $(this).parent().find(".error").css("display", "block");
                    $(this).parent().find(".error").parent().css("background-color", "#000000");
                    $(this).parent().find(".error").parent().css("color", "#E6CC00");
                    if ($(this).parent().find(".error").html()) {
                        errorCount++;
                    }
                } else if ($(this).attr("name") == 'frmEmail') {
                	var regexContent = /^[a-zA-Z0-9_\.\-]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/i;
                	if (!regexContent.test(text)) {
                        $(this).parent().find(".error").parent().css("background-color", "#000000");
                        $(this).parent().find(".error").parent().css("color", "#E6CC00");
                    	$(this).parent().find(".error").html(text+' is an Invalid Email');
                        $(this).parent().find(".error").css("display", "block");
                    	errorCount++;
                	}
                }
            });
			
            if (errorCount == 0) {
            	return true;
            } else {
            	return false;
            }
        }
        
        function clearForm()
        {
            $(".formContainer input[type=text]").each(function(){
                $(this).parent().find(".error").css("display", "none");
            });
       }


		function calculateTypeTotal(type, currentId, totalId)
        {
        	if (isNaN(parseFloat(document.getElementById(currentId).value))) {
        		document.getElementById(currentId).value = '';
        		return;
        	}
        	runningTotal = 0;
            $(".formContainer #"+type+" input[type=text]").each(function(){
            
                var text = $(this).attr("value");
                runningTotal += (text*1);
            });
            if (type == 'fundType') {
                document.getElementById(totalId).innerHTML = turnIntoCurrencyFormat(runningTotal);
            } else {
                document.getElementById(totalId).innerHTML = runningTotal;
            }
        }
        
        function turnIntoCurrencyFormat(value) 
        {
        	return value.toFixed(2)
        
        }
		

