function mover(id)
{
	document.getElementById(id).style.color='#FFD700';
}

function mout(id, color)
{
	document.getElementById(id).style.color=color;
}

function googleTranslateElementInit() 
{
	new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}

function convertdollars(id)
{
	var input = document.getElementById(id).value;
	
	if (isNaN(input))
	{
		alert("Entry is not a number");
		document.getElementById(id).value = "";
		document.getElementById(id).focus();
	}
	else
	{
		var price = new Number(input);
		price = price.toFixed(2);
		document.getElementById(id).value = price;
	}
}

function checkpaymentform()
{
	var clientname = document.getElementById('clientname').value;
	var amount = document.getElementById('amount').value;
	
	name_ok=true;
   	if (clientname == "") name_ok=false;

   	amount_ok=true;
	if (amount == "") 
   	{
   		amount_ok=false;
   	}
   	else
   	{
		if (isNaN(amount) == true) 
		{
			amount_ok=false;
		}
   	}

   	form_ok=(name_ok && amount_ok);

   	if (!form_ok)
   	{
      	if (!name_ok) 
		{
			alert("Please enter your name");
		}
		else
		{
			if (!amount_ok) 
			{
				alert("Please enter the amount you want to pay");
			}
		}
   	}

   	return form_ok;
}

function checkcontactform() 
{
	var firstname = document.getElementById('firstname').value;
	var lastname = document.getElementById('lastname').value;
	
	var name_ok=true;
	if (firstname == "") 
	{
		name_ok=false;
	}
	else
	{
		if (firstname.match("@") == "@" || firstname.match("href") == "href" || firstname.match("http://") == "http://" || firstname.match("https://") == "https://")
		{
			name_ok=false;
		}
	}
	
	if (lastname == "") 
	{
		name_ok=false;
	}
	else
	{
		if (lastname.match("@") == "@" || lastname.match("a href") == "a href" || lastname.match("http://") == "http://" || lastname.match("https://") == "https://")
		{
			name_ok=false;
		}
	}
	
	var address = document.getElementById('address').value;
	var city = document.getElementById('city').value;
	var state = document.getElementById('state').value;
	var zip = document.getElementById('zip').value;
	
	var address_ok=true;
	if (address == "") 
	{
		address_ok=false;
	}
	else
	{
		if (address.match("@") == "@" || address.match("a href") == "a href" || address.match("http://") == "http://" || address.match("https://") == "https://")
		{
			address_ok=false;
		}
	}
	
	if (city == "") 
	{
		address_ok=false;
	}
	else
	{
		if (city.match("@") == "@" || city.match("a href") == "a href" || city.match("http://") == "http://" || city.match("https://") == "https://")
		{
			address_ok=false;
		}
	}
	
	if (state == "") 
	{
		address_ok=false;
	}
	else
	{
		if (state.length < 2)
		{
			address_ok=false;
		}
	}
	
	if (zip == "") 
	{
		address_ok=false;
	}
	else
	{
		if (zip.length < 5)
		{
			address_ok=false;
		}
		else
		{
			if (isNaN(zip))
			{
				address_ok=false;
			}
		}
	}

	var homephone1 = document.getElementById('homephone1').value;
	var homephone2 = document.getElementById('homephone2').value;
	var homephone3 = document.getElementById('homephone3').value;
	
	var workphone1 = document.getElementById('workphone1').value;
	var workphone2 = document.getElementById('workphone2').value;
	var workphone3 = document.getElementById('workphone3').value;
	
	var phone_ok=true;
	if (document.getElementById('nohomephone').checked == false)
	{
		if (homephone1 == "" && homephone2 == "" && homephone3 == "") 
		{
			phone_ok=false;
		}
		else
		{
			if (homephone1 == "" || homephone2 == "" || homephone3 == "") 
			{
				phone_ok=false;
			}
			else
			{
				if (isNaN(homephone1) || isNaN(homephone2) || isNaN(homephone3))
				{
					phone_ok=false;
				}
				else
				{
					if (homephone1.length != 3 || homephone2.length != 3 || homephone3.length != 4)
					{
						phone_ok=false;
					}
				}
			}
		}
	}
	
	if (document.getElementById('noworkphone').checked == false)
	{
		if (workphone1 == "" && workphone2 == "" && workphone3 == "") 
		{
			phone_ok=false;
		}
		else
		{
			if (workphone1 == "" || workphone2 == "" || workphone3 == "") 
			{
				phone_ok=false;
			}
			else
			{
				if (isNaN(workphone1) || isNaN(workphone2) || isNaN(workphone3))
				{
					phone_ok=false;
				}
				else
				{
					if (workphone1.length != 3 || workphone2.length != 3 || workphone3.length != 4)
					{
						phone_ok=false;
					}
				}
			}
		}
	}
	
	var email=document.getElementById('email').value;
	
	var email_ok=true;
	if (email == "") 
	{
		email_ok=false;
	}
	else
	{
		if (email.match("href") == "href" || email.match("http://") == "http://" || email.match("https://") == "https://") 
		{
			email_ok=false;
		}
		else
		{
			var apos=email.indexOf("@");
			var dotpos=email.lastIndexOf(".");
			if (apos < 1 || dotpos-apos < 2)
			{
				email_ok=false;
			}
		}
	}
	
	var message = document.getElementById('message').value;

	comments_ok=true;
	if (message == "") 
	{
		comments_ok=false;
	}
	else
	{
		if (message.match("href") == "href" || message.match("@") == "@" || message.match("http://") == "http://" || message.match("https://") == "https://") 
		{
			comments_ok=false;
		}
	}

	form_ok = (name_ok && address_ok && phone_ok && email_ok && comments_ok);

	if (!form_ok) 
	{
		if (!name_ok) 
		{
			alert("Please enter your name");
		}
		else
		{
			if (!address_ok) 
			{
				alert("Please enter your address");
			}
			else
			{
				if (!phone_ok) 
				{
					alert("Please enter your phone numbers");
				}
				else
				{
					if (!email_ok) 
					{
						alert("Please enter your email address");
					}
					else
					{
						if (!comments_ok) 
						{
							alert("Please enter your comments");
						}
					}
				}
			}
		}
	}

	return form_ok;
}

