﻿var knovaItems = new Array();

//knovaItems = ["Video","HDX Series","iPower™","PVX™","V Series","VSX™ Series","ViaVideo® II","ViewStation® Series","Other Video","Voice","Polycom Communicator","SoundPoint","SoundPoint IP","SoundStation","SoundStation IP Series","VoiceStation","Vortex","Collaboration &amp; Conferencing Platforms","Collaboration &amp; Conferencing Platforms","Security - Firewall Traversal","Other Network","PathNavigator™","Global Management System™","Other Bridging","ReadiManager® SE200","RMX 2000™","MGC™-25","SoundStation VTX 1000™","RPX™ HD Series"];

// following array maps respective product group in Knova for each product.

var allcontstr="All content";
var golbl="Go";

//if(baseurl == '/apac/cn')
//{
	//allcontstr ="全部内容";
	//golbl ="搜索";
//}


//if(!isdefined(tertiarydisplay))
//{
	//tertiarydisplay="";
//}

knovaItems =["Video","HDX Series","HDX 9001","HDX 9002","HDX 9004","HDX Celiing Microphone Array","iPower™","iPower™ 9000 Series","Other iPower™","iPower™ 600 and 685",
"iPower™ 960","iPower™ Development Systems","iPower™ Executive","QDX 6000™","PVX™","RPX™ HD Series","V Series","V500™","V700™","VSX™ Series","VSX™ 8000 Series","VSX™ 8800",
"VSX™ 8400","VSX™ 8000","VSX™ 7800","VSX™ 7400","VSX™ 7000e","VSX™ 7000s","VSX™ 7000","VSX™ 6000","VSX™ 5000","VSX™ 3000",
"ViaVideo® II","ViewStation® Series","ViewStation® FX","ViewStation® EX","ViewStation® SP 128","VS4000™","Other ViewStation®","ViewStation® 128/H.323/MP/512",
"ViewStation H.323","ViewStation MP","ViewStation® SP 384","Other Video","Voice","Business Media Phone","Polycom® VVX™ 1500","Polycom Communicator","Communicator C100S","Communicator C100",
"Polycom QSX","SoundPoint","SoundPoint","SoundPoint® Pro SE-220","SoundPoint® Pro SE-225","SoundPoint IP","SoundPoint® IP 300","Applications","SoundPoint® IP 301",
"SoundPoint® IP 430","SoundPoint® IP 500","SoundPoint® IP 501","SoundPoint® IP 550","SoundPoint® IP 600","SoundPoint® IP 601","SoundPoint® IP 650",
"SoundPoint® IP 330/320","SoundPoint® IP Attendant Console","SoundPoint® IP Expansion Module","SoundStation","SoundStation2™","SoundStation2W™",
"SoundStation Premier 500 / 500D","SoundStation2™ Avaya 2490","SoundStation2™ Direct Connect for Nortel","SoundStation Premier","Other SoundStation",
"SoundStation Intelligent Terminal Adapter","SoundStation IP Series","SoundStation® IP 4000","Other SoundStation® IP","SoundStation IP 3000","SoundStation IP 3000 3Com NBX",
"VoiceStation","Voicestation® 100","Voicestation® 300","Voicestation® 500","Vortex","EF2210 Single Channel Acoustic Echo / Noise Canceller","EF2211 Single Channel Acoustic Echo / Noise Canceller with Phone Add",
"EF2241 Automatic Mic/Matrix Mixer with Phone Hybrid and Power Amp","EF2280 Automatic Mic / Matrix Mixer with Echo and Noise Cancellation","EF2201 Telephone Interface",
"Other Vortex","EF1210","EF200 Phone Hybrid","EF400 Single Channel Echo and Noise Canceller","Collaboration & Conferencing Platforms","RMX 2000™","MGC™-25",
"MGC-50/MGC-100","MGC™+50 ReadiConvene","MGC™+100 ReadiConvene","ReadiVoice","WebOffice","Other Bridging","Management & Scheduling","ReadiManager® SE200",
"PathNavigator™","Global Management System™","Polycom Conference Suite","ReadiManager® LX100","Other Network","Security - Firewall Traversal","V²IU™ 4300T Series",
"V²IU™ 5300-E Series","V²IU™ 5300-S Series","V²IU™ 6400-S Series","Recording &amp; Streaming Solutions","Polycom® RSS™ 2000","Other Recording & Streaming","ReadiRecorder","SoundStation VTX 1000®"]

