$(document).ready( function() {
	$("#show-help").hide();
});

function showHelp(pMessage)
{
	if(pMessage != '')
	{
		vCloseLink = '<br /><br /><a href="javascript:void(0);" onclick="closeHelp()">close help</a>';
		$("#show-help").html(pMessage + vCloseLink);
		$("#show-help").show();
	}
}

function closeHelp()
{
	$("#show-help").hide();
}

function showVendorPricingOptions(i)
{
	vOption = $("#sel_vendor_pricing_" + i).val();
	
	hideAll(i);
	
	if(vOption != '')
	{
		if(vOption == 1)
		{
			$("#txt_vendor_cost_server_" + i + "_div").show();
		}
		else if(vOption == 2)
		{
			$("#txt_vendor_cpus_" + i + "_div").show();
			$("#txt_vendor_cost_cpu_" + i + "_div").show();
		}
		else if(vOption == 3)
		{
			$("#txt_vendor_cost_tb_" + i + "_div").show();
		}
		else if(vOption == 4)
		{
			$("#txt_vendor_cost_tb_sub_" + i + "_div").show();
		}
	}
}

function hideAll(i)
{
	$("#txt_vendor_cpus_" + i + "_div").hide();
	$("#txt_vendor_cost_server_" + i + "_div").hide();
	$("#txt_vendor_cost_cpu_" + i + "_div").hide();
	$("#txt_vendor_cost_tb_" + i + "_div").hide();
	$("#txt_vendor_cost_tb_sub_" + i + "_div").hide();
}

function makeEditable(val)
{
	$("#" + val).removeAttr("readonly");
}

function makeReadOnly(val)
{
	$("#" + val).attr("readonly","readonly");
}

function checkTerabyteValue()
{
	vTerabytes = $("#txt_infobright_terabytes").val();

	if(vTerabytes > 19)
	{
		showHelp('For Terabyte values greater than 20 TB, please call us for a customized TCO Comparison');
		$("#hid_submit_tco").val(0);
	}
	else
	{
		$("#hid_submit_tco").val(1);
	}
}

function checkSubmit()
{
	checkTerabyteValue();
	
	if($("#hid_submit_tco").val() == '1')
	{
		return true;
	}
	else
	{
		return false;
	}
}
