/* Determines lang value */
var contentLocale = document.getElementsByTagName("html")[0].lang;
var callmelang = 'en';
var globalLocale = (contentLocale != 'undefined') ? contentLocale : callmelang;

if (globalLocale.substring(0,2)=="zh")	/* If Locale Is Chinese, Correct for NI Global Gateway to Set NI Locale */
{
	if (contentLocale == "zh-CN") globalLocale = "zh-CN";
	if (contentLocale == "zh-TW") globalLocale = "zh-TW";
}
else
{
	contentLocale = contentLocale.substring(0,2);	/* Otherwise Need Only Two-Letter Language Code From Locale to Set NILocale */
	globalLocale = contentLocale;
}

var alerttext='You must select at least one item to continue.';

if (globalLocale == 'en') alerttext = 'You must select at least one item to continue.';
if (globalLocale == 'de') alerttext = 'Wählen Sie mindestens ein Element aus, um fortzufahren.';
if (globalLocale == 'fr') alerttext = 'Vous devez choisir au moins un produit pour continuer';
if (globalLocale == 'it') alerttext = 'Selezionare almeno un prodotto prima di continuare';
if (globalLocale == 'es') alerttext = 'Para continuar seleccione por lo menos un producto';
if (globalLocale == 'ja') alerttext = "少なくても１つ以上製品を選択してください。";
if (globalLocale == 'ko') alerttext = "계속하시려면 최소한 한 개 이상의 품목을 선택하셔야 합니다. ";
if (globalLocale == 'zh-CN') alerttext = "您必须至少选择一项才能继续。";
if (globalLocale == 'zh-TW') alerttext = "你必須選擇至少一項，才能繼續。";

function anyCheck(form)
{
	var total = 0;
	var max = form.compareitem.length;
	if (max == null)
	{
		if (eval("document.comparelist.compareitem.checked") == true)
		{
			total = 1;
		}
		else
		{
			total = 0;
		}
	}
	else
	{
		for (var idx = 0; idx < max; idx++)
		{
			if (eval("document.comparelist.compareitem[" + idx + "].checked") == true)
			{
				total += 1;
			}
		}
	}
	var formAction = form.action ;
	var posSD = formAction.indexOf("/sd/");
	
	
	if (total <= 0 && posSD < 0)
	{
		
		alert(alerttext);
	}
	else
	{
		document.comparelist.submit();
	}
}

/* Launches Call Me Window */
function openNewWindow(URL){
    var parent_url = URL
    var amp = '&'
    NewWindow=window.open("https://sine.ni.com/apps/utf8/nicc.call_me?p_action=call&p_confirm=Y &p_form_id=CALLME&p_url=" + parent_url.replace(amp, "%26").replace(amp, "%26") , "awindow", "width=650,height=650");}
    function get_url(URL){
    alert (URL)
}

function popUp(theURL) {
   var newWin=open(theURL,"callMeWhatIs","width=425,height=450,scrollbars=1,menubar=0,toolbar=0,resizable=1,left=100,top=100,screenX=100,screenY=100");
}

function saveChecked(theid)
{	
	document.comparelist.action = document.getElementById(theid).href;
	document.comparelist.submit();
}
function meta(facet,value)
{
	dcsMultiTrack('DCS.dcssip','multitrack.ni.com','DCS.dcsuri','FNTracking','DCS.dcsqry','','DCSext.NI_SelectedFacet',facet, 'DCSext.NI_SelectedFacetValue',value);
}