function nophone(phonetype)
{
	if (phonetype == "home")
	{
		if (document.getElementById('nohomephone').checked == true)
		{
			document.getElementById('homephone1').value = "";
			document.getElementById('homephone2').value = "";
			document.getElementById('homephone3').value = "";
			document.getElementById('homephone1').readOnly = true;
			document.getElementById('homephone2').readOnly = true;
			document.getElementById('homephone3').readOnly = true;
		}
		else
		{
			document.getElementById('homephone1').readOnly = false;
			document.getElementById('homephone2').readOnly = false;
			document.getElementById('homephone3').readOnly = false;
			document.getElementById('homephone1').focus();
		}
	}
	else if (phonetype == "work")
	{
		if (document.getElementById('noworkphone').checked == true)
		{
			document.getElementById('workphone1').value = "";
			document.getElementById('workphone2').value = "";
			document.getElementById('workphone3').value = "";
			document.getElementById('workphone1').readonly = "true";
			document.getElementById('workphone2').readonly = "true";
			document.getElementById('workphone3').readonly = "true";
		}
		else
		{
			document.getElementById('workphone1').readonly = "false";
			document.getElementById('workphone2').readonly = "false";
			document.getElementById('workphone3').readonly = "false";
			document.getElementById('workphone1').focus();
		}
	}
}

function checkbookform() 
{
	var firstname = document.getElementById('firstname').value;
	var lastname = document.getElementById('lastname').value;
	
	var name_ok=true;
	if (firstname == "") 
	{
		name_ok=false;
	}
	else
	{
		if (firstname.match("@") == "@" || firstname.match("href") == "href" || firstname.match("http://") == "http://" || firstname.match("https://") == "https://")
		{
			name_ok=false;
		}
	}
	
	if (lastname == "") 
	{
		name_ok=false;
	}
	else
	{
		if (lastname.match("@") == "@" || lastname.match("a href") == "a href" || lastname.match("http://") == "http://" || lastname.match("https://") == "https://")
		{
			name_ok=false;
		}
	}
	
	var address = document.getElementById('address').value;
	var city = document.getElementById('city').value;
	var state = document.getElementById('state').value;
	var zip = document.getElementById('zip').value;
	
	var address_ok=true;
	if (address == "") 
	{
		address_ok=false;
	}
	else
	{
		if (address.match("@") == "@" || address.match("a href") == "a href" || address.match("http://") == "http://" || address.match("https://") == "https://")
		{
			address_ok=false;
		}
	}
	
	if (city == "") 
	{
		address_ok=false;
	}
	else
	{
		if (city.match("@") == "@" || city.match("a href") == "a href" || city.match("http://") == "http://" || city.match("https://") == "https://")
		{
			address_ok=false;
		}
	}
	
	if (state == "") 
	{
		address_ok=false;
	}
	else
	{
		if (state.length < 2)
		{
			address_ok=false;
		}
	}
	
	if (zip == "") 
	{
		address_ok=false;
	}
	else
	{
		if (zip.length < 5)
		{
			address_ok=false;
		}
		else
		{
			if (isNaN(zip))
			{
				address_ok=false;
			}
		}
	}

	var phone1 = document.getElementById('phone1').value;
	var phone2 = document.getElementById('phone2').value;
	var phone3 = document.getElementById('phone3').value;
	
	var phone_ok=true;
	if (phone1 == "" || phone2 == "" || phone3 == "") 
	{
		phone_ok=false;
	}
	else
	{
		if (isNaN(phone1) || isNaN(phone2) || isNaN(phone3))
		{
			phone_ok=false;
		}
		else
		{
			if (phone1.length != 3 || phone2.length != 3 || phone3.length != 4)
			{
				phone_ok=false;
			}
		}
	}
	
	var email=document.getElementById('email').value;
	
	var email_ok=true;
	if (email == "") 
	{
		email_ok=false;
	}
	else
	{
		if (email.match("href") == "href" || email.match("http://") == "http://" || email.match("https://") == "https://") 
		{
			email_ok=false;
		}
		else
		{
			var apos=email.indexOf("@");
			var dotpos=email.lastIndexOf(".");
			if (apos < 1 || dotpos-apos < 2)
			{
				email_ok=false;
			}
		}
	}

	form_ok = (name_ok && address_ok && phone_ok && email_ok);

	if (!form_ok) 
	{
		if (!name_ok) 
		{
			alert("Please enter your name");
		}
		else
		{
			if (!address_ok) 
			{
				alert("Please enter your address");
			}
			else
			{
				if (!phone_ok) 
				{
					alert("Please enter your phone numbers");
				}
				else
				{
					if (!email_ok) 
					{
						alert("Please enter your email address");
					}
				}
			}
		}
	}

	return form_ok;
}

