//  Ver: 1.2 usmanrv@gmail.com
var RegimSetkaList="0";
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 CDNregim=1;  
var innerItemId =123123;
var innerREGIM =0;
var FlagAjax=0;
var REGIMStart=0;
var OrderInd=0;
var GroupBy=0;
var CodeBy=0;
var GCurPage=0;
var GTotPage=0;
var sDiv="^%^";
//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()
{
if (NoAjax>0){
if ((parseInt(GCurPage))<GTotPage)
{
//document.location.hash = '#page='+(1+parseInt(GCurPage));
document.location="search_result.asp?"+GlobPar+"&page="+(1+parseInt(GCurPage));
return false;
}}
  var myurl = "usmanajax_result.asp?page=next&xWidth="+xImgWidth+"&xHeight="+xImgHeight+"&xCols="+xColsInRow+"&qitems="+xItemsOnPage;
if (FlagAjax == 0 )
{
ShowDivProg();
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;
	CloseDivProg();
	 }
	} 
	else 
	{
	}
}
/////////////////// PREVIOUS PAGE
function getAjaxPrevPage()
{
if (NoAjax>0){
if ((parseInt(GCurPage))>1)
{
//document.location.hash = '#page='+(parseInt(GCurPage)-1);
document.location="search_result.asp?"+GlobPar+"&page="+(parseInt(GCurPage)-1);
return false;
}}
  var myurl = "usmanajax_result.asp?page=prev&xWidth="+xImgWidth+"&xHeight="+xImgHeight+"&xCols="+xColsInRow+"&qitems="+xItemsOnPage;
if (FlagAjax == 0 )
{
FlagAjax=1;
ShowDivProg();
  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;
CloseDivProg();
		FlagAjax=0;
	myDrawPage(myresponse);
	 }
	} 
	else 
	{
	}
}
/////////////////// PAGE NUMBER
function getAjaxPageNumber(numberpage)
{
	if  (document.getElementById("ItemsOnPage"))
	{xItemsOnPage=parseInt(document.getElementById("ItemsOnPage").value);}
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;
k=(ExpandInst)? "t":"f";
mIE=mIE+k;
if (GlobPage>0)
{
  var myurl = "usmanajax_result.asp?page=number&number="+GlobPage+"&qitems="+xItemsOnPage+"&orderind="+OrderInd+"&menu="+mIE+"&regSL="+RegimSetkaList+"&xWidth="+xImgWidth+"&xHeight="+xImgHeight+"&xCols="+xColsInRow;
GlobPage=0;
}
else
{
  var myurl = "usmanajax_result.asp?page=number&number="+numberpage+"&qitems="+xItemsOnPage+"&orderind="+OrderInd+"&menu="+mIE+"&regSL="+RegimSetkaList+"&xWidth="+xImgWidth+"&xHeight="+xImgHeight+"&xCols="+xColsInRow;
}
REGIMStart=1;

}
else
{
if (NoAjax>0){
if ((1+parseInt(GCurPage))<GTotPage)
{
//document.location.hash = '#page='+(1+parseInt(GCurPage));
//document.location="search_result.asp?"+GlobPar+"&page="+document.getElementById("CurrentPage").value;
document.location="search_result.asp?"+GlobPar+"&page="+numberpage
return false;
}}
//  var myurl = 'usmanajax_result.asp?page=number&number='+document.getElementById("CurrentPage").value;
  var myurl = "usmanajax_result.asp?page=number&number="+numberpage+"&xWidth="+xImgWidth+"&xHeight="+xImgHeight+"&xCols="+xColsInRow+"&qitems="+xItemsOnPage;
REGIMStart=0;
}
if (FlagAjax == 0 )
{
ShowDivProg();
FlagAjax=1;
  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 = useHttpResponsePageNumber;
  http.send(null);
}
}

