// JavaScript Document

function ffSV(ds, row, index){ return ( row.filter1.indexOf('SV')!=-1) ? row : null; };
function ffUS(ds, row, index){ return ( row.filter1.indexOf('US')!=-1) ? row : null; };

//mounting filters
function ffARM(ds, row, index){ return ( row.filter2.indexOf('ARM')!=-1) ? row : null; };
function ffPOST(ds, row, index){ return ( row.filter2.indexOf('POST')!=-1) ? row : null; };
function ffPND(ds, row, index){ return ( row.filter2.indexOf('PND')!=-1) ? row : null; };
function ffTEN(ds, row, index){ return ( row.filter2.indexOf('TEN')!=-1) ? row : null; };
function ffIG(ds, row, index){ return ( row.filter2.indexOf('IG')!=-1) ? row : null; };
function ffSURF(ds, row, index){ return ( row.filter2.indexOf('SURF')!=-1) ? row : null; };
function ffNP(ds, row, index){ return ( row.filter2.indexOf('NP')!=-1) ? row : null; };

//material filters
function ffALM(ds, row, index){ return ( row.filter2.indexOf('ALM')!=-1) ? row : null; };
function ffSTL(ds, row, index){ return ( row.filter2.indexOf('STL')!=-1) ? row : null; };
function ffCONC(ds, row, index){ return ( row.filter2.indexOf('CONC')!=-1) ? row : null; };

//function one piece or split base
function ff1pc(ds, row, index) { return (row.filter2.indexOf('ONE')!=-1) ? row : null;};
function ffspl(ds, row, index) { return (row.filter2.indexOf('SPL')!=-1) ? row : null;};

//cutoff filters
function ffCO(ds, row, index){ return ( row.filter3.indexOf('CO') != -1) ? row : null;};
function ffFCO(ds, row, index){ return ( row.filter3.indexOf('FCO') != -1) ? row : null; };
function ffNON(ds, row, index){ return row; };

//base - nominal heights
function fflt20(ds,row,index){return (row.filter3 <=20) ? row : null;};
function ff2030(ds,row,index){return (row.filter3 <=30) ? ((row.filter3 > 20) ? row : null) : null };
function ff3040(ds,row,index){return (row.filter3 <=40) ? ((row.filter3 > 30) ? row : null) : null };
function ffgt40(ds,row,index){return (row.filter3 >=40) ? row : null;};

//LPC filters

function ffLPC00(ds, row, index){ return (parseInt(row.filter3.substring(3,5)) <= 00) ? row : null;};
function ffLPC01(ds, row, index){ return (parseInt(row.filter3.substring(3,5)) <= 01) ? row : null;};
function ffLPC02(ds, row, index){ return (parseInt(row.filter3.substring(3,5)) <= 02) ? row : null;};
function ffLPC05(ds, row, index){ return (parseInt(row.filter3.substring(3,5)) <= 05) ? row : null;};
function ffLPC10(ds, row, index){ return (parseInt(row.filter3.substring(3,5)) <= 10) ? row : null;};



//pole taper, transition filters
function ffSTRT(ds, row, index){ return ( row.filter3.indexOf('STR') != -1) ? row : null;};
function ffTPR(ds, row, index){ return ( row.filter3.indexOf('TPR') != -1) ? row : null;};
function ffTRN(ds, row, index){ return ( row.filter3.indexOf('TRN') != -1) ? row : null;};

//arm shapes 
function ffHOOK(ds, row, index){return ( row.filter3.indexOf('HOOK') != -1) ? row : null;};
function ffSTR(ds, row, index) {return ( row.filter3.indexOf('STRAIGHT') != -1) ? row : null;};



//shape filters
function ffLNT(ds, row, index){ return ( row.filter4.indexOf('LNT')!=-1) ? row : null; };
function ffACR(ds, row, index){ return ( row.filter4.indexOf('ACR')!=-1) ? row : null; };
function ffREC(ds, row, index){ return ( row.filter4.indexOf('REC')!=-1) ? row : null; };
function ffRND(ds, row, index){ return ( row.filter4.indexOf('RND')!=-1) ? row : null; };
function ffSQR(ds, row, index){ return ( row.filter4.indexOf('SQR')!=-1) ? row : null; };
function ffDOM(ds, row, index){ return ( row.filter4.indexOf('DOM')!=-1) ? row : null; };
function ffSTY(ds, row, index){ return ( row.filter4.indexOf('STY')!=-1) ? row : null; };
function ffMS(ds, row, index){ return ( row.filter4.indexOf('MS')!=-1) ? row : null; };

