// Ver: 1.2 usmanrv@gmail.com
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    }
  }
}
return req;
}

var http = getXMLHTTPRequest();
var innerItemId =123123;
var innerREGIM =0;
var FlagAjax=0;
var REGIMStart=0;
var ItemsOnPage=0;
var OrderInd=0;
var GroupBy=0;
var CodeBy=0;

//var MessWaitingAnilize="<table bgcolor=#FFFFFF bordercolor='B4D8D4' border=2><tr><td height='100px' width='400px' align=center valign=middle style='FONT-WEIGHT: bold; FONT-SIZE: 25px; COLOR: #ff8205;'>Analyzing database</td></tr></table>";
var MessWaitingAnilize="<table bgcolor=#FFFFFF style='BORDER:  #B4D8D4 3px solid;' ><tr><td><img src='progress2.gif' border='0'></td></tr></table>";

 var br = navigator.userAgent.toLowerCase();
 var ie = br.indexOf('msie');

 
function formatNumber0(num) 
{
s=""+num;r="";k=0;
for(var i=s.length-1;i>-1;i--)
{r=s.charAt(i)+r;k++;	if (k>2&&i>0) {r=","+r;k=0;}}
return r;
}


/////////////// NEXT PAGE
function getAjaxNextPage()
{
  var myurl = 'usmanajax_result.asp?page=next';
if (FlagAjax == 0 )
{
FlagAjax=1;
  myRand = parseInt(Math.random()*999999999999999);
  // add random number to URL to avoid cache problems
  var modurl = myurl+"&rand="+myRand+" ";
//document.write(modurl);
  http.open("GET", modurl, true);
  // set up the callback function
  http.onreadystatechange = useHttpResponseNextPage;
  http.send(null);
}
}


function useHttpResponseNextPage() {
var mystroka="";
var myEval="";
var myarr;
   if (http.readyState == 4) {
    if(http.status == 200) {
	var myresponse=http.responseText;
	myDrawPage(myresponse);
		FlagAjax=0;
  document.getElementById("showprogress").innerHTML="";
  document.getElementById("showprogress").visibility = "hidden";
	 }
	} 
	else 
	{
//                 document.getElementById("XITEM1").innerHTML =" ";
  document.getElementById("showprogress").innerHTML=MessWaitingAnilize;
  document.getElementById("showprogress").visibility = "visible";
	}
}
/////////////////// PREVIOUS PAGE
function getAjaxPrevPage()
{
  var myurl = 'usmanajax_result.asp?page=prev';
if (FlagAjax == 0 )
{
FlagAjax=1;
  myRand = parseInt(Math.random()*999999999999999);
  // add random number to URL to avoid cache problems
  var modurl = myurl+"&rand="+myRand+" ";
//document.write(modurl);
  http.open("GET", modurl, true);
  // set up the callback function
  http.onreadystatechange = useHttpResponsePrevPage;
  http.send(null);
}
}

function useHttpResponsePrevPage() {
var mystroka="";
var myEval="";
var myarr;
   if (http.readyState == 4) {
    if(http.status == 200) {
	var myresponse=http.responseText;
	myDrawPage(myresponse);
		FlagAjax=0;
  document.getElementById("showprogress").innerHTML="";
  document.getElementById("showprogress").visibility = "hidden";
	 }
	} 
	else 
	{
//              document.getElementById("XITEM1").innerHTML = " ";
 document.getElementById("showprogress").innerHTML=MessWaitingAnilize;
 document.getElementById("showprogress").visibility = "visible";
	}
}
/////////////////// PAGE NUMBER
function getAjaxPageNumber(numberpage)
{
	if  (document.getElementById("ItemsOnPage"))
	{ItemsOnPage=parseInt(document.getElementById("ItemsOnPage").value);}
	else
	{ItemsOnPage=9};
if (document.getElementById("OrderInd"))
{OrderInd=parseInt(document.getElementById("OrderInd").value);}
else
{OrderInd=0}
if (numberpage=="1")
{
var mIE=""
var k=(ExpandFixType)? "t":"f";
mIE=k
k=(ExpandFinish)? "t":"f";
mIE=mIE+k;
k=(ExpandStyle)? "t":"f";
mIE=mIE+k;
k=(ExpandBrand)? "t":"f";
mIE=mIE+k;
k=(ExpandWidth)? "t":"f";
mIE=mIE+k;
k=(ExpandHeight)? "t":"f";
mIE=mIE+k;
k=(ExpandLed)? "t":"f";
mIE=mIE+k;
k=(ExpandVoltage)? "t":"f";
mIE=mIE+k;
k=(ExpandColoredGlass)? "t":"f";
mIE=mIE+k;
k=(ExpandMount)? "t":"f";
mIE=mIE+k;
k=(ExpandPrice)? "t":"f";
mIE=mIE+k;
k=(ExpandOptions)? "t":"f";
mIE=mIE+k;
  var myurl = 'usmanajax_result.asp?page=number&number='+numberpage+'&qitems='+ItemsOnPage+'&orderind='+OrderInd+'&menu='+mIE;
REGIMStart=1;

}
else
{
  var myurl = 'usmanajax_result.asp?page=number&number='+document.getElementById("CurrentPage").value;
REGIMStart=0;
}
if (FlagAjax == 0 )
{
FlagAjax=1;
  myRand = parseInt(Math.random()*999999999999999);
  // add random number to URL to avoid cache problems
  var modurl = myurl+"&rand="+myRand+" ";
//document.write(modurl);
  http.open("GET", modurl, true);
  // set up the callback function
  http.onreadystatechange = useHttpResponsePageNumber;
  http.send(null);
}
}