function useHttpResponsePageNumber() {
var mystroka="";
var myEval="";
var myarr;
var sdvig;
if (http.readyState == 4) {
if(http.status == 200) {
	var myresponse=http.responseText;
	FlagAjax=0;
	CloseDivProg();
myDrawPage(myresponse);
 http.onreadystatechange = null;

}
}
}
function useHttpResponseIndividual() {
   if (http.readyState == 4) {
    if(http.status == 200) {
	var myresponse=http.responseText;
	var mysplit=myresponse.split("%%");
 if (mysplit[0] =="xxx")
 {
	window.location="search_uni.asp";
	return false;
 }
                   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("%%");
		FlagAjax=0;
 if (mysplit[0] =="xxx")
 {
	window.location="search_uni.asp";
	return false;
 }
                if (mysplit[0] =="cWL")
		{
	ShowCrtWL();
	  document.getElementById("showprogress").innerHTML="";
	  http.onreadystatechange = null;
	 return false;
		}
                if (mysplit[1] =="ExName")
		{
		document.getElementById("txtError").innerHTML="Wish List with this name already exists. Please change the name.";
		}
		else
		{
		CloseCrtWL();
                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 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];
			if  (document.getElementById("XWISHName"))
	           	document.getElementById("XWISHName").innerHTML=mysplit[6];		
		   }
		}
		}
  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("%%");
		FlagAjax=0;
 if (mysplit[0] =="xxx")
 {
	window.location="search_uni.asp";
	return false;
 }
                if (mysplit[0] !="xxx")
		{
			window.location="usmanajax_addcard.asp?3DRedir="+escape(mysplit[1]);
			return false;
		}
  }
 } else {
//	if (document.getElementById('XTOTAL'))
//	{ document.getElementById('XTOTAL').innerHTML = 'xxxxx';}
  }
}
function myDrawPage(myr)
{
if (RegimSetkaList=="1")
myDrawList(myr);
	else
myDrawSetka(myr);
}
///////////////// Begin MyDrawSetka
function myDrawSetka(myr)
{
	var mysplit=myr.split(sDiv);
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.... topbanner
//13.... Items
sdvig=12;
var ColQuantity=4;
if (mysplit[0]>10) window.scrollTo(0,0);
document.getElementById("idItemsOnPage").innerHTML=RisItemsOnPageGallery(ColQuantity);
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")
 {
	window.location="search_uni.asp";
	return false;
 }

             if (mysplit[0] !="xxx" )
		{
if (document.getElementById("topBanner"))
{
document.getElementById("topBanner").innerHTML=mysplit[12];
}
ItemsOnPage=parseInt(mysplit[0]);
GCurPage=parseInt(mysplit[3]);
GTotPage=parseInt(mysplit[4]);
	if (REGIMStart==1)
	{
	var buf=[];
	buf=[];
	var RowQuantity=ItemsOnPage/ColQuantity;
	buf.push("<TABLE cellSpacing=0 cellPadding=0 width='760px' class='resulttable' align='left'  border='0'>");
	buf.push("<TBODY>");
		for (var row=1;row<RowQuantity+1;row++)
		{
		buf.push("<TR>");
			for(var kol=1;kol<ColQuantity+1;kol++)
			{
			mestoTab=(row-1)*ColQuantity+kol;
			buf.push("<TD width='25%' class='r3toptd'><table cellspacing='0' cellpadding='3' width='100%' align='center' border='0'><TR>");
			buf.push("<td align='center' width='3px'><img src='images/shim.gif' width='1px' border='0'></td>");
			buf.push("<td align='center' width='47%'><span id='XAWISH"+mestoTab+"'>&nbsp;</span></td>");
			buf.push("<td align='center' width='47%'><span id='XECOM"+mestoTab+"'>&nbsp;</span></td>");
			buf.push("<td align='center' width='3px'><img src='images/shim.gif' width='1px' border='0'></td>");
			buf.push("</TR></table></TD>");
			}
		buf.push("</TR>");
		buf.push("<TR>");
			for(var kol=1;kol<ColQuantity+1;kol++)
			{
			mestoTab=(row-1)*ColQuantity+kol;
			buf.push("<TD width='25%'><TABLE cellSpacing=0 cellPadding=0 width='180px' border=0>");
			buf.push("<TBODY><TR><TD valign='top' width='180px' height='180px' align='center' >");
			buf.push("<div id='i"+mestoTab+"' name='i"+mestoTab+"' style='position:absolute;' ></div>");
			buf.push("<DIV align=center style='POSITION: relative; margin-bottom:-5px;z-index:1;' id='d"+mestoTab+"'>");
			buf.push("<A id='XAnchorIMG"+mestoTab+"' name='XAnchorIMG"+(mestoTab )+"'>");
			buf.push("<img src='images/onlineimage.gif'  ID='XSHA"+mestoTab +"' name='XSHA"+mestoTab+"' border='0' style='position: absolute;left:0;top:0;width:180px;height:180px;z-index:10;'>");
			buf.push("<IMG ID='XIMG"+mestoTab +"' name='XIMG"+mestoTab+"' border='0'></a>");
			buf.push("</DIV></TD></TR>");
			buf.push("</TBODY></TABLE>");
			buf.push("</TD>");
			}
		buf.push("</TR>");
		buf.push("<TR>");
			for(var kol=1;kol<ColQuantity+1;kol++)
			{
			mestoTab=(row-1)*ColQuantity+kol;
			buf.push("<TD width='25%' ><span id='XITEM"+mestoTab+"'></span></TD>");
			}
		buf.push("</TR>");
		buf.push("<TR>");
			for(var kol=1;kol<ColQuantity+1;kol++)
			{
			mestoTab=(row-1)*ColQuantity+kol;
			buf.push("<TD width='25%' class='r3bottomtd'><table cellspacing='0' cellpadding='0' width='100%' align='center' bottom='1'><TR>");
			buf.push("<td align='center' width='50%'><span id='XCOMP"+mestoTab+"'>&nbsp;</span></td>");
			buf.push("<td align='center' width='50%'><span id='XDET"+mestoTab+"'>&nbsp;</span></td>");
			buf.push("</TR></table></TD>");
			}
		buf.push("</TR>");
		buf.push("<TR>");
			for(var kol=1;kol<ColQuantity+1;kol++)
			{
			mestoTab=(row-1)*ColQuantity+kol;
			buf.push("<TD width='25%' height='5px'><img src='images/shim.gif' height='5px' border='0'></TD>");
			}
		buf.push("</TR>");

		}
	buf.push("</TBODY>");
	buf.push("</TABLE>");
        document.getElementById("setka").innerHTML = buf.join("");
	}
	else
	{
//               document.getElementById("CurrentPage").value = mysplit[3];
	};
		REGIMStart=0;
		risNextPrevButtons(mysplit[5],mysplit[6]);
		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 ="images/shim.gif";
document.getElementById("XIMG"+i).width ="0px";
document.getElementById("XIMG"+i).height ="0px";
document.getElementById("XIMG"+i).usmanimg ="";
			               document.getElementById("XITEM"+i).innerHTML =" ";
			               document.getElementById("XDET"+i).innerHTML =" ";
			               document.getElementById("XCOMP"+i).innerHTML =" <img src='images/shim.gif' height='18px' border='0' width='10px'>";
			               document.getElementById("XAWISH"+i).innerHTML ="<img src='images/shim.gif' height='18px' border='0' width='10px'>";
			               document.getElementById("XECOM"+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
//28 installation_name
//29 description_name
risCurrentPageRef(mysplit[3],mysplit[4]);
var buf=[];
buf.push("<TABLE cellSpacing=0 cellPadding=0 width='100%' border=0><TBODY>");
buf.push("<tr><td align='left' class='reztypetext' colspan='2'>"+myarr[28]+"-"+myarr[29]+"</td></tr>");
buf.push("<tr><td align='left' class='rezPricePrice' >");
		if (myarr[25] == "Y")
		{
	               buf.push("<table border='0' cellSpacing='0' cellPadding='0'>");
			if (myarr[32]!="")
			{
        	       buf.push("<tr><td nowrap align='left' class='rezTxtList'>List Price:&nbsp;</td>");
	               buf.push("<td nowrap align='right' class='rezPriceList'>"+myarr[32]+"</td></tr>");
			}
		       buf.push("<tr><td nowrap  align='left' class='rezTxtReg'>Regular Price</td><td class='rezPriceReg' align='right'>"+myarr[26]+"</td></tr>");
		       buf.push("<tr><td nowrap  align='left' class='rezTxtSale'>Sale Price</td><td class='rezPriceSale' align='right'>"+myarr[5]+"</td></tr>");
			if (myarr[27]!="0")
			{	
	               buf.push("<tr><td colspan=3 align='left' class='reztext'>");
			buf.push(taxSaleInfo(myarr[27]));
        		      buf.push("</td></tr>");
			}
			if (myarr[33]!="")
			{
	               buf.push("<tr><td nowrap class='rezTxtListSave' align='left'>You Save:&nbsp;</td>");
	               buf.push("<td nowrap  align='right' class='rezPriceListSave'>"+myarr[33]+"</td></tr>");
			}
	              buf.push("</table>");
		}
		else
		{
			if (myarr[32]=="")
			{
		               buf.push(myarr[5]);
			}
			else
			{
		               buf.push("<table border='0' cellspacing='0' cellpadding='0'>");
		               buf.push("<tr><td nowrap class='rezTxtList' align='left'>List Price:&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPriceList'>"+myarr[32]+"</td></tr>");
		               buf.push("<tr><td nowrap class='rezTxtPrice' align='left'>Our Price:&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPricePrice'>"+myarr[5]+"</td></tr>");
		               buf.push("<tr><td nowrap class='rezTxtListSave' align='left'>You Save:&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPriceListSave'>"+myarr[33]+"</td></tr>");
		               buf.push("</table>");
			}
		}
buf.push("</td>");
buf.push("<td  class='reztext' nowrap>ID # "+myarr[20]+"</td></tr>");
buf.push("<tr><td class='reztext'>");
		if (myarr[21] != "")
		{
               buf.push(myarr[21]);
		}
buf.push("</td><td class='reztext'>");
		if (myarr[22] != "")
		{
               buf.push(myarr[22]);
		}
buf.push("</td></tr>");
buf.push("</TBODY></TABLE>");
		if (document.getElementById("XITEM"+i))
		{
               document.getElementById("XITEM"+i).innerHTML =buf.join("");
		}
	if (myarr[23]=="EC")
	{
		if (myarr[24]=="Y")
		{
               document.getElementById("XECOM"+i).innerHTML ="<a href='#' onclick=getAjaxAddCard("+myarr[0]+",'"+myarr[4]+"')  ><img src='images/addcart.png' title='Add to wishlist' border='0' onMouseOver=\"javascript:this.src='images/addcarthover.png'\" onMouseOut=\"javascript:this.src='images/addcart.png'\"></a>";
		}
		else
		{
               document.getElementById("XECOM"+i).innerHTML ="&nbsp;";
		}
	}

var buf=[];
		if (document.getElementById("XCOMP"+i))
		{
               document.getElementById("XCOMP"+i).innerHTML =risCompareRef(myarr[0],myCompare,"resultslinks");
		}
		if (document.getElementById("XDET"+i))
		{
               document.getElementById("XDET"+i).innerHTML ="<a href='search_individual_result.asp?current="+myarr[0]+"&amp;page="+ mysplit[3]+"' class='resultslinksbold' align='left'><img src='images/moredetails.png' border='0' onMouseOver=\"javascript:this.src='images/moredetailshover.png'\" onMouseOut=\"javascript:this.src='images/moredetails.png'\"></a>";
		}
				}
			}
		}
			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=" +escape(myarr[1])+"&w="+myarr[2]+"&h="+myarr[3];
