<!--

//-------- Stores the addressing numbers of items that match the page's criteria
var matches=new Array();
inta=0;intb=0;
while(inta<total_items){
if((i5[inta]==woodoracrylic&&i6[inta]==penorpencil)||(woodoracrylic=="both"&&penorpencil=="both")){matches[intb]=inta;intb++;}inta++;
}

//-------- Determines and stores the total number of matches
inta=0;
var total_matches=0;
while(matches[inta]!=undefined){total_matches++;inta++;}

//-------- orders items from low to high if page asks
if(order=="lowtohigh"){
inta=0;
while(inta<total_matches){
intb=0;
while(intb<total_matches){
if(i4[matches[inta]]<i4[matches[intb]]){i7[matches[intb]]++;}
else if(i4[matches[inta]]==i4[matches[intb]]&&i0[matches[inta]]<i0[matches[intb]]){i7[matches[intb]]++;}
intb++;}
inta++;}
}

//-------- orders items from high to low if page asks
if(order=="hightolow"){
inta=0;
while(inta<total_matches){
intb=0;
while(intb<total_matches){
if(i4[matches[inta]]<i4[matches[intb]]){i7[matches[inta]]++;}
else if(i4[matches[inta]]==i4[matches[intb]]&&i0[matches[inta]]<i0[matches[intb]]){i7[matches[inta]]++;}
intb++;}
inta++;}
}

//-------- orders items as is if page asks
if(order=="noorder"){
inta=0;
while(inta<total_matches){
i7[matches[inta]]=inta;
inta++;}
}

//-------- orders items by newest first if page asks
if(order=="new1st"){
inta=0;
var inta2; var intb2;
while(inta<total_matches){
intb=0;
while(intb<total_matches){
intb2=i3[matches[intb]].substring(4,6)+i3[matches[intb]].substring(0,2)+i3[matches[intb]].substring(2,4);
inta2=i3[matches[inta]].substring(4,6)+i3[matches[inta]].substring(0,2)+i3[matches[inta]].substring(2,4);
if(inta2<intb2){i7[matches[inta]]++;}
else if(inta2==intb2&&i0[matches[inta]]<i0[matches[intb]]){i7[matches[inta]]++;}
intb++;}
inta++;}
}

//-------- stores item addresses in usable order
if(matches[0]!=undefined){
var usableorder=new Array();
inta=0;
while(inta<total_matches){
usableorder[inta]=0;inta++;}
inta=0;
while(inta<total_matches){
intb=0;
while(intb<total_matches){
if(i7[matches[intb]]==inta){usableorder[inta]=matches[intb];}
intb++;}
inta++;}}

//-->