function useHttpResponsePageNumber() {
var mystroka="";
var myEval="";
var myarr;
var ItemsOnPage;
var sdvig;
   if (http.readyState == 4) {
    if(http.status == 200) {
	var myresponse=http.responseText;
//document.getElementById("countajax").innerHTML=myresponse;
	myDrawPage(myresponse);
		FlagAjax=0;
  document.getElementById("showprogress").innerHTML="";
  document.getElementById("showprogress").visibility = "hidden";
	 }
	} 
	else 
	{
//               document.getElementById("XITEM1").innerHTML = ' ';
	if (document.getElementById("showprogress").innerHTML=="")
	{
  document.getElementById("showprogress").innerHTML=MessWaitingAnilize;
  document.getElementById("showprogress").visibility = "visible";
	}
	}
}
function useHttpResponseIndividual() {
   if (http.readyState == 4) {
    if(http.status == 200) {
	var myresponse=http.responseText;
	var mysplit=myresponse.split("%%");
                   if (mysplit[0] !="xxx")
		{
               document.getElementById("XIMGMAIN").innerHTML = mysplit[0];
               document.getElementById("XINFOMAIN").innerHTML = mysplit[1];
               document.getElementById("XADDINFO").innerHTML =  " ";
               document.getElementById("XANIM").innerHTML =  " ";
		}
  http.onreadystatechange =null;
		FlagAjax=0;
	 }
	} 
	else 
	{
//               document.getElementById("XANIM").innerHTML =  '<img src="anim.gif">';
	}
}
/////////add item
function getAjaxAddItem(iditem,idprice){
		if (FlagAjax == 0)
		{
		FlagAjax=1;
		  var myurl = 'usmanajax_additem.asp?additem='+iditem+'&price='+idprice;
		  innerItemId=iditem;
		  myRand = parseInt(Math.random()*999999999999999);
		  // add random number to URL to avoid cache problems
		  var modurl = myurl+"&rand="+myRand+"";
		  http.open("GET", modurl, true);
		  // set up the callback function
		  http.onreadystatechange = useHttpResponseAddItem;
		  http.send(null);
		}
		
}

function useHttpResponseAddItem() {
   if (http.readyState == 4) {
    if(http.status == 200) {
	var myresponse=http.responseText;
	var mysplit=myresponse.split("%%");
                if (mysplit[0] !="xxx")
		{
                   if (mysplit[1] =="LOG")
		   {
			window.location='customersignin.asp';
		   }
		   else
		   {

			if (document.getElementById('XTOTAL'))
			{
			}
			else
	           	{document.getElementById("XWISH0").innerHTML=" has <b><span id='XITEMTOTAL' name='XITEMTOTAL'>0</span></b> item(s).&nbsp Total qty. of <b><span id='XQTYTOTAL' name='XQTYTOTAL'>0</span></b>. Total price: <b><span id='XTOTAL' name='XTOTAL'>0</span></b>";};		
	               	document.getElementById("XITEMTOTAL").innerHTML =mysplit[2];
               		document.getElementById("XQTYTOTAL").innerHTML =mysplit[3];
               		document.getElementById("XTOTAL").innerHTML =mysplit[4];
		   }
		}
		FlagAjax=0;
  document.getElementById("showprogress").innerHTML="";
	  http.onreadystatechange = null;
  }
 } else {
//	if (document.getElementById('XTOTAL'))
//	{ document.getElementById('XTOTAL').innerHTML = 'xxxxx';}
  }
}
function getAjaxAddCard(iditem,idprice){
		if (FlagAjax == 0)
		{
		FlagAjax=1;
		  var myurl = 'usmanajax_addcard.asp?additem='+iditem+'&price='+idprice;
		  innerItemId=iditem;
		  myRand = parseInt(Math.random()*999999999999999);
		  // add random number to URL to avoid cache problems
		  var modurl = myurl+"&rand="+myRand+"";
		  http.open("GET", modurl, true);
		  // set up the callback function
		  http.onreadystatechange = useHttpResponseAddCard;
		  http.send(null);
		}
		
}