document.getElementById("XIMG"+i).usmanimg =myarr[1];
if (CDNregim==0)
{
document.getElementById("XIMG"+i).src = "http://www.lightsamerica.com/images/images/SM5/" +escape(myarr[1]);
document.getElementById("XSHA"+i).title ="LA";
}
else
{
document.getElementById("XSHA"+i).title ="CDN";
document.getElementById("XIMG"+i).src = "http://cdn.lightsamerica.com/images/SM5/" +escape(myarr[1]);
document.getElementById("XIMG"+i).onerror = imgError;
}
document.getElementById("XIMG"+i).width =myarr[2];
document.getElementById("XIMG"+i).height =myarr[3];
document.getElementById("XAWISH"+i).innerHTML ="<a href=\"javascript:getAjaxAddItem("+myarr[0]+",'"+myarr[4]+"');\"  ><img src='images/addwishlist.png' title='Add to wishlist' border='0' onMouseOver=\"javascript:this.src='images/addwishlisthover.png'\" onMouseOut=\"javascript:this.src='images/addwishlist.png'\"></a>";
buf=[];
buf.push("<table   cellpadding=0 cellspacing=0 align='center' border=0>");
	if ((myarr[8]!="0") ||(myarr[9]!="0")  )
	{
buf.push("<tr><td align=left class=maintextxx width=30% nowrap>");
buf.push("Size (WxH):");
buf.push("</td><td align=left class=maintextxx nowrap >");
buf.push("<b>"+myarr[8]+"&quot; x "+myarr[9]+"&quot;</b></td></tr>");
        }
	if (myarr[10]!="0")
	{
buf.push("<tr><td align=left class=maintextxx  width=30% nowrap>");
buf.push("Extension:");
buf.push("</td><td align=left class=maintextxx nowrap>");
buf.push("<b>"+myarr[10]+"</b>");
buf.push("</td></tr>");
	}
	if (myarr[11]!="")
	{
buf.push("<tr><td align=left class=maintextxx  width=30% nowrap>");
buf.push("Bulb type:");
buf.push("</td><td align=left class=maintextxx nowrap>");
buf.push("<b>"+myarr[11]+"</b>");
buf.push("</td></tr>");
	}
	if ((myarr[12]!="0") ||(myarr[13]!="0")  )
	{
buf.push("<tr><td align=left class=maintextxx  width=30% nowrap>");
buf.push("Bulb (qty x wattage):&nbsp");
buf.push("</td><td align=left class=maintextxx nowrap>");
buf.push("<b>"+myarr[12]+" x "+myarr[13]+"</b>");
buf.push("</td></tr>");
        }
	if (myarr[14]!="")
	{
buf.push("<tr><td align=left class=maintextxx width=30% nowrap>");
buf.push("Finish:");
buf.push("</td><td align=left class=maintextxx nowrap>");
buf.push("<b>"+myarr[14]+"</b>");
buf.push("</td></tr>");
	}
	if (myarr[15]!="")
	{
buf.push("<tr><td align=left class=maintextxx colspan=2 >Description:&nbsp;<b>");
var promstr=myarr[15];
if (promstr.length<40)
{
buf.push(promstr);
}
else
{
buf.push(promstr.substr(0,35)+"<br />");
promstr=promstr.substr(35,promstr.length-35);
	if (promstr.length<50)
	{
buf.push(promstr);
	}
	else
	{
	for (;promstr.length>50;)
	{
	buf.push(promstr.substr(0,50)+"<br/>");
	promstr=promstr.substr(50,promstr.length-50);
	}
	buf.push(promstr.substr(0,50));
	}
}
buf.push("</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!="")
	{
buf.push("<tr><td align=left class=maintextxx width=30% nowrap>");
buf.push("Options:");
buf.push("</td><td align=left class=maintextxx nowrap>");
buf.push("<b>"+dopOptions+"</b></td></tr>");
	}

buf.push("</table>");
document.getElementById("XIMG"+i).usmaninfo =buf.join("");
document.getElementById("XIMG"+i).onmouseover =test1;
document.getElementById("XSHA"+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()";
				}
			}
}
// myDraw Setka End , myDrawList begin
function myDrawList(myr)
{
var mysplit=myr.split(sDiv);
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.... topbanner
//13.... Items
sdvig=12;
var ColQuantity=xColsInRow;
document.getElementById("idItemsOnPage").innerHTML=RisItemsOnPageList(ColQuantity);
if (mysplit[0]>4) 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")
 {
	window.location="search_uni.asp";
	return false;
 }

             if (mysplit[0] !="xxx" )
		{
if (document.getElementById("topBanner"))
{
document.getElementById("topBanner").innerHTML=mysplit[12];
if  (document.getElementById("imgTopBanner"))
document.getElementById("imgTopBanner").width=xBannerWidth;
}
xItemsOnPage=parseInt(mysplit[0]);
GCurPage=parseInt(mysplit[3]);
GTotPage=parseInt(mysplit[4]);
	if (REGIMStart==1)
	{
	var buf=[];
	var RowQuantity=xItemsOnPage/xColsInRow;
	buf.push("<TABLE cellSpacing=0 cellPadding='0' width='100%' class='resulttable' align='left'  border='0'>");
	buf.push("<TBODY>");
		for (var row=1;row<RowQuantity+1;row++)
		{
		buf.push("<TR>");
			for(var kol=1;kol<ColQuantity+1;kol++)
			{
			mestoTab=(row-1)*ColQuantity+kol;
			buf.push("<TD width='50%' align='center' valign='top'>");
			buf.push("<table cellpadding='0' cellspacing='0' width='95%' border='0' >");
			buf.push("<tr><td class='display'  valign='top' colspan='2' height='"+xImgHeight+"px'  width='"+xImgWidth+"px'>");
			buf.push("<div id='i"+mestoTab+"' name='i"+mestoTab+"' style='position:absolute;' ></div>");
			buf.push("<DIV align=center style='POSITION: relative; margin-bottom:-5px;z-index:1;' id='d"+mestoTab+"'>");
			buf.push("<A id='XAnchorIMG"+mestoTab+"' name='XAnchorIMG"+(mestoTab )+"'>");
			buf.push("<img src='images/onlineimage.gif'  ID='XSHA"+mestoTab +"' name='XSHA"+mestoTab+"' border='0' style='position: absolute;left:0;top:0;width:"+xImgWidth+"px;height:"+xImgHeight+"px;z-index:10;'>");
			buf.push("<IMG ID='XIMG"+mestoTab +"' name='XIMG"+mestoTab+"' border='0'></a>");
			buf.push("</DIV></td>");
			buf.push("<td align='center'>");
			buf.push("<table width='95%' cellspacing='0' cellpadding='0' border='0' align='center'>");
			buf.push("<tr>");
			buf.push("<td colspan='2' class='resulttitle'><span id='XINFO"+mestoTab+"'></span>");
			buf.push("</td></tr>");
			buf.push("<tr><td  class='price' colspan='3'><span id='XPRIC"+mestoTab+"'></span><br />&nbsp;</td>");
			buf.push("</tr>");
			buf.push("<td colspan='2' align='left'>");
			buf.push("<span id='XECOM"+mestoTab+"'></span><br/>");
			buf.push("<span id='XWISH"+mestoTab+"'></span><br /><br />");
			buf.push("</td></tr>");
			buf.push("<tr><td colspan='2'><table cellpadding='0' cellspacing='0' width='98%' border='0' ><tr><td><span id='XCOMP"+mestoTab+"'></span></td>");
			buf.push("<td class='price' aling='center'><span id='XDET"+mestoTab+"'></span></td></tr></table>");
			buf.push("</td></tr>");

			buf.push("</table>");
			buf.push("</td></tr></table>");
			buf.push("</TD>");
			}
		buf.push("</TR>");
		buf.push("<TR><td colspan='6'><hr /></td></TR>");
		}
	buf.push("</TBODY>");
	buf.push("</TABLE>");
        document.getElementById("setka").innerHTML = buf.join("");
	}
	else
	{
//               document.getElementById("CurrentPage").value = mysplit[3];
	};
		REGIMStart=0;
		risNextPrevButtons(mysplit[5],mysplit[6]);
		var myCompare=mysplit[7].split(",");
		for (var i=1;i<xItemsOnPage+1;i++)	
		{
		mystroka=mysplit[i+sdvig];
		myarr=mystroka.split("~~");
			if (myarr[0]=="xxx" ) 
			{
		               	document.getElementById("XAnchorIMG"+i).href ="";
				document.getElementById("XIMG"+i).src ="images/shim.gif";
				document.getElementById("XIMG"+i).width ="0px";
				document.getElementById("XIMG"+i).height ="0px";
				document.getElementById("XIMG"+i).usmanimg ="";
			        document.getElementById("XINFO"+i).innerHTML =" ";
			        document.getElementById("XWISH"+i).innerHTML =" ";
			        document.getElementById("XECOM"+i).innerHTML =" ";
			        document.getElementById("XCOMP"+i).innerHTML =" ";
			        document.getElementById("XDET"+i).innerHTML =" ";
			        document.getElementById("XPRIC"+i).innerHTML =" ";
				if (document.getElementById("XID"+i))
			        document.getElementById("XID"+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
			//28 installation_name
			//29 description_name
				risCurrentPageRef(mysplit[3],mysplit[4]);
			document.getElementById("XIMG"+i).usmanimg =myarr[1];
if (CDNregim==0)
{
			document.getElementById("XIMG"+i).src = "http://www.lightsamerica.com/images/images/SM5/" +escape(myarr[1]);
document.getElementById("XSHA"+i).title ="LA";
}
else
{
document.getElementById("XSHA"+i).title ="CDN";
document.getElementById("XIMG"+i).src = "http://cdn.lightsamerica.com/images/SM5/" +escape(myarr[1]);
document.getElementById("XIMG"+i).onerror = imgError;
}
			document.getElementById("XIMG"+i).width =myarr[2];
			document.getElementById("XIMG"+i).height =myarr[3];


var buf=[];
	if (myarr[25] == "Y")
	{
        	        buf.push("<table border='0' cellspacing='0' cellpadding='0'>");
			if (myarr[32]!="")
			{
	               buf.push("<tr><td nowrap class='rezTxtList' align='left'>List Price:</td><td>&nbsp;</td>");
        	       buf.push("<td nowrap  align='right' class='rezPriceList'>"+myarr[32]+"</td></tr>");
			}
		               buf.push("<tr><td nowrap class='rezTxtReg' align='left'>Regular Price: </td><td>&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPriceReg'>"+myarr[26]+"</td></tr>");
		               buf.push("<tr><td nowrap align='left' class='rezTxtSale'>Sale Price:</td><td>&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPriceSale'>"+myarr[5]+"</td></tr>");
			if (myarr[27]!="0")
			{	
	               buf.push("<tr><td colspan=3 align='left' class='reztext'>"+taxSaleInfo(myarr[27])+"</td></tr>");
			}
			if (myarr[33]!="")
			{
		               buf.push("<tr><td nowrap class='rezTxtListSave' align='left'>You Save: </td><td>&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPriceListSave'>"+myarr[33]+"</td></tr>");
			}
		       buf.push("<tr><td class='reztext' colspan='3'>&nbsp;</td></tr>");
	    	       buf.push("<tr><td class='reztext'>ID #:</td><td class='rezbold'>"+myarr[20]+"</td></tr>");
	               buf.push("</table>");
			document.getElementById("XPRIC"+i).innerHTML =buf.join("");
	}
	else
	{
			if (myarr[32]=="")
			{
		               buf.push("<table border='0' cellspacing='0' cellpadding='0'>");
		               buf.push("<tr><td nowrap  align='right' class='rezPricePrice'>"+myarr[5]+"</td><td   class='reztext'>&nbsp;ID #:</td><td class='rezbold'>"+myarr[20]+"</td></tr>");
		               buf.push("</table>");
			document.getElementById("XPRIC"+i).innerHTML =buf.join("");
			}
			else
			{
		               buf.push("<table border='0' cellspacing='0' cellpadding='0'>");
		               buf.push("<tr><td nowrap class='rezTxtList' align='left'>List Price:&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPriceList'>"+myarr[32]+"</td></tr>");
		               buf.push("<tr><td nowrap class='rezTxtPrice' align='left'>Our Price:&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPricePrice'>"+myarr[5]+"</td></tr>");
		               buf.push("<tr><td nowrap class='rezTxtListSave' align='left'>You Save:&nbsp;</td>");
		               buf.push("<td nowrap  align='right' class='rezPriceListSave'>"+myarr[33]+"</td></tr>");
		    	       buf.push("<tr><td colspan='3' class='reztext'>&nbsp;</td></tr>");
		    	       buf.push("<tr><td class='reztext'>ID #:</td><td class='rezbold'>"+myarr[20]+"</td></tr>");
		               buf.push("</table>");
			document.getElementById("XPRIC"+i).innerHTML =buf.join("");
			}

	}
				var buf=[];
				buf.push("<TABLE cellSpacing=0 cellPadding=0 width='100%' border=0><TBODY>");
				buf.push("<tr><td align='left' class='reztypetext' colspan='2'>"+myarr[28]+"-"+myarr[29]+"</td></tr>");
				buf.push("<tr><td align='left' class='pricing'>");
					if (myarr[21]!="")
					{
					buf.push("<tr><td colspan='2' class='reztext' align='left'>MFR #:"+myarr[21]+"</td></tr>");
					}
					if (myarr[22]!="")
					{
					buf.push("<tr><td colspan='2'  class='reztext' align='left' ><table border='0' cellspacing='0' cellpadding='0' class='reztext' width='100%'><tr><td width='42px'>MFR &nbsp;&nbsp;:</td><td>"+myarr[22]+"</td></tr></table></td></tr>");
					}
				buf.push("</TBODY></TABLE>");
				if (document.getElementById("XITEM"+i))
				{
			               document.getElementById("XITEM"+i).innerHTML =buf.join("");
				}
				               document.getElementById("XWISH"+i).innerHTML ="<a href=\"javascript:getAjaxAddItem("+myarr[0]+",'"+myarr[4]+"');\"  ><img border='0' id='wishlist' src='images/wishlist.png' alt='Add to Wish List'  onmouseover=\"this.src='images/wishlist_off.png';\"  onmouseout=\"this.src='images/wishlist.png';\"></a>";
				if (myarr[23]=="EC")
				{
					if (myarr[24]=="Y")
					{
				               document.getElementById("XECOM"+i).innerHTML ="<a href='#' onclick=\"getAjaxAddCard("+myarr[0]+",'"+myarr[4]+"');\"  ><img border='0' id='wishlist' src='images/cart.png' alt='Add to Cart' onmouseover=\"this.src='images/cart_off.png';\"  onmouseout=\"this.src='images/cart.png';\"></a>";
					}
					else
					{
				               document.getElementById("XECOM"+i).innerHTML ="&nbsp;";
					}
				}
				if (document.getElementById("XCOMP"+i))
				{
			               document.getElementById("XCOMP"+i).innerHTML =risCompareRef(myarr[0],myCompare,"comparelist");
				}
				if (document.getElementById("XDET"+i))
				{
			               document.getElementById("XDET"+i).innerHTML ="<a href='search_individual_result.asp?current="+myarr[0]+"&page="+ mysplit[3]+"' class='moredetails' >MORE DETAILS</a>";
				}
buf=[];
buf.push("<TABLE cellSpacing=0 cellPadding=2 width='98%' border='0' align='center' class='resulttitle'><TBODY>");
buf.push("<tr><td align='left'  colspan='2' class='reztitle'>"+myarr[28]+"-"+myarr[29]+"</td></tr>");
		if (myarr[22] != "")
		{
buf.push("<tr><td nowrap colspan='3' align='left'><span class='reztext'>MFR:&nbsp;</span><span class='rezbold'>"+myarr[22]+"</span></td></tr>");
		}
		if (myarr[21] != "")
		{
buf.push("<tr><td nowrap colspan='3' align='left'><span class='reztext'>MFR #:&nbsp;</span><span class='rezbold'>"+myarr[21]+"</span></td></tr>");
		}
		if (myarr[14] != "")
		{
buf.push("<tr><td  align='left' class='reztext'  width='30%' valign='top'>MFR finish:&nbsp;</td><td class='rezbold'  align='left'  width='70%'>"+myarr[14]+"</td></tr>");
		}                                           
		if (ChkVal(myarr[8]) || ChkVal(myarr[9]) )
		{
buf.push("<tr><td  class='reztext' nowrap align='left'  width='30%'>Size (W x H) :</td><td class='rezbold' align='left'  width='70%'>"+myarr[8]+"\" x "+myarr[9]+"\"</td></tr>");
		}
		if (ChkVal(myarr[12])||ChkVal(myarr[13]))
		{
buf.push("<tr><td  class='reztext' nowrap align='left'>Bulbs (q x w):</td><td class='rezbold' align='left'>"+myarr[12]+" x "+myarr[13]+ "</td></tr>");
		}
		if (ChkVal(myarr[11]))
		{
buf.push("<tr><td  class='reztext' nowrap align='left'>Bulb Type:</td><td class='rezbold' align='left'>"+myarr[11]+"</td></tr>");
		}
buf.push("<tr><td colspan='3' align='left'><table  border='0' align='left' cellpadding='1' cellspacing='1' class='iconrightjustified'><tr>");
	if (myarr[16]=="1")
	{
	buf.push("<td width='24' align='right'><img src='images/standardicons/t24_icon.gif' title='Title 24 compatible' width='23' height='23'></td>");
	}
	if (myarr[17]=="1")
	{
	buf.push("<td width='24' align='right'><img src='images/standardicons/energystar_icon.gif' title='Energy Star' width='24' height='25'></td>");
	}
	if (myarr[18]=="1")
	{
	buf.push("<td width='24' align='right'><img src='images/standardicons/energy_efficient_icon.gif' title='Energy Efficent' width='25' height='25'></td>");
	}
	if (myarr[30]=="1")
	{
	buf.push("<td width='24' align='right'><img src='images/standardicons/ada_compliant_icon.gif' title='Ada Compilant' width='25' height='25'></td>");
	}
	if (myarr[18]=="1")
	{
	buf.push("<td width='24' align='right'><img src='images/standardicons/darksky_icon.gif' title='Dark Sky' width='25' height='25'></td>");
	}
buf.push("</tr></table></td></tr>");
buf.push("</TBODY></TABLE>");
				if (document.getElementById("XINFO"+i))
				{
			               document.getElementById("XINFO"+i).innerHTML =buf.join("");
				}

			}
		}
		}
	for (var i=1;i<xItemsOnPage+1;i++)	
	{
	mystroka=mysplit[i+sdvig];
	myarr=mystroka.split("~~");
		if (myarr[0]!="xxx") 
		{
			//document.getElementById("XIMG"+i).src = "usmanimage.aspx?img=" +escape(myarr[1])+"&w="+myarr[2]+"&h="+myarr[3];
//			document.getElementById("XAWISH"+i).innerHTML ="<a href=\"javascript:getAjaxAddItem("+myarr[0]+",'"+myarr[4]+"');\"  ><img src='images/addwishlist.png' title='Add to wishlist' border='0' onMouseOver=\"javascript:this.src='images/addwishlisthover.png'\" onMouseOut=\"javascript:this.src='images/addwishlist.png'\"></a>";
				buf=[];
				buf.push("<table   cellpadding=0 cellspacing=0 align='center' border=0>");
				if ((myarr[8]!="0") ||(myarr[9]!="0")  )
				{
				buf.push("<tr><td align=left class=maintextxx width=30% nowrap>");
				buf.push("Size (WxH):");
				buf.push("</td><td align=left class=maintextxx nowrap >");
				buf.push("<b>"+myarr[8]+"&quot; x "+myarr[9]+"&quot;</b></td></tr>");
			        }
				if (myarr[10]!="0")
				{
				buf.push("<tr><td align=left class=maintextxx  width=30% nowrap>");
				buf.push("Extension:");
				buf.push("</td><td align=left class=maintextxx nowrap>");
				buf.push("<b>"+myarr[10]+"</b>");
				buf.push("</td></tr>");
				}
				if (myarr[11]!="")
				{
				buf.push("<tr><td align=left class=maintextxx  width=30% nowrap>");
				buf.push("Bulb type:");
				buf.push("</td><td align=left class=maintextxx nowrap>");
				buf.push("<b>"+myarr[11]+"</b>");
				buf.push("</td></tr>");
				}
				if ((myarr[12]!="0") ||(myarr[13]!="0")  )
				{
				buf.push("<tr><td align=left class=maintextxx  width=30% nowrap>");
				buf.push("Bulb (qty x wattage):&nbsp");
				buf.push("</td><td align=left class=maintextxx nowrap>");
				buf.push("<b>"+myarr[12]+" x "+myarr[13]+"</b>");
				buf.push("</td></tr>");
			        }
				if (myarr[14]!="")
				{
				buf.push("<tr><td align=left class=maintextxx width=30% nowrap>");
				buf.push("Finish:");
				buf.push("</td><td align=left class=maintextxx nowrap>");
				buf.push("<b>"+myarr[14]+"</b>");
				buf.push("</td></tr>");
				}
				if (myarr[15]!="")
				{
				buf.push("<tr><td align=left class=maintextxx colspan=2 >Description:&nbsp;<b>");
				var promstr=myarr[15];
					if (promstr.length<40)
					{
					buf.push(promstr);
					}
					else
					{
					buf.push(promstr.substr(0,35)+"<br />");
					promstr=promstr.substr(35,promstr.length-35);
						if (promstr.length<50)
						{
						buf.push(promstr);
						}
						else
						{
							for (;promstr.length>50;)
							{
							buf.push(promstr.substr(0,50)+"<br/>");
							promstr=promstr.substr(50,promstr.length-50);
							}
							buf.push(promstr.substr(0,50));
						}
					}
				buf.push("</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!="")
				{
					buf.push("<tr><td align=left class=maintextxx width=30% nowrap>");
					buf.push("Options:");
					buf.push("</td><td align=left class=maintextxx nowrap>");
					buf.push("<b>"+dopOptions+"</b></td></tr>");
				}

				buf.push("</table>");
			document.getElementById("XIMG"+i).usmaninfo =buf.join("");
			document.getElementById("XIMG"+i).onmouseover =test1;
			document.getElementById("XSHA"+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()";
		}
	}
}

// myDraw List End
function test1(){
var zamenai=this.id.substring(4);
var ximg=document.getElementById("XIMG"+zamenai);
var file=ximg.usmanimg;
var infofile=ximg.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,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;
CloseDivProg();
		FlagAjax=0;
  http.onreadystatechange =null;
return false;
			 }

   } }
function ShowCrtWL()
{
 showdeadcenterdiv(550,200,"ViknoCrtWL");
 document.getElementById('ChgCrtName').value="New Wish List";
 document.getElementById('ChgCrtText').value="";
 document.getElementById('ViknoCrtWL').style.zIndex=500;
 document.getElementById("ViknoCrtWL").style.visibility='visible';
}
function CloseCrtWL()
{
document.getElementById('ViknoCrtWL').style.zIndex=0;
document.getElementById('ViknoCrtWL').height="0px";
document.getElementById('ViknoCrtWL').style.visibility='hidden';
}
function CreateNewWishList() {
if (FlagAjax == 0 )
{
FlagAjax=1;
document.getElementById("txtError").innerHTML="";
var myurl = "usmanajax_additem.asp?AddWL=451";
myurl=myurl +"&WNM="+escape(document.getElementById("ChgCrtName").value);
myurl=myurl +"&WTX="+escape(document.getElementById("ChgCrtText").value);
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"&rand="+myRand;
  http.open("GET", modurl, true);
  http.onreadystatechange = useHttpResponseAddItem;
  http.send(null);
}
}
function risPageAsList()
{
xColsInRow=2;
xItemsOnPage=6;
FlagAjax=0;
RegimSetkaList='1';
getAjaxPageNumber('1');
}
function risPageAsGallery()
{
xColsInRow=4;
xItemsOnPage=12;
FlagAjax=0;
RegimSetkaList='0';
getAjaxPageNumber('1');
}
function risNextPrevButtons(prPrev,prNext)
{
		if (prPrev=="prev")
		{
			if (document.getElementById("XPREVPGTOP"))
		               document.getElementById("XPREVPGTOP").innerHTML = "<a class='mainpagebuttons' href='javascript:getAjaxPrevPage();'  nowrap><img style='float: left;' alt='Previous Page' border='0' src='images/prev.png' /></a>";
			if (document.getElementById("XPREVPGBOT"))
        	       document.getElementById("XPREVPGBOT").innerHTML = "<a class='mainpagebuttons' href='javascript:getAjaxPrevPage();'  nowrap><img style='float: left;' alt='Previous Page' border='0' src='images/prev.png' /></a>";
                }
		else
		{
			if (document.getElementById("XPREVPGTOP"))
		               document.getElementById("XPREVPGTOP").innerHTML = "<img src=clear.jpg width=16px height=2px border=0 >";
			if (document.getElementById("XPREVPGBOT"))
		               document.getElementById("XPREVPGBOT").innerHTML = "<img src=clear.jpg width=16px height=2px border=0 >";
		}
		if (prNext=="next")
		{		
			var strNext="NEXT >>";
			if (GLang=="fra")
				strNext="SUIVANT";
			else if (GLang=="spa")
				strNext="Siguiente";
			if (document.getElementById("XNEXTPGTOP"))
		               document.getElementById("XNEXTPGTOP").innerHTML = "<a class='mainpagebuttons' href='javascript:getAjaxNextPage();' nowrap><img style='float: left;' alt='Next Page' border='0' src='images/next.png' /></a>";
			if (document.getElementById("XNEXTPGBOT"))
		               document.getElementById("XNEXTPGBOT").innerHTML = "<a class='mainpagebuttons' href='javascript:getAjaxNextPage();' nowrap><img style='float: left;' alt='Next Page' border='0' src='images/next.png' /></a>";
		}
		else
		{
			if (document.getElementById("XNEXTPGTOP"))
		               document.getElementById("XNEXTPGTOP").innerHTML = "<img src='images/shim.gif' width=16px height=12px border=0 >";
			if (document.getElementById("XNEXTPGBOT"))
        		       document.getElementById("XNEXTPGBOT").innerHTML = "<img src='images/shim.gif' width=16px height=12px border=0 >";
		}
}
function risCurrentPageRef(sCurr,sTotal)
{
if (document.getElementById("RisCurrentPage"))
{
	var buf=[];
	buf.push("&nbsp;Page ");
	buf.push("<select id=CurrentPage name=CurrentPage onchange='javascript:ChangePage();' class='ddltext' >");
	for(var str=1;str<parseInt(sTotal)+1;str++)
	{
		buf.push("<option value='"+str+"' >"+str+"</option>");
	}
	buf.push("</select>");
	buf.push(" of "+sTotal+"&nbsp;");
       document.getElementById("RisCurrentPage").innerHTML =buf.join("");
       document.getElementById("CurrentPage").value=sCurr;
};
if (document.getElementById("Ris2CurrentPage"))
{
	buf2=[];
	buf2.push("&nbsp;Page ");
	buf2.push("<select id=CurrentPageBot name=CurrentPageBot onchange='javascript:ChangePageBot();' class='ddltext' >");
	for(var str=1;str<parseInt(sTotal)+1;str++)
	{
		buf2.push("<option value='"+str+"' >"+str+"</option>");
	}
	buf2.push("</select>");
	buf2.push(" of "+sTotal+"&nbsp;");
       document.getElementById("Ris2CurrentPage").innerHTML =buf2.join("");
       document.getElementById("CurrentPageBot").value=sCurr;
};
}
function ChangePageBot()
{
document.getElementById("CurrentPage").value=document.getElementById("CurrentPageBot").value;
ChangePage();
}
function ChangePage()
{
	var iPage=0+parseInt(document.getElementById("CurrentPage").value);
	getAjaxPageNumber(iPage);
}
function risCompareRef(myID,arComp,compClass)
{
var buf=[];
buf.push("<table width='98%' border='0' cellspacing='0' celpadding='0'><tr><td align='left'><input type='checkbox'");
for(var k=0;k<arComp.length-1;k++)
{
	if (arComp[k]==myID)
	{
buf.push(" checked ");
	}
}
buf.push(" name='compare"+myID+"'  id='compare"+myID+"' onclick='javascript:AddCompare("+myID+")'  />");
buf.push("</td><td valign='center' align='left' ><label for='compare"+myID+"'  class='"+compClass+"'>");
if (GLang=="fra")
buf.push("Comparer");
else if (GLang=="spa")
buf.push("Comparar");
else
buf.push("Compare");
buf.push("</label>");
buf.push("</TD></TR></table>");
return buf.join("");
}
function ChgFiltBrand()
{
if (document.getElementById("filtBrand"))
{
myChangeBrand(document.getElementById("filtBrand").value)
}
}
function ChgFiltPrice()
{
if (document.getElementById("filtPrice"))
{
myChangePrice(document.getElementById("filtPrice").value)
}
}
function ChgFiltFinish()
{
if (document.getElementById("filtFinish"))
{
myChangeFinish(document.getElementById("filtFinish").value)
}
}
function ChgFiltStyle()
{
if (document.getElementById("filtStyle"))
{
myChangeStyle(document.getElementById("filtStyle").value)
}
}
function ClearFilter()
{
document.getElementById("filtFinish").value="0";
document.getElementById("filtStyle").value="0";
document.getElementById("filtBrand").value="0";
document.getElementById("filtPrice").value="0";
var form=window.document.forms[0];
RegimTailBrand=1;
ExpandBrand=false;
RegimTailFinish=1;
ExpandFinish=false;
RegimTailStyle=1;
ExpandStyle=false;
RegimTailPrice=1;
ExpandPrice=false;
  var myurl = 'usmanajax_search2.asp?params=Brand:0;Finish:0;Style:0;Price:0;';
	if (FlagAjax == 0 )
	{
	ShowDivProg();
	FlagAjax=1;
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"&rand="+myRand+" ";
	  http.open("GET", modurl, true);
	  http.onreadystatechange = useHttpResponseSearch2;
	  http.send(null);
	}
}
function RisItemsOnPageGallery(cQty)
{
var s="Items per page: <a href='javascript:myItemsBegin("+(2*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,2*cQty)+"'>"+(2*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(3*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,3*cQty)+"'>"+(3*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(5*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,5*cQty)+"'>"+(5*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(8*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,8*cQty)+"'>"+(8*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(12*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,12*cQty)+"'>"+(12*cQty)+"</a>";
return s
}
function RisItemsOnPageList(cQty)
{
var s="Items per page: <a href='javascript:myItemsBegin("+(3*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,3*cQty)+"'>"+(3*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(5*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,5*cQty)+"'>"+(5*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(8*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,8*cQty)+"'>"+(8*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(14*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,14*cQty)+"'>"+(14*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(20*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,20*cQty)+"'>"+(20*cQty)+"</a>&nbsp;&nbsp;&nbsp;";
s=s+"<a href='javascript:myItemsBegin("+(25*cQty)+");' class='"+StyleItemsOnpage(xItemsOnPage,25*cQty)+"'>"+(25*cQty)+"</a>";
return s
}
function StyleItemsOnpage(Qty,Kontra)
{
if (Qty==Kontra)
return "infoSelCommon";
else
return "infoCommon";
}
function myItemsBegin(Kol)
{
xItemsOnPage=Kol;
getAjaxPageNumber(1);
}
function ChkVal(Vhod)
{
if (Vhod =="" || Vhod== "0")
	return false;
return true;
}
function imgError()
{
this.src="http://lightsamerica.com/images/images/SM5/" +escape(this.usmanimg);
document.getElementById("XSHA"+this.id.substring(4)).title="LAe";
this.onerror=null;
return true;
}