knovaItems["Video"] = ["SG_A_Video"];
knovaItems["HDX Series"] = ["SG_HDXSERIES_1_2"];
knovaItems["HDX 9001"] = ["SG_HDXSERIES_1_2"];
knovaItems["HDX 9002"] = ["SG_HDXSERIES_1_2"];
knovaItems["HDX 9004"] = ["SG_HDXSERIES_1_2"];
knovaItems["HDX Celiing Microphone Array"] = ["SG_HDXSERIES_1_2"];
knovaItems["iPower"] = ["SG_I_iPower"];
knovaItems["iPower™ 9000 Series"] = ["SG_I_iPower"];
knovaItems["Other iPower™"] = ["SG_I_iPower"];
knovaItems["iPower™ 600 and 685"] = ["SG_I_iPower"];
knovaItems["iPower™ 960"] = ["SG_I_iPower"];
knovaItems["iPower Development Systems"] = ["SG_I_iPower"];
knovaItems["iPower Executive"] = ["SG_I_iPower"];
knovaItems["QDX 6000™"] = ["SG_QDX_6000"];
knovaItems["PVX™"] = ["SG_PVX"];
knovaItems["RPX™ HD Series"] = ["SG_RPX_1_2"];
knovaItems["V Series"] = ["SG_VSERIES_1_2"];
knovaItems["V500™"] = ["SG_VSERIES_1_2"];
knovaItems["V700™"] = ["SG_VSERIES_1_2"];
knovaItems["VSX™ Series"] = ["SG_VSX_Series"];
knovaItems["VSX™ 8000 Series"] = ["SG_VSX_Series"];
knovaItems["VSX™ 8800"] = ["SG_VSX_Series"];
knovaItems["VSX™ 8400"] = ["SG_VSX_Series"];
knovaItems["VSX™ 8000"] = ["SG_VSX_Series"];
knovaItems["VSX™ 7800"] = ["SG_VSX_Series"];
knovaItems["VSX™ 7400"] = ["SG_VSX_Series"];
knovaItems["VSX™ 7000e"] = ["SG_VSX_Series"];
knovaItems["VSX™ 7000s"] = ["SG_VSX_Series"];
knovaItems["VSX™ 7000"] = ["SG_VSX_Series"];
knovaItems["VSX™ 6000"] = ["SG_VSX_Series"];
knovaItems["VSX™ 5000"] = ["SG_VSX_Series"];
knovaItems["VSX™ 3000"] = ["SG_VSX_Series"];
knovaItems["ViaVideo® II"] = ["SG_ViaVideo"];
knovaItems["ViewStation® Series"] = ["SG_ViewStation_Series"];
knovaItems["ViewStation® FX"] = ["SG_ViewStation_Series"];
knovaItems["ViewStation® EX"] = ["SG_ViewStation_Series"];
knovaItems["ViewStation® SP 128"] = ["SG_ViewStation_Series"];
knovaItems["VS4000™"] = ["SG_ViewStation_Series"];
knovaItems["Other ViewStation®"] = ["SG_ViewStation_Series"];
knovaItems["ViewStation® 128/H.323/MP/512"] = ["SG_ViewStation_Series"];
knovaItems["ViewStation H.323"] = ["SG_ViewStation_Series"];
knovaItems["ViewStation MP"] = ["SG_ViewStation_Series"];
knovaItems["ViewStation® SP 384"] = ["SG_ViewStation_Series"];
knovaItems["Other Video"] = ["SG_Z_Other_Video"];
knovaItems["Voice"] = ["SG_B_Audio"];
knovaItems["Business Media Phone"] = ["SG_Business_Media_Phone"];
knovaItems["Polycom® VVX™ 1500"] = ["SG_Polycom_VVX_1500"];
knovaItems["Polycom Communicator"] = ["SG_POLYCOMCOMMUNICATOR_1_2"];
knovaItems["Communicator C100S"] = ["SG_POLYCOMCOMMUNICATOR_1_2"];
knovaItems["Communicator C100"] = ["SG_POLYCOMCOMMUNICATOR_1_2"];
knovaItems["Polycom QSX"] = ["SG_Polycom_QSX"]; 
knovaItems["SoundPoint"] = ["SG_SoundPoint"];
knovaItems["SoundPoint® Pro SE-220"] = ["SG_SoundPoint"];
knovaItems["SoundPoint® Pro SE-225"] = ["SG_SoundPoint"];
knovaItems["SoundPoint IP"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 300"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 301"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 430"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 500"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 501"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 550"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 600"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 601"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 650"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP 330/320"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP Attendant Console"] = ["SG_SoundPoint_IP"];
knovaItems["SoundPoint® IP Expansion Module"] = ["SG_SoundPoint_IP"];
knovaItems["SoundStation"] = ["SG_SoundStation"];
knovaItems["SoundStation2™"] = ["SG_SoundStation"];
knovaItems["SoundStation2W™"] = ["SG_SoundStation"];
knovaItems["SoundStation Premier 500 / 500D"] = ["SG_SoundStation"];
knovaItems["SoundStation2™ Avaya 2490"] = ["SG_SoundStation"];
knovaItems["SoundStation2™ Direct Connect for Nortel"] = ["SG_SoundStation"];
knovaItems["SoundStation Premier"] = ["SG_SoundStation"];
knovaItems["Other SoundStation"] = ["SG_SoundStation"];
knovaItems["SoundStation Intelligent Terminal Adapter"] = ["SG_SoundStation"];
knovaItems["SoundStation IP Series"] = ["SG_SoundStation_IP"];
knovaItems["SoundStation® IP 4000"] = ["SG_SoundStation_IP"];
knovaItems["Other SoundStation® IP"] = ["SG_SoundStation_IP"];
knovaItems["SoundStation IP 3000"] = ["SG_SoundStation_IP"];
knovaItems["SoundStation IP 3000 3Com NBX"] = ["SG_SoundStation_IP"];
knovaItems["SoundStation VTX 1000®"] = ["SG_VTX1000_1_2"];
knovaItems["VoiceStation"] = ["SG_VoiceStation"];
knovaItems["Voicestation® 100"] = ["SG_VoiceStation"];
knovaItems["Voicestation® 300"] = ["SG_VoiceStation"];
knovaItems["Voicestation® 500"] = ["SG_VoiceStation"];
knovaItems["Vortex"] = ["SG_Vortex__EF_Series_"];
knovaItems["EF2210 Single Channel Acoustic Echo / Noise Canceller"] = ["SG_Vortex__EF_Series_"];
knovaItems["EF2211 Single Channel Acoustic Echo / Noise Canceller with Phone Add"] = ["SG_Vortex__EF_Series_"];
knovaItems["EF2241 Automatic Mic/Matrix Mixer with Phone Hybrid and Power Amp"] = ["SG_Vortex__EF_Series_"];
knovaItems["EF2280 Automatic Mic / Matrix Mixer with Echo and Noise Cancellation"] = ["SG_Vortex__EF_Series_"];
knovaItems["EF2201 Telephone Interface "] = ["SG_Vortex__EF_Series_"];
knovaItems["Other Vortex"] = ["SG_Vortex__EF_Series_"];
knovaItems["EF1210"] = ["SG_Vortex__EF_Series_"];
knovaItems["EF200 Phone Hybrid"] = ["SG_Vortex__EF_Series_"];
knovaItems["EF400 Single Channel Echo and Noise Canceller "] = ["SG_Vortex__EF_Series_"];
knovaItems["Collaboration & Conferencing Platforms"] = ["SG_C_Bridging___Collaboration"];
knovaItems["RMX 2000™"] = ["SG_RMX2000_1_2"];
knovaItems["RMX 2000&trade;"] = ["SG_RMX2000_1_2"];
knovaItems["MGC™-25"] = ["SG_MGC"];
knovaItems["MGC-50/MGC-100"] = ["SG_MGC"];
knovaItems["MGC™+50 ReadiConvene"] = ["SG_MGC"];
knovaItems["MGC™+100 ReadiConvene"] = ["SG_MGC"];
knovaItems["ReadiVoice"] = ["SG_ReadiSeries"];
knovaItems["WebOffice"] = ["SG_WebOffice "];
knovaItems["Other Bridging"] = ["SG_Z_Other_Bridging"];
knovaItems["Management & Scheduling"] = ["SG_D_Network___Endpoint_Management"];
knovaItems["ReadiManager® SE200"] = ["SG_ReadiSeries"];
knovaItems["PathNavigator™"] = ["SG_PathNavigator"];
knovaItems["Global Management System™"] = ["SG_Global_Management_System__GMS_"];
knovaItems["Polycom Conference Suite"] = ["SG_Polycom_Conference_Suite__PCS_"];
knovaItems["ReadiManager® LX100"] = ["SG_ReadiSeries"];
knovaItems["Other Network"] = ["SG_Z_Other_Network"];
knovaItems["Security - Firewall Traversal"] = ["SG_V2IU_Series"];
knovaItems["V²IU™ 4300T Series"] = ["SG_V2IU_Series"];
knovaItems["V&sup2;IU&trade; 4300T Series"] = ["SG_V2IU_Series"];
knovaItems["V²IU™ 5300-E Series"] = ["SG_V2IU_Series"];
knovaItems["V&sup2;IU&trade; 5300-E Series"] = ["SG_V2IU_Series"];
knovaItems["V²IU™ 5300-S Series"] = ["SG_V2IU_Series"];
knovaItems["V&sup2;IU&trade; 5300-S Series"] = ["SG_V2IU_Series"];
knovaItems["V²IU™ 6400-S Series"] = ["SG_V2IU_Series"];
knovaItems["V&sup2;IU&trade; 6400-S Series"] = ["SG_V2IU_Series"];
knovaItems["Recording &amp; Streaming Solutions"] = ["SG_C_Bridging___Collaboration"];
knovaItems["Polycom® RSS™ 2000"] = ["SG_ReadiSeries"];
knovaItems["Other Recording & Streaming"] = ["SG_Z_Other_Bridging"];
knovaItems["ReadiRecorder"] = ["SG_ReadiSeries"];


// Whenever user searchs in KB, java script has to prevfix the product name with search string,
// But for cetain products, prefix string is not as same as product name
// in that case, add that product in this array with respective modified string for this product. 

var productmap=new Array();
productmap =["V²IU™ 4300T Series","V²IU™ 5300-S Series","V²IU™ 5300-E Series","V²IU™ 6400-S Series","EF2210 Single Channel Acoustic Echo / Noise Canceller","EF2211 Single Channel Acoustic Echo / Noise Canceller with Phone Add","EF2241 Automatic Mic/Matrix Mixer with Phone Hybrid and Power Amp","EF2280 Automatic Mic / Matrix Mixer with Echo and Noise Cancellation","EF2201 Telephone Interface","EF200 Phone Hybrid"];
productmap["V²IU™ 4300T Series"]=["V2IU"];
productmap["V²IU™ 5300-S Series"]=["V2IU"];
productmap["V²IU™ 5300-E Series"]=["V2IU"];
productmap["V²IU™ 6400-S Series"]=["V2IU"];
productmap["EF2210 Single Channel Acoustic Echo / Noise Canceller"]=["EF2210"];
productmap["EF2211 Single Channel Acoustic Echo / Noise Canceller with Phone Add"]=["EF2211"];
productmap["EF2241 Automatic Mic/Matrix Mixer with Phone Hybrid and Power Amp"]=["EF2241"];
productmap["EF2280 Automatic Mic / Matrix Mixer with Echo and Noise Cancellation"]=["EF2280"];
productmap["EF2201 Telephone Interface"]=["EF2201"];
productmap["EF200 Phone Hybrid"]=["EF200"];
productmap["SoundStation2™ Direct Connect for Nortel"]=["SoundStation2 Nortel"];
productmap["SoundStation2™ Avaya 2490"]=["SoundStation2 Avaya"];
productmap["SoundStation Premier 500 / 500D"]=["SoundStation Premier 500 500D"];
productmap["SoundStation® IP"]=["SoundStation IP"];
productmap["Vortex"]=[""];
productmap["MGC™+50 ReadiConvene"]=["MGC+50"]; 
productmap["MGC™+100 ReadiConvene"]=["MGC+100"]; 
productmap["Polycom® RSS™ 2000"]=["RSS 2000"];
productmap["Other SoundStation"]=["SoundStation"];
productmap["Other SoundStation® IP"]=["SoundStation IP"];
productmap["Other Vortex"]=["Vortex"];

//  For certain products, no need to provide FAQ link and option buttons those products should be placed in this array.

var faqlinkmap= new Array();
faqlinkmap=["Security - Firewall Traversal","Security &ndash; Firewall Traversal","Mobile Responder™",
"Mobile Responder&trade;","Mobile","240/260 System","550 System","760 Compact System","760XL Compact System","Concorde 4500™ System","Intel® TeamStation™ System","Interactive FlipChart",
"Interactive WhiteBoard","OnWAN 250/350 System","Personal WhiteBoard","Premier Video Communications Solutions",
"ProShare® Video System 500","SwiftSite™ Compact System","Venue 2000™ System","Live100™ System","Live200™ & Live200™ NT System",
"Live50™ System","LiveDTK™","LiveGateway™ System","LiveLan™ System","LiveScheduler™","SoundStation Intelligent Terminal Adapter",
"Other Network","140 LiveManager","210 H.323 Terminal Adapter","Other Bridging","Montage Enterprise Multipoint Conferencing Server",
"330 NetConference Multipoint Server","Prism Workgroup Conferencing Server","MGC-50/MGC-100 ","Recording & Streaming Solutions","Recording &amp; Streaming Solutions",
"Web Office","Other Recording & Streaming"];
// Removed product from faqmaplink on 3/14/2008  by Mohan. HM Request. Collaboration & Conferencing Platforms

// Dispalying modified option values for a product

var optstrmap= new Array();
optstrmap=["Other SoundStation® IP","Other Vortex"];
optstrmap["Other SoundStation® IP"]=["SoundStation IP"];
optstrmap["Other Vortex"]=["Vortex"];

/*
*This function is deciding whether product has the faq link or not
*/
function showfaqlink(prodname)
{
//alert(prodname);
	var linkflg=true;
	if(isdefined(prodname))
	{
	
		for(var i=0; i<faqlinkmap.length;i++ )
		{
			mapstr= faqlinkmap[i];
			//alert(mapstr +"|||"+prodname);
			if(prodname == mapstr)
			{
				linkflg=false;
			}
		}
	}else
	{
			linkflg=false;
	
	}
	//alert(linkflg);
	return linkflg;
}

/*
* Validating the variable
*/
function isdefined(param)
{
	var defineflag= true;
	if(typeof param=="undefined")
		{
			defineflag=false;
		}
	
	return defineflag;
}

// Getting Knova search Category value
function knovaValue(prodcutname)
{
	var itemname=knovareplace(prodcutname);
	
	var category = knovaItems[itemname];
	if(!isdefined(category))
	 {
		//if value is undefined, take product value as a default value.
			itemname=stringreplace(itemname);
			category ="SG_"+itemname;
	 }
	return category;
}

// validate tertiarydisplay 

function isvaluepresent(dispstr)
{
	var flg=true;
	if(!isdefined(dispstr) || isdefined(dispstr) && dispstr == "")
	{
			flg=false;
	}
	return flg;
}


// Getting Modified option dispaly valye
function getoptionvalue(productname)
{
	//alert ("productname"+productname);
	//productname=primarynavtitle;
	if(isdefined(tertiarynavtitle) && isvaluepresent(tertiarynavtitle)&& tertiarynavtitle !='None')
	{
		productname=tertiarynavtitle;
	}else if( isdefined(secondnavtitle) && secondnavtitle !='' && secondnavtitle !='None')
	{
		productname=secondnavtitle;
	}else if( isdefined(primarynavtitle) && primarynavtitle !='' && primarynavtitle !='None')
	{
		productname=primarynavtitle;
	}

	//alert ("productname"+productname);
	var modifiedprodvalue = optstrmap[productname];
	if(!isdefined(modifiedprodvalue))
	 {
			modifiedprodvalue=stringreplace(productname);			
	 }
	 //alert ("modifiedprodvalue"+modifiedprodvalue);
	return modifiedprodvalue;
	
}

// Modifying product display value.

function productmapping(productname)
{
	var mappedstr = productmap[productname];
	if(!isdefined(mappedstr))
	 {
			mappedstr=stringreplace(productname);			
	 }
	return mappedstr;
}


// Submitting search query
function refineQuerysearch(query,ss) {

	var prodvalue='';
	query=productmapping(query)+"";
	
	var prodcategory = knovaValue(base_prodname);

	//alert(prodcategory);
	sString = ss;
	origtext = document.inquiry2.searchString.value;
	//determine what radio button is checked
	for (i = 0; i < document.inquiry2.product.length; i++) {
				  if (document.inquiry2.product[i].checked) 
					{  
					  if(i==0){
					  document.inquiry2.product[i].value = prodcategory;
					  prodvalue = prodcategory;
					 }
					}
		}
		
	// validate the prodvalue
	if(typeof prodvalue=="undefined")
	{
		prodvalue='';
	}
	if(!isdefined(prodvalue))
	{
		prodvalue='';
	}
	//if all chosen, no prepoulate SG
	if(prodvalue == ''){
			q='';
	} 
	document.inquiry2.searchMode.value=sString;

//if no search string entered, bring user to front page of KB		
//if (origtext !='')
//{
	q = query.toUpperCase();
	//if string includes Ask A Question, set the search string to empty
	testtext = 'Ask A Question';
	j = testtext.indexOf(origtext);
	if (j >-1)
	{
	document.inquiry2.searchString.value = '';
	}
	
	text = document.inquiry2.searchString.value;
	t = text.toUpperCase();
	i = t.indexOf(q);
	if (i < 0)
	{
	text = query+" "+ text; 
	//temptext = text
	//text = text.replace(' ','%20');
	document.inquiry2.searchString.value = text;
	}//end if
	document.inquiry2.target='_blank';
	document.inquiry2.submit();
//} //end function	
}//end function


// When ever user press the ENTER key, following function will be called by form
function refineQuerysearchKeyEnter(query,ss) {

	var prodvalue='';
	query=productmapping(query)+"";
	
	var prodcategory = knovaValue(base_prodname);

	//alert(prodcategory);
	sString = ss;
	origtext = document.inquiry2.searchString.value;
	//determine what radio button is checked
	for (i = 0; i < document.inquiry2.product.length; i++) {
				  if (document.inquiry2.product[i].checked) 
					{  
					  if(i==0){
					  document.inquiry2.product[i].value = prodcategory;
					  prodvalue = prodcategory;
					 }
					}
		}
		
	// validate the prodvalue
	if(typeof prodvalue=="undefined")
	{
		prodvalue='';
	}
	if(!isdefined(prodvalue))
	{
		prodvalue='';
	}
	//if all chosen, no prepoulate SG
	if(prodvalue == ''){
			q='';
	} 
	document.inquiry2.searchMode.value=sString;

//if no search string entered, bring user to front page of KB		
//if (origtext !='')
//{
	q = query.toUpperCase();
	//if string includes Ask A Question, set the search string to empty
	testtext = 'Ask A Question';
	j = testtext.indexOf(origtext);
	if (j >-1)
	{
	document.inquiry2.searchString.value = '';
	}
	
	text = document.inquiry2.searchString.value;
	t = text.toUpperCase();
	i = t.indexOf(q);
	if (i < 0)
	{
	text = query+" "+ text; 
	//temptext = text
	//text = text.replace(' ','%20');
	document.inquiry2.searchString.value = text;
	}//end if
	document.inquiry2.target='_blank';
//} //end function	
}//end function

function refineQuery(query) {
	origtext = document.inquiry2.searchString.value;
	//determine what radio button is checked
	for (i = 0; i < document.inquiry2.product.length; i++) {
				  if (document.inquiry2.product[i].checked) prodvalue = document.inquiry2.product[i].value;
		}
	//if all chosen, no prepoulate SG
		if(prodvalue == ''){
				q='';
		} 
		
//if no search string entered, bring user to front page of KB		
if (origtext !='')
{
	q = query.toUpperCase();
	//if string includes Ask A Question, set the search string to empty
	testtext = 'Ask A Question';
	j = testtext.indexOf(origtext);
	//alert(j);
	if (j >-1)
	{
	document.inquiry2.searchString.value = '';
	}
	
	text = document.inquiry2.searchString.value;
	t = text.toUpperCase();
	i = t.indexOf(q);
	if (i < 0)
	{
	text = query +" "+ text; 
	document.inquiry2.searchString.value = text;
	}//end if

} //end if	





}//end function

//used for top level searches to determine which division and product objid
function refineProd() {
		for (var i=0; i < document.inquiry2.division.length; i++)
		   {
		   if (document.inquiry2.division[i].checked)
			  {
			  var d = document.inquiry2.division[i].value;
			  }
		   }
		if (d == 'audio')
		{
			document.inquiry2.prodobj.value = 'obj(42265)'
		}
		else if (d == 'video')
		{
			document.inquiry2.prodobj.value = 'obj(42266)'
		}
		else if (d == 'mgc')
		{
			document.inquiry2.prodobj.value = 'obj(42267)'
		}
} 

function advSearch() {
	if (document.inquiry2.product.value == ''){
	document.inquiry2.searchMode.value='ExpertSearch';
	}
	
}
function guidedSearch() {
	if (document.inquiry2.product.value == ''){
	document.inquiry2.searchMode.value='guidedSearch';
	}
	
}

function clearField(field){
if (field.defaultValue==field.value)
	field.value = "";
} 

function chooseTarget(form){
var url=location.href;

var na_true = url.indexOf(",pw");
if (na_true ==  -1)
{
	form.target='_blank';
}
else
{
	form.target='_self';
}


}
function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i]+"+";
	return tstring;
}