function useHttpResponseAddCard() {
   if (http.readyState == 4) {
    if(http.status == 200) {
	var myresponse=http.responseText;
	var mysplit=myresponse.split("%%");
                if (mysplit[0] !="xxx")
		{
			window.location=mysplit[1];
		}
		FlagAjax=0;
  }
 } else {
//	if (document.getElementById('XTOTAL'))
//	{ document.getElementById('XTOTAL').innerHTML = 'xxxxx';}
  }
}

function myDrawPage(myresponse)
{
	var mysplit=myresponse.split("%%");
if (mysplit[0]=="endsession")
{
window.location="search.asp";
return ;
}
var promstring;
var mystroka;
var mestoTab;
//mysplit 
//0-Items on Page
//1-Colls in Row
//2-Image Size for search
//3-Current Page
//4-Page Total Count
//5-Prev page
//6-next page
//7-compare
//8-debug
//document.getElementById("test2").innerHTML=myresponse;
//
//9-found Items 
//10-checkbox ECommerice
//11.... Regim Search onsale
//12.... Items
sdvig=11;
if (mysplit[0]>9) window.scrollTo(0,0);
if (document.getElementById("ItogoItems"))
{document.getElementById("ItogoItems").innerHTML="&nbsp;"+formatNumber0(mysplit[9])+"&nbsp;";}
//document.getElementById("ItogoItems").innerHTML=mysplit[6];
 if (document.getElementById("ECitems"))
{
	if  (mysplit[10]=="1")
	{document.getElementById("ECitems").checked=true;}
}
if ((0+mysplit[9])==0)
{
 if (document.getElementById("stock"))
{document.getElementById("stock").checked=false;}
if (document.getElementById("ManGroup"))
{document.getElementById("ManGroup").value="0";}
if (document.getElementById("ManufacturerName"))
{document.getElementById("ManufacturerName").value="0";}
if ((0+mysplit[11])==1)
alert("Currently there are no Sale items.");
else
alert('       Item not found.\nPlease expand your Search.');
window.location='search_result.asp?previous=Y&nothing=Y';
//myPreviousSearch();
return ;
}
if (mysplit[0]=="undefined")
{
window.location="search.asp";
return ;
}

             if (mysplit[0] !="xxx" )
		{
ItemsOnPage=parseInt(mysplit[0]);
	if (REGIMStart==1)
	{
promstring="";
promstring=promstring+"&nbsp;Page ";
promstring=promstring+"<select id=CurrentPage name=CurrentPage onchange='javascript:getAjaxPageNumber();' class=textbox ><font color=black>"
		for(var str=1;str<parseInt(mysplit[4])+1;str++)
		{
promstring=promstring+"<option value='"+str+"' "
			if (str==parseInt(mysplit[3]))
			{promstring=promstring+"selected"}
promstring=promstring+">"+str+"</option>";
		}
promstring=promstring+"</font></select>";
promstring=promstring+" of "+mysplit[4]+"&nbsp;&nbsp;";
	if (document.getElementById("RisCurrentPage"))
        document.getElementById("RisCurrentPage").innerHTML =promstring;
promstring="";
var RowQuantity=ItemsOnPage/3;
promstring=promstring+"<TABLE cellSpacing=0 cellPadding=0 width='650px' class=resulttable align=left  border=0>";
promstring=promstring+"<TBODY>";

		for (var row=1;row<RowQuantity+1;row++)
		{
promstring=promstring+"<TR>";
			for(var kol=1;kol<4;kol++)
			{
mestoTab=(row-1)*3+kol;
promstring=promstring+"<TD width='33%'><TABLE cellSpacing=0 cellPadding=0 width='100%' border=0>";
promstring=promstring+"<TBODY><TR><TD valign=top width='120px' height='120px' align='center'>";
//promstring=promstring+"<P align=center>";
promstring=promstring+"<DIV align=center style='POSITION: relative; margin-bottom:-5px;z-index:1;' id='d"+mestoTab+"'>";
//promstring=promstring+"<div id='i"+mestoTab+"' name='i" + mestoTab + "' style='position:absolute;' ></div>"
promstring=promstring+"<A id='XAnchorIMG"+mestoTab+"' name='XAnchorIMG"+(mestoTab )+"'><IMG ID='XIMG"+mestoTab +"' name='XIMG"+mestoTab+"' border='0'></a>";
promstring=promstring+"</DIV></TD>";
//promstring=promstring+"</TD>";
//promstring=promstring+"<BR></P></TD>";
promstring=promstring+"<TD vAlign=top align=left>";
promstring=promstring+"<DIV ID='XITEM"+(mestoTab )+"' NAME='XITEM"+(mestoTab )+"'></DIV>";
promstring=promstring+"</TD></TR>";
promstring=promstring+"</TBODY></TABLE>";
promstring=promstring+"</TD>";
				if (kol<3)
				{
	promstring=promstring+"<TD width='1%'>";
	promstring=promstring+"<DIV align=center><IMG height=165 src='images/vert_rule.gif' width=3></DIV>";
	promstring=promstring+"</TD>";
				}
			}
promstring=promstring+"</TR>";
promstring=promstring+"<TR>";
			for(var kol=1;kol<4;kol++)
			{
			promstring=promstring+"<TD><DIV align=center><IMG height=3 src='images/small_grey_rule.gif' width='99%'></DIV></TD>";
				if (kol<3)
				{
			promstring=promstring+"<TD><DIV align=center><IMG height=2 src='images/spacer.gif' width='2px'></DIV></TD>";
				}
			}
promstring=promstring+"</TR>";
		}
promstring=promstring+"</TBODY>";
promstring=promstring+"</TABLE>";

               document.getElementById("setka").innerHTML = promstring;
	}
	else
	{
               document.getElementById("CurrentPage").value = mysplit[3];
	};
		REGIMStart=0;
				if (mysplit[5]=="prev")
				{
		if (document.getElementById("XPREVPGTOPI"))
               document.getElementById("XPREVPGTOPI").innerHTML = "<a href='javascript:getAjaxPrevPage();'  nowrap><img src='images/standardicons/previousbutton.gif' width='25' height='25' border=0></a>";
		if (document.getElementById("XPREVPGTOP"))
               document.getElementById("XPREVPGTOP").innerHTML = "<a class='mainpagebuttons' href='javascript:getAjaxPrevPage();'  nowrap>PREVIOUS</a>";
		if (document.getElementById("X2PREVPGTOPI"))
               document.getElementById("X2PREVPGTOPI").innerHTML = "<a href='javascript:getAjaxPrevPage();'  nowrap><img src='images/standardicons/previousbutton.gif' width='25' height='25' border=0></a>";
		if (document.getElementById("X2PREVPGTOP"))
               document.getElementById("X2PREVPGTOP").innerHTML = "<a class='mainpagebuttons' href='javascript:getAjaxPrevPage();'  nowrap>PREVIOUS</a>";
                		}
				else
				{
		if (document.getElementById("XPREVPGTOP"))
               document.getElementById("XPREVPGTOP").innerHTML = "<img src=clear.jpg width=68px height=25px border=0 >";
		if (document.getElementById("XPREVPGTOPI"))
               document.getElementById("XPREVPGTOPI").innerHTML = "<img src=clear.jpg width=25px height=25px border=0 >";
		if (document.getElementById("X2PREVPGTOP"))
               document.getElementById("X2PREVPGTOP").innerHTML = "<img src=clear.jpg width=68px height=25px border=0 >";
		if (document.getElementById("X2PREVPGTOPI"))
               document.getElementById("X2PREVPGTOPI").innerHTML = "<img src=clear.jpg width=25px height=25px border=0 >";
				}
				if (mysplit[5]=="prev" && mysplit[6]=="next")
			{
               document.getElementById("XMIDPAGES").innerHTML = "&nbsp|&nbsp";
               document.getElementById("X2MIDPAGES").innerHTML = "&nbsp|&nbsp";
			}
				else
			{
               document.getElementById("XMIDPAGES").innerHTML = "&nbsp&nbsp&nbsp";
               document.getElementById("X2MIDPAGES").innerHTML = "&nbsp&nbsp&nbsp";
			}
				if (mysplit[6]=="next")
				{		
		if (document.getElementById("XNEXTPGTOP"))
               document.getElementById("XNEXTPGTOP").innerHTML = "<a class='mainpagebuttons' href='javascript:getAjaxNextPage();' nowrap>NEXT</a>";
		if (document.getElementById("XNEXTPGTOPI"))
               document.getElementById("XNEXTPGTOPI").innerHTML = "<a href='javascript:getAjaxNextPage();' nowrap><img src='images/standardicons/nextbutton.gif' width='25' height='25' border=0></a>";
		if (document.getElementById("X2NEXTPGTOP"))
               document.getElementById("X2NEXTPGTOP").innerHTML = "<a class='mainpagebuttons' href='javascript:getAjaxNextPage();' nowrap>NEXT</a>";
		if (document.getElementById("X2NEXTPGTOPI"))
               document.getElementById("X2NEXTPGTOPI").innerHTML = "<a href='javascript:getAjaxNextPage();' nowrap><img src='images/standardicons/nextbutton.gif' width='25' height='25' border=0></a>";
				}
				else
				{
		if (document.getElementById("XNEXTPGTOP"))
               document.getElementById("XNEXTPGTOP").innerHTML = "<img src=clear.jpg width=42px height=25px border=0 >";
		if (document.getElementById("XNEXTPGTOPI"))
               document.getElementById("XNEXTPGTOPI").innerHTML = "<img src=clear.jpg width=25px height=25px border=0 >";
		if (document.getElementById("X2NEXTPGTOP"))
               document.getElementById("X2NEXTPGTOP").innerHTML = "<img src=clear.jpg width=42px height=25px border=0 >";
		if (document.getElementById("X2NEXTPGTOPI"))
               document.getElementById("X2NEXTPGTOPI").innerHTML = "<img src=clear.jpg width=25px height=25px border=0 >";
				}
		var		myCompare=mysplit[7].split(",");
			for (var i=1;i<ItemsOnPage+1;i++)	
			{
		mystroka=mysplit[i+sdvig];
		myarr=mystroka.split("~~");
				if (myarr[0]=="xxx" ) 
				{
			               document.getElementById("XAnchorIMG"+i).href ="";
			               document.getElementById("XIMG"+i).src ="clear.jpg";
document.getElementById("XIMG"+i).width ="0px";
document.getElementById("XIMG"+i).height ="0px";
document.getElementById("XIMG"+i).usmanimg ="";
			               document.getElementById("XITEM"+i).innerHTML =" ";
//			               document.getElementById("XDETA"+i).innerHTML =" ";
//			               document.getElementById("XCOMP"+i).innerHTML =" ";
//			               document.getElementById("XADVI"+i).innerHTML =" ";
//			               document.getElementById("XADCA"+i).innerHTML =" ";
			}
				else
				{
		 mystroka="";
// 0 -ID
// 1 - image_name
// 2 -width image
// 3 - height image
// 4 - myretail
// 5 - retail
// 6 - instock
// 7 -manufacturer_name
// 8 -widht of lamp
// 9 -height of lamp
//10 -extension 
//11 -bulb type
//12 -wattage1
//13 -wattage2
//14 -manufacturer finish
//15 -extradescription
//16 t24
//17 estar
//18 eeficiet
//19 collection
//20 convert(id)
//21 manufacturer number
//22 manufacturer name
//23 NE - site is not ecommerce,EC-site is e-commerce
//24 Y product is online,N-is not Online
//25 special item
//26 regular price for special item
//27 tag for regular price
mystroka="<TABLE cellSpacing=0 cellPadding=0 width=105 border=0><TBODY>";
mystroka=mystroka+"<tr><td rowspan=12>&nbsp</td></tr>";
///		if (myarr[8] != "0")
///		{
///               mystroka=mystroka+"<tr><td class='reztext' nowrap >Width</td><td class='reztext'>:</td><td class='reztext' nowrap>"+myarr[8]+"</td></tr>";
///		}
///		if (myarr[9] != "0")
///		{
///               mystroka=mystroka+"<tr><td class='reztext' nowrap>Height</td><td class='reztext'>:</td><td class='reztext' nowrap>"+myarr[9]+"</td></tr>";
///		}
		if (myarr[25] == "Y")
		{
               mystroka=mystroka+"<tr><td nowrap colspan=3 class='PRICE' align='left'>"+myarr[5]+"</td></tr>";
               mystroka=mystroka+"<tr><td nowrap colspan=3 align='left' class='pricecutstrike'>"+myarr[26]+"</td></tr>";
		if (myarr[27]!="0")
		{	
               mystroka=mystroka+"<tr><td nowrap colspan=3 align='left' class='reztext'>";
			if (myarr[27]=="1") mystroka=mystroka+"Only while quantities last";
			if (myarr[27]=="2") mystroka=mystroka+"In stock items only";
			if (myarr[27]=="3") mystroka=mystroka+"No special orders";
			if (myarr[27]=="4") mystroka=mystroka+"Not valid with any other offer";
               mystroka=mystroka+"</td></tr>";
		}
//               mystroka=mystroka+"<tr><td  class='pricecolored' nowrap colspan=3 align='right'>"+myarr[5]+" </td></tr>";
		}
		else
		{
               mystroka=mystroka+"<tr><td nowrap colspan=3 align='left' class='pricing'>"+myarr[5]+"</td></tr>";
               mystroka=mystroka+"<tr><td nowrap colspan=3 align='left' class='pricing'>&nbsp</td></tr>";
		}
		if (myarr[6] == "Y")
		{
		 mystroka=mystroka+"<tr><td colspan=3 class='rezred'  >Usually In Stock </td></tr>";
		}
mystroka=mystroka+"<tr><td  class='reztext' nowrap>ID</td><td class='reztext'>:</td><td class='rezbold' nowrap>"+myarr[20]+"</td></tr>";
		if (myarr[21] != "")
		{
               mystroka=mystroka+"<tr><td colspan='3' class='rezbold'>"+myarr[21]+"</td></tr>";
		}
		if (myarr[22] != "")
		{
               mystroka=mystroka+"<tr><td colspan='3' class='rezbold'>"+myarr[22]+"</td></tr>";
		}

mystroka=mystroka+"<TR valign='center' ><TD valign='center' align='left' height='18px' width='18px'><a href='search_individual_result.asp?current="+myarr[0]+"&amp;page="+ mysplit[3]+"' ><IMG width=18 height=18 alt='View Product Details' src='images/standardicons/details_icon_sm.gif'  border=0 ></a></td><td valign='center' align='left' colspan='2'><a href='search_individual_result.asp?current="+myarr[0]+"&amp;page="+ mysplit[3]+"' class=resultslinks align='left'>Details</a>"
mystroka=mystroka+"</TD></TR>";
var mycompstr="<input type='checkbox'";
for(var k=0;k<myCompare.length-1;k++)
{
	if (myCompare[k]==myarr[0])
	{
mycompstr=mycompstr+" checked ";
	}
}
mycompstr=mycompstr+" name='compare"+myarr[0]+"'  id='compare"+myarr[0]+"' onclick='javascript:AddCompare("+myarr[0]+")'  />";
mystroka=mystroka+"<TR ><TD align='left'>"+mycompstr;
mystroka=mystroka+"</td><td valign='center' align='left' class=resultslinks colspan='2'><label for='compare"+myarr[0]+"'>Compare</label>"
mystroka=mystroka+"</TD></TR>";
mystroka=mystroka+"<TR valign='center' ><TD align='center' width='18px' height='18px'><a href='#' onclick=getAjaxAddItem("+myarr[0]+",'"+myarr[4]+"')  ><img src='images/standardicons/add_to_wishlist_sm.gif' alt='Add to wishlist' width='18' height='18' border='0'></a>";
mystroka=mystroka+"</td><td valign='center' align='left' colspan='2' nowrap><a href='#' class='resultslinks' onclick=getAjaxAddItem("+myarr[0]+",'"+myarr[4]+"')  nowrap>Add To Wish List</a>"
mystroka=mystroka+"</TD></TR>";
	if (myarr[23]=="EC")
	{
		if (myarr[24]=="Y")
		{
mystroka=mystroka+"           <TR valign='center' >  <TD align='center'  width='18px' height='18px'>";
mystroka=mystroka+"<a href='#' onclick=getAjaxAddCard("+myarr[0]+",'"+myarr[4]+"')  ><img src='images/standardicons/add_cart_sm.gif' alt='Add to E-commerce Cart' width='18' height='18' border='0' ></a>";
mystroka=mystroka+"          </td><td colspan='2' nowrap ><a href='#' onclick=getAjaxAddCard("+myarr[0]+",'"+myarr[4]+"') class='resultslinks' >Add To Cart</a>";
mystroka=mystroka+"</TD></TR>";
		}
		else
		{
///mystroka=mystroka+"<img src='images/standardicons/notavailable_icon.gif' height='18px' width='18px' border='0'></td><td colspan='2' class='resultslinks'>Not Available";
		}
	}


///		if (myarr[6] == "Y")
///		{
///		 mystroka=mystroka+"<tr><td colspan=3 class='rezred'>Usually In Stock</td></tr>"
///		}
///		if (myarr[16] == "1")
///		{
///		 mystroka=mystroka+"<tr><td colspan=3 class='rezbold'>Title 24</td></tr>"
///		}
///		if (myarr[17] == "1")
///		{
///		 mystroka=mystroka+"<tr><td colspan='3' class='rezbold'>Energy Star</td></tr>"
///		}
///		if (myarr[18] == "1")
///		{
///		 mystroka=mystroka+"<tr><td colspan='3' class='rezbold'>Energy Efficient</td></tr>"
///		}
///		if (myarr[21] != "")
///		{
//               mystroka=mystroka+"<tr><t class='reztext' nowrap>Manufacturer #</td><td class='reztext'>:</td><td></td></tr>";
/// 	      mystroka=mystroka+"<tr><td colspan='3' class='rezbold'>&nbsp</td></tr>";
///               mystroka=mystroka+"<tr><td colspan='3' class='rezbold'>"+myarr[21]+"</td></tr>";
///		}
///		if (myarr[22] != "")
///		{
//               mystroka=mystroka+"<tr><t class='reztext' nowrap>Manufacturer</td><td class='reztext'>:</td><td></td></tr>";
// 	      mystroka=mystroka+"<tr><td colspan='3' class='rezbold'>&nbsp</td></tr>";
///               mystroka=mystroka+"<tr><td colspan='3' class='rezbold'>"+myarr[22]+"</td></tr>";
///		}


//mystroka=mystroka+"<br><TABLE cellSpacing=0 cellPadding=0 width=105 border=0><TBODY>";
//mystroka=mystroka+"<TR><TD class='rezbold'>&nbsp</td><td class='rezbold'>&nbsp</td></tr>";
//mystroka=mystroka+"<TR><TD  colspan='2' align=left nowrap>";
//mystroka=mystroka+"<a href=javascript:getAjaxAddItem("+myarr[0]+",'"+myarr[4]+"'); class=buttonsnobold><IMG height=14  alt='Add To Wish List' src='images/wishlist_icon2.gif' width=20  border=0 >Add to Wish List</a></TD></TR>";
mystroka=mystroka+"</TBODY></TABLE>";
//////mystroka=mystroka+"<table height=10px width=85 border=0 ><tr><td height=10px   class='reztext'><a href='#'><img src='clear.gif' border=0 width=90px height=10px onclick='javascript:stm(Text["+i+"],Style[0]);'></a></td></tr></table>";
///onmouseover=document.style.cursor='hand'
		if (document.getElementById("XITEM"+i))
		{
               document.getElementById("XITEM"+i).innerHTML =mystroka;
		}
				}
			}
		}
			for (var i=1;i<ItemsOnPage+1;i++)	
			{
		mystroka=mysplit[i+sdvig];
		myarr=mystroka.split("~~");
				if (myarr[0]!="xxx") 
				{
document.getElementById("XIMG"+i).src = "usmanimage.aspx?img=" +myarr[1]+"&w="+myarr[2]+"&h="+myarr[3];
document.getElementById("XIMG"+i).width =myarr[2];
document.getElementById("XIMG"+i).height =myarr[3];
document.getElementById("XIMG"+i).usmanimg =myarr[1];
var strDopInfo="<table   cellpadding=0 cellspacing=0 align='center' border=0>";
	if ((myarr[8]!="0") ||(myarr[9]!="0")  )
	{
strDopInfo=strDopInfo+"<tr><td align=left class=maintextxx width=30% nowrap>";
strDopInfo=strDopInfo+"Size (WxH):";
strDopInfo=strDopInfo+"</td><td align=left class=maintextxx nowrap >";
strDopInfo=strDopInfo+"<b>"+myarr[8]+"&quot; x "+myarr[9]+"&quot;</b></td></tr>";
        }
	if (myarr[10]!="0")
	{
strDopInfo=strDopInfo+"<tr><td align=left class=maintextxx  width=30% nowrap>";
strDopInfo=strDopInfo+"Extension:";
strDopInfo=strDopInfo+"</td><td align=left class=maintextxx nowrap>";
strDopInfo=strDopInfo+"<b>"+myarr[10]+"</b>";
strDopInfo=strDopInfo+"</td></tr>";
	}
	if (myarr[11]!="")
	{
strDopInfo=strDopInfo+"<tr><td align=left class=maintextxx  width=30% nowrap>";
strDopInfo=strDopInfo+"Bulb type:";
strDopInfo=strDopInfo+"</td><td align=left class=maintextxx nowrap>";
strDopInfo=strDopInfo+"<b>"+myarr[11]+"</b>";
strDopInfo=strDopInfo+"</td></tr>";
	}
	if ((myarr[12]!="0") ||(myarr[13]!="0")  )
	{
strDopInfo=strDopInfo+"<tr><td align=left class=maintextxx  width=30% nowrap>";
strDopInfo=strDopInfo+"Bulb (qty x wattage):&nbsp";
strDopInfo=strDopInfo+"</td><td align=left class=maintextxx nowrap>";
strDopInfo=strDopInfo+"<b>"+myarr[12]+" x "+myarr[13]+"</b>";
strDopInfo=strDopInfo+"</td></tr>";
        }
	if (myarr[14]!="")
	{
strDopInfo=strDopInfo+"<tr><td align=left class=maintextxx width=30% nowrap>";
strDopInfo=strDopInfo+"Finish:";
strDopInfo=strDopInfo+"</td><td align=left class=maintextxx nowrap>"
strDopInfo=strDopInfo+"<b>"+myarr[14]+"</b>"
strDopInfo=strDopInfo+"</td></tr>";
	}
	if (myarr[15]!="")
	{
strDopInfo=strDopInfo+"<tr><td align=left class=maintextxx colspan=2 >Description:&nbsp;<b>"
var promstr=myarr[15];
if (promstr.length<40)
{
strDopInfo=strDopInfo+promstr;
}
else
{
strDopInfo=strDopInfo+promstr.substr(0,35)+"<br />";
promstr=promstr.substr(35,promstr.length-35);
	if (promstr.length<50)
	{
strDopInfo=strDopInfo+promstr;
	}
	else
	{
	for (;promstr.length>50;)
	{
	strDopInfo=strDopInfo+promstr.substr(0,50)+"<br/>";
	promstr=promstr.substr(50,promstr.length-50);
	}
	strDopInfo=strDopInfo+promstr.substr(0,50);
	}
}
strDopInfo=strDopInfo+"</b></td></tr>"
	}
var dopOptions=""
	if (myarr[16]=="1")
	{
	dopOptions="Title24";
	}
	if (myarr[17]=="1")
	{
		if (dopOptions!="") dopOptions=dopOptions+" , ";
	dopOptions=dopOptions+" Energy Star";
	}
	if (myarr[18]=="1")
	{
		if (dopOptions!="") dopOptions=dopOptions+" , ";
	dopOptions=dopOptions+" Energy Efficient";
	}
	if (dopOptions!="")
	{
strDopInfo=strDopInfo+"<tr><td align=left class=maintextxx width=30% nowrap>";
strDopInfo=strDopInfo+"Options:";
strDopInfo=strDopInfo+"</td><td align=left class=maintextxx nowrap>"
strDopInfo=strDopInfo+"<b>"+dopOptions+"</b>"
strDopInfo=strDopInfo+"</td></tr>";
	}

strDopInfo=strDopInfo+"</table>";
document.getElementById("XIMG"+i).usmaninfo =strDopInfo;
document.getElementById("XIMG"+i).onmouseover =test1;
document.getElementById("XIMG"+i).dddonclick = "document.SearchForm.action='search_individual_result.asp?current="+myarr[0]+"&amp;page="+mysplit[0]+"';document.SearchForm.submit();";
//document.getElementById("XIMG"+i).dddonclick = "open('search_individual_result.asp?current="+myarr[0]+"&amp;page="+mysplit[0]+"')";
document.getElementById("XAnchorIMG"+i).href = "javascript:document.SearchForm.action='search_individual_result.asp?current="+myarr[0]+"&amp;page="+mysplit[0]+"';document.SearchForm.submit()";
				}
			}
}
function test1(){
var zamenai=this.id.substring(4);
var file=this.usmanimg;
var infofile=this.usmaninfo;
if (document.getElementById("enlargeImage"))
{
if (document.getElementById("enlargeImage").checked==1)
usmImgExpand('i'+zamenai,'d'+zamenai,3.3,0,'http://www.lightsamerica.com/images/images/'+file,infofile,'XIMG'+zamenai);
}
}
function AddCompare(itemComp)
{
var elCompare="compare"+itemComp;
var myurl = 'usmanajax_compare1.asp?item='+itemComp+'&switch='
	if (document.getElementById(elCompare).checked==1)
	{ myurl = myurl+'1';}
	else
	{ myurl = myurl+'0';}
		if (FlagAjax == 0 )
		{
		FlagAjax=1;
		  myRand = parseInt(Math.random()*999999999999999);
		  var modurl = myurl+"&rand="+myRand+" ";
		  http.open("GET", modurl, true);
		  http.onreadystatechange = useHttpResponseCompare;
		  http.send(null);
		}

}
function useHttpResponseCompare() {
   if (http.readyState == 4) {
   if(http.status == 200) {
	var myresponse=http.responseText;
	var mysplit=myresponse.split("%%");
  http.onreadystatechange =null;
  document.getElementById("showprogress").innerHTML="";
  document.getElementById("showprogress").visibility = "hidden";
		FlagAjax=0;
			 }
   } else {
//  document.getElementById('XTOTAL').innerHTML = '<img src="anim.gif">';
  }
}
function ViewCollection (item) {
	document.SearchForm.action = 'search_result.asp?params=Collection:' + item +';';
	document.SearchForm.submit();
}

function AddEnlarge()
{
var myurl = 'usmanajax_enlarge.asp?enlarge=';
if (document.getElementById("enlargeImage"))
{
	if (document.getElementById("enlargeImage").checked==1)
	{ myurl = myurl+'1';}
	else
	{ myurl = myurl+'0';}
		if (FlagAjax == 0 )
		{
		FlagAjax=1;
		  myRand = parseInt(Math.random()*999999999999999);
		  var modurl = myurl+"&rand="+myRand+" ";
		  http.open("GET", modurl, true);
		  http.onreadystatechange = useHttpResponseEnlarge;
		  http.send(null);
		}
}
}
function useHttpResponseEnlarge() {
   if (http.readyState == 4) {
   if(http.status == 200) {
	var myresponse=http.responseText;
//	var mysplit=myresponse.split("%%");
  http.onreadystatechange =null;
		FlagAjax=0;
			 }
   } else {
//  document.getElementById('XTOTAL').innerHTML = '<img src="anim.gif">';
  }
}
