function doBlankLogin (elName, elValue) {

    if (elValue == "") {
        document.getElementById(elName).value = "";
        document.getElementById(elName).className = "loginBox";
        document.getElementById(elName).style.background = "";
        document.getElementById(elName).style.backgroundColor = "#fff";
    }
}

function changePage (entryType, AccountID) {

	if (entryType == "stock") {
		document.location = "/index.php?section=stocktracker&subsection=stockadd&AccountID="+AccountID;
	} else if (entryType == "holding") {
		document.location = "/index.php?section=cashbalances&subsection=cashadd&cashType=holding&AccountID="+AccountID+"&source=stocks";
	} else if (entryType == "loss") {
		document.location = "/index.php?section=cashbalances&subsection=cashadd&cashType=loss&AccountID="+AccountID+"&source=stocks";
	} else if (entryType == "stockprofit") {
		document.location = "/index.php?section=cashbalances&subsection=cashadd&cashType=stockprofit&AccountID="+AccountID+"&source=stocks";
	}
}

function setSpotUnit() {

	if (document.getElementById("OwnType").value == "GOLDBULLION" || document.getElementById("OwnType").value == "PLATINUMBULLION") {
		if (document.getElementById("SpotRate").value == "") {
			document.getElementById("SpotRateUnit").selectedIndex = 0;
		}
		if (document.getElementById("Weight").value == "") {
			document.getElementById("WeightUnit").selectedIndex = 0;
		}
	} else if (document.getElementById("OwnType").value == "GOLDCOIN" || document.getElementById("OwnType").value == "PLATINUMCOIN") {
		if (document.getElementById("SpotRate").value == "") {
			document.getElementById("SpotRateUnit").selectedIndex = 0;
		}
		if (document.getElementById("Weight").value == "") {
			document.getElementById("WeightUnit").selectedIndex = 0;
		}
	} else {
		if (document.getElementById("SpotRate").value == "") {
			document.getElementById("SpotRateUnit").selectedIndex = 1;
		}
		if (document.getElementById("Weight").value == "") {
			document.getElementById("WeightUnit").selectedIndex = 1;
		}
	}
}

function togglePremiumType (inVal) {

	if (inVal == 1) {
		document.getElementById("SpotRate").disabled = true;
		document.getElementById("PremiumRate").disabled = false;
	} else {
		document.getElementById("SpotRate").disabled = false;
		document.getElementById("PremiumRate").disabled = true;
	}
}