function checknewsletter()
{
	var email = document.getElementById('email').value;
	
	var email_ok=true;
	if (email == "") 
	{
		email_ok=false;
	}
	else
	{
		var apos=email.indexOf("@");
		var dotpos=email.lastIndexOf(".");
		if (apos < 1 || dotpos-apos < 2)
		{
			email_ok=false;
		}
	}
	
	form_ok=email_ok;
	
	if (!form_ok)
	{
		if (!email_ok) alert("Please enter your email address");
	}
	
	return form_ok;
}

function submitform(id)
{
	document.getElementById(id).submit();
}

function gettodaysdate()
{
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	document.getElementById('todaysdate').value = month + "/" + day + "/" + year;
}
	
function movephone(id, nextid)
{
	if (document.getElementById(id).value.length == 3)
	{
		document.getElementById(nextid).focus();
	}
}

function figurewidth()
{
	var scrwidth = new Number(screen.availWidth);
	var scrmargin = 0
	var pagewidth = document.getElementById('page').style.width;
	var pgwidth = new Number(pagewidth.substr(0, pagewidth.length-2));
	
	if (((scrwidth / 2) - (pgwidth / 2)) > 0)
	{
		scrmargin = (scrwidth / 2) - (pgwidth / 2);
	}
	
	document.getElementById('page').style.position = 'absolute';
	document.getElementById('page').style.left = scrmargin+'px';
	document.getElementById('page').style.top = '0px';
}

function numbers(id)
{
	var input = document.getElementById(id).value;
	
	if (isNaN(input))
	{
		alert("Entry is not a number");
		document.getElementById(id).value = "0.00";
		document.getElementById(id).focus();
	}
	else
	{
		var price = new Number(input);
		price = price.toFixed(2);
		document.getElementById(id).value = price;
	}
}

function numbers2(id)
{
	var input = document.getElementById(id).value;
	
	if (isNaN(input))
	{
		alert("Entry is not a number");
		document.getElementById(id).value = "";
		document.getElementById(id).focus();
	}
}

function addincome(id)
{
	var input = document.getElementById(id).value;
	
	if (isNaN(input))
	{
		alert("Entry is not a number");
		document.getElementById(id).value = "0.00";
		document.getElementById(id).focus();
	}
	else
	{
		var price = new Number(input);
		price = price.toFixed(2);
		document.getElementById(id).value = price;
		
		income = new Array();
		income[1] = document.getElementById('amt1').value;
		income[2] = document.getElementById('amt2').value;
		income[3] = document.getElementById('amt3').value;
		
		totalincome = 0;
		for(i=1; i<=3; i++)
		{
			totalincome += new Number(income[i]);
		}
		
		document.getElementById('totalincome').value = new Number(totalincome).toFixed(2);
	}
}

function addexpense(id)
{
	var input = document.getElementById(id).value;
	
	if (isNaN(input))
	{
		alert("Entry is not a number");
		document.getElementById(id).value = "0.00";
		document.getElementById(id).focus();
	}
	else
	{
		var price = new Number(input);
		price = price.toFixed(2);
		document.getElementById(id).value = price;
		
		var element = "";
	
		expense = new Array();
	
		for(i=1; i<=36; i++)
		{
			element = 'amt'+i;
			expense[i] = document.getElementById(element).value;
		}
	
		totalexpense = 0;
		for(i=1; i<=36; i++)
		{
			totalexpense += new Number(expense[i]);
		}
		
		document.getElementById('totalexpenses').value = new Number(totalexpense).toFixed(2);
	}
}

function profitloss()
{
	var totalincome = new Number(document.getElementById('totalincome').value);
	var totalexpenses = new Number(document.getElementById('totalexpenses').value);
	var pl = new Number(totalincome - totalexpenses);
	
	document.getElementById('grossincome').value = pl.toFixed(2);	
}

function clearbox()
{
	var message = document.getElementById('comments').value;
	
	if (message == "Type Comments Here...")
	{
		document.getElementById('comments').value = "";
	}
}

function match(col1, col2)
{
	var c1 = document.getElementById(col1).value;
	
	if (c1 == "")
	{
		document.getElementById(col2).value = "";
	}
}

function populatezero(col1, col2)
{
	var c1 = document.getElementById(col1).value;
	
	if (c1 != "")
	{
		document.getElementById(col2).value = "0.00";
	}
}