//base - shaft  compatibility maximum diameter
function ff50P(ds, row, index){ return ( row.filter5 >= 5) ? row : null; };
function ff55P(ds, row, index){ return ( row.filter5 >= 5.5) ? row : null; };
function ff60P(ds, row, index){ return ( row.filter5 >= 6) ? row : null; };
function ff65P(ds, row, index){ return ( row.filter5 >= 6.5) ? row : null; };
function ff70P(ds, row, index){ return ( row.filter5 >= 7.0) ? row : null; };
function ff75P(ds, row, index){ return ( row.filter5 >= 7.5) ? row : null; };
function ff80P(ds, row, index){ return ( row.filter5 >= 8.0) ? row : null; };
function ff100P(ds, row, index){ return ( row.filter5 >= 10.0) ? row : null; };

//texture
function ffSMT(ds, row, index){ return ( row.filter5.indexOf('SMT')!=-1) ? row : null; };
function ffFLT(ds, row, index){ return ( row.filter5.indexOf('FLT')!=-1) ? row : null; };

//bollard illumination
function ffILL(ds, row, index){ return ( row.filter3.indexOf('ILL')!=-1) ? row : null; };
function ffNON(ds, row, index){ return ( row.filter3.indexOf('NON')!=-1) ? row : null; };

//watts filters
function ff100(ds, row, index){ return ( row.watts >= 100) ? row : null; };
function ff175(ds, row, index){ return ( row.watts >= 175) ? row : null; };
function ff250(ds, row, index){ return ( row.watts >= 250) ? row : null; };
function ff400(ds, row, index){ return ( row.watts >= 400) ? row : null; };
function ff1000(ds, row, index){ return ( row.watts >= 1000) ? row : null; };

//LED System filters
function ffV(ds,row, index){ return ( row.filter5.indexOf('V')!=-1) ? row : null;};
function ffR(ds,row, index){ return ( row.filter5.indexOf('R')!=-1) ? row : null;};
function ffG(ds,row, index){ return ( row.filter5.indexOf('G')!=-1) ? row : null;};

//Type filters
function ffASR(ds,row, index){ return ( row.filter6.indexOf('ASR')!=-1) ? row : null;};
function ffBOL(ds,row, index){ return ( row.filter6.indexOf('BOL')!=-1) ? row : null;};
function ffWM(ds,row, index){ return ( row.filter6.indexOf('WM')!=-1) ? row : null;};
function ffLN(ds,row, index){ return ( row.filter6.indexOf('LN')!=-1) ? row : null;};

function changeVisibleThumbs(arr)
	{
	ds1.setURL('XML/lists/ASR.xml');	
	ds1.loadData();
	ds1.removeAllFilters(true);
	

	for(i=0; i<arr.length; i++)
		{				
		ds1.addFilter(arr[i]);
		}
	ds1.applyFilters();
	updateProductCounter();
	}


function checkBoxFilter(checked, filterFunction)
	{	
	ds1.setFilterMode('and');
		if (checked)
			ds1.addFilter(filterFunction);
		else
			ds1.removeFilter(filterFunction);		

	ds1.applyFilters();		
	updateProductCounter();
	}
	
	
function toggleFilter(form,val,checked)
	{	
	for (i=0;i<form.length;i++)
		{
		ds1.removeFilter(eval(form.elements[i].value));	
		}	
	
	if (checked && val)
		{
		ds1.addFilter(eval(val));
		}
	ds1.applyFilters();
	updateProductCounter();
	}

	
function openTemplateView(file)
    {		
	//document.getElementById('photowrapper').innerHTML=file;
       var popURL = "Tools/templateView/bin/loaderpage.html?ies=Ies/" + file + "/" ;
       var popWin = window.open(popURL, "template", "width=848,height=720,status=no,resizable=no");
    }
	
function updateProductCounter()
	{	
	var divbox=document.getElementById("productcounter");
	divbox.innerHTML=ds1.getRowCount()+' Items Selected';
	}
	
function resetFilters()
	{
	var forms=document.getElementsByTagName("form")
	for (i=0; i<forms.length; i++)
		{
		forms[i].getElementsByTagName("input")[0].checked="checked";	
		}
	ds1.removeAllFilters(true);
	}

function MM_showHideDetailLayer() 
	{ //v9.0
  	var i,p,v,obj,args=MM_showHideDetailLayer.arguments;
  	for (i=0; i<(args.length-2); i+=3) 
  	with (document) 
	if (getElementById && ((obj=getElementById(args[i]))!=null))
		{
		v=args[i+2];
    	if (obj.style) 
			{ obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    	obj.visibility=v; 
		var pixelT = (window.scrollY) ? window.scrollY + 20 + 'px;' : 
				(document.documentElement.scrollTop ? document.documentElement.scrollTop+20 : 20); 
		var f_scroll = obj.pixelTop ? obj.pixelTop=pixelT : obj.top=pixelT;			
		
		}
	}	
	
	
	