function stringreplace(textvalue)
{
	var replacechar=new Array();
	replacechar=["&trade;","&reg;"];
	
	for(i = 0; i < replacechar.length; i++)
	{
		textvalue = textvalue.replace(/&trade;/g,"");
		textvalue = textvalue.replace(/&reg;/g,"");
		textvalue = textvalue.replace(/™/g,"");
		textvalue = textvalue.replace(/®/g,"");
		//alert(textvalue);
	}
	
	return textvalue;
}

function knovareplace(textvalue)
{
	var replacechar=new Array();
	replacechar=["&trade;","&reg;"];
	
	//for(i = 0; i < replacechar.length; i++)
	//{
		textvalue = textvalue.replace(/&trade;/g,"™");
		textvalue = textvalue.replace(/&reg;/g,"®");
		//alert(textvalue);
	//}
	
	return textvalue;
}


function openfaqpage()
{
	var itemname=stringreplace(rhs_second_nav);
	var secondvalue=removeSpaces(itemname);
	var prodcategory =knovaValue(rhs_second_nav);
	var url="http://knowledgebase.polycom.com/kb/browse.do?WidgetName=BROWSE_PRODUCT&BROWSE_PRODUCT.TaxoName=SG_SupportGoals&NodeType=leaf&NodeName="+secondvalue+"&TaxoName=SG_SupportGoals&BROWSE_PRODUCT.isProductTaxonomy=true&BROWSE_PRODUCT.NodeId="+prodcategory+"&BROWSE_PRODUCT.NodeType=leaf&BROWSE_PRODUCT.thisPageUrl=%2Fproduct%2Fproducts.do&NodeId="+prodcategory+"&id=m1&AppContext=AC_ProductPage";
	window.open(url);
}

function kbradiobuttons(rhssecondnav, prodname)
{
	
	document.write('<tr><td> <table width="145" border="0" cellspacing="0" cellpadding="0" class="text11_333333"> <tr>') ;  
	document.write('<td width="20"><input name="product" type="radio" value="SG_'+rhssecondnav+'1_2" class="text11_333333" checked/><td width="125" valign="middle">'+getoptionvalue(prodname)+'</td>');
	document.write('</tr><tr><td> <input type="radio" value="" class="text11_333333" name="product"/></td><td valign="middle">'+allcontstr+'</td>');
    document.write(' </tr></table> </td></tr>');

}

function knovanonfaqsubmit()
{
	document.write(' <input type="text" onfocus="clearField(this);" style="width:95px;" class="text11_333333" name="searchString" onkeydown="javascript:knovasubmit(\'\',\'GuidedSearch\',event)"/>	') ;				  
	document.write(' </td> ') ;
	document.write(' <td width="5"><img src="/common/images/s.gif" alt="" width="5" height="1" border="0" /></td> ') ;
	document.write(' <td width="40" align="center" valign="middle" style="background:url(/common/images/support/support_btn_go_bg.jpg) no-repeat center;"> ') ;
	document.write(' <a href="javascript:refineQuerysearch(\'\',\'GuidedSearch\');">'+golbl+'&raquo;</a> ') ;
}

function knovanormalsubmit(baseprodname)
{
	document.write(' <input type="text" onfocus="clearField(this);" style="width:95px;" class="text11_333333" name="searchString" onkeydown="javascript:knovasubmit(\''+baseprodname+'\',\'GuidedSearch\',event)"/>	') ;				  
	document.write(' </td> ') ;
	document.write(' <td width="5"><img src="/common/images/s.gif" alt="" width="5" height="1" border="0" /></td> ') ;
	document.write(' <td width="40" align="center" valign="middle" style="background:url(/common/images/support/support_btn_go_bg.jpg) no-repeat center;"> ') ;
	document.write(' <a href="javascript:refineQuerysearch(\''+baseprodname+'\',\'GuidedSearch\');">'+golbl+'&raquo;</a> ') ;
}

// To show product support page country specific heading

function writesupportheading()
{

	if(isvaluepresent(tertiarydisplay))
	{
	  
		document.write(tertiarydisplay);
	}else
	{
		document.write(base_prodname);
	}

}
