

function reqDV(){
FSF_DBReq('res/php/db.php?req=dvlist',loadDV)
}

function imakeDV(id,t,td,p){
if(p==null){
p=''
}
return '<LI '+p+' title="'+td+'" onclick=\'FSF_makefURL("reqDVI","'+id+'")\' ><b><A '+FSF_fixIEL()+'>'+t+'</A></b></LI>'
}

function loadDV(db){
var s='<UL>'
i=0
s+=imakeDV(db[i],db[i+1],db[i+2],'class=bg_list_sub')
mdvu[db[i]]=[]
mdvu[db[i]]['t']=db[i+1]
mdvu[db[i]]['tt']=db[i+2]
for(var i=3;i<db.length;i+=3){
mdvu[db[i]]=[]
mdvu[db[i]]['t']=db[i+1]
mdvu[db[i]]['tt']=db[i+2]
s+=imakeDV(db[i],db[i+1],db[i+2])
}
FSF_OBJ('div_Fncat').innerHTML=s+'</UL>'
}

function reqDVI(id){
FSF_DBReq('res/php/db.php?req=loaddv&id='+id,loadDVI)
}

function loadDVI(db){
FSF_makeMPage('1',db[0],'<div style="width:575px;overflow:auto;">'+db[1]+'</div>')
}

function reqspHOT(){
FSF_DBReq('res/php/db.php?req=loadsph',loadspHOT)
}

function imakeSPH(id,t,g,a,s,p){
return '<table class="item_out2" onmouseover=\'this.className="item_ovr";\' onmouseout=\'this.className="item_out2";\' onclick=\'FSF_makefURL("reqITEM","'+s+'","'+id+'");\'><tr><td><IMG lang="FYODOR" height=100 src="res/item/'+a+'.gif" width=120 border=0 style="border-right:1px solid #cccccc;border-bottom:1px solid #cccccc;"><BR><BR style="LINE-HEIGHT: 1px">'
+'<STRONG>'+t+'</STRONG> <BR><BR style="LINE-HEIGHT: 1px"><B>'+g+' USD</B>'
+'</TD></TR></TABLE>'
+'</TD></TR></TBODY></TABLE>'+p
}




function loadspHOT(db){
if(db.length>0){
var s=''
for(var i=0;i<db.length-5;i+=5){
s+=imakeSPH(db[i],db[i+1],db[i+2],db[i+3],db[i+4],'<hr width=80% align=center>')
}
s+=imakeSPH(db[i],db[i+1],db[i+2],db[i+3],db[i+4],'')
FSF_OBJ('div_spHOT').innerHTML=s
}
}


function reqADS(){
FSF_DBReq('res/php/db.php?req=loadads',loadADS)
}

function imakeADS(t,u,tt,a){
return '<table class="item_out2" title="'+t+'\n\n'+u+'\n'+tt.replace(/<br>/g,'\n')+'" onmouseover=\'this.className="item_ovr2";\' onmouseout=\'this.className="item_out2";\' ><tr><td><a href="'+u+'" target="_blank"><IMG title=" '+t+' " alt="'+t+'" src="res/ads/'+a+'.gif" width=160 border=0></A><BR><BR style="LINE-HEIGHT: 1px">'
+'</TD></TR></TABLE>'
+'</TD></TR></TBODY></TABLE>'
}

function loadADS(db){
var s=''
for(var i=0;i<db.length;i+=4){
s+=imakeADS(db[i],db[i+1],db[i+2],db[i+3])
}
FSF_OBJ('div_Ads').innerHTML=s
}

function reqHTKTL(){
FSF_DBReq('res/php/db.php?req=htktl',loadHTKTL)
}

function imakeHT2(id,t,tt){
return '<TR><TD class=bg vAlign=top align=middle width="100%" title="'+t+'" onmouseover=\'this.className="item_ovr";\' onmouseout=\'this.className="item_out";\' onclick=\'FSF_makefURL("reqHT","'+id+'");\'>'
+'<TABLE cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD width=10>&nbsp;</TD><TD style="PADDING-RIGHT: 10px; VERTICAL-ALIGN: middle"  height=32><BR style="LINE-HEIGHT: 15px"><span style="font-weight:bold;font-size:16px;border-bottom:1px solid #888888;border-left:1px solid #888888;padding-left:10px;padding-bottom:5px;padding-right:80px;">'+t+'</span><br><br> </TD></TR>'
//+'<TR>'
//+'<TD>&nbsp;</TD><TD style="VERTICAL-ALIGN: middle" height=60><span style="font-size:11px;">'+tt+'</span><br><BR><br></TD></TR>'
+'</TBODY></TABLE></TD></TR>'
}

function imakeHT(id,t,tt){
return '<A '+FSF_fixIEL()+' onclick=\'FSF_makefURL("reqHT","'+id+'");\' style="cursor:hand;"><strong>&#9679; '+t+'</strong></a><br>'
}

function loadHTKTL(db){
var s='<TABLE class="box_width_cont product" style="BACKGROUND: #7FB9F0" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD width=96% align = center >'
+'<TABLE class="" cellSpacing=0 cellPadding=0 border=0 style="BACKGROUND: #FFFFFF">'
+'<TBODY>'
+'<TR><td style="padding: 4px 4px 4px 4px;">'

for(var i=0;i<db.length;i+=3){
s+=imakeHT(db[i],db[i+1],db[i+2])
}

s+='</td></tr></tbody></table></td></tr></tbody></table>'
FSF_makeMPage('1','Review',s)
}

function reqHT(id){
FSF_DBReq('res/php/db.php?req=loadht&id='+id,loadDVI)
}



function reqCSTOCK(p){
FSF_DBReq('res/php/db.php?req=loadcstock&p='+p,loadCSTOCK)
}

function loadCSTOCK(db){

var total=Number(db[1])
var page=Number(db[0])

var s='<TABLE class="box_width_cont product" style="BACKGROUND: #7FB9F0" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD>'
+'<TABLE class="" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'

if(total>0){

var jrow=0;
for(var i=2;i<db.length;i+=6){
if(jrow==1){
s+='<TD style="WIDTH: 6px"><IMG height=1 alt="" src="" width=6 border=0></TD>'
}
itmp=db[i+2].split('#')

s+=imakeSRCH(db[i],db[i+1],itmp[0],db[i+3],db[i+4],db[i+5],itmp[1])
if(jrow==1){
jrow=0;
s+='</tr><TR><TD colSpan=4 height=6><IMG height=1 alt="" src="" width=1 border=0></TD></TR><tr>'
}else{
jrow++
}
}


if(i==8){
s+='<TD vAlign=top align=middle width="50%">&nbsp;</td>'
}
s+='</tr></tbody></table></td></tr></tbody></table>'
var to=Math.floor(total/per)
if(to!=total/per){
to++
}

if(to>1){
s+='<table width=100%   style="BACKGROUND: #7FB9F0"><tr align=right><td>Trang '
for(var i=0;i<to;i++){
s+=' <span  class=ml2>'
if(i!=page){
s+='<a class=ml2 '+FSF_fixIEL()+' onclick=\'FSF_makefURL("reqCSTOCK","'+i+'");\'>['+(i+1)+']</a>'
}else{
s+=(i+1)
}
s+='</span> '
}
}


FSF_makeMPage('1','Clear Stock',s)
}

}

function reqOPAGE(id){
FSF_DBReq('res/php/db.php?req=loadop&id='+id,loadDVI)
}

function reqSPM(){
FSF_DBReq('res/php/db.php?req=loadspm',loadSPM)
}

function loadSPM(db){
var s='<TABLE class="box_width_cont product" style="BACKGROUND: #7FB9F0" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD>'
+'<TABLE class="" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'


var jrow=0;
for(var i=0;i<db.length;i+=6){
if(jrow==1){
s+='<TD style="WIDTH: 6px"><IMG height=1 alt="" src="" width=6 border=0></TD>'
}

itmp=db[i+2].split('#')

s+=imakeSRCH(db[i],db[i+1],itmp[0],db[i+3],db[i+4],db[i+5],itmp[1])

if(jrow==1){
jrow=0;
s+='</tr><TR><TD colSpan=4 height=6><IMG height=1 alt="" src="" width=1 border=0></TD></TR><tr>'
}else{
jrow++
}
}


if(i==8){
s+='<TD vAlign=top align=middle width="50%">&nbsp;</td>'
}
s+='</tr></tbody></table></td></tr></tbody></table>'

FSF_makeMPage('1','S&#7843;n ph&#7849;m m&#7899;i nh&#7845;t',s)
initLightbox();

}

function goHP(){
reqSPM()
}

function imakeSP(id,t,tt){
return '<TR><TD class=bg vAlign=top align=middle width="100%" title="'+t+'" onmouseover=\'this.className="item_ovr";\' onmouseout=\'this.className="item_out";\' onclick=\'FSF_makefURL("reqILIST2","'+id+'","0","0","0");\'>'
+'<TABLE cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD width=10>&nbsp;</TD><TD style="PADDING-RIGHT: 10px; VERTICAL-ALIGN: middle"  height=32><BR style="LINE-HEIGHT: 15px"><span style="font-weight:bold;font-size:16px;border-bottom:1px solid #888888;border-left:1px solid #888888;padding-left:10px;padding-bottom:5px;padding-right:80px;">'+t+'</span><br><br> </TD></TR>'
+'<TR>'
+'<TD>&nbsp;</TD><TD style="VERTICAL-ALIGN: middle" height=60><span style="font-size:11px;">'+tt+'</span><br><BR><br>'
+'</TD></TR></TBODY></TABLE></TD></TR>'
}


function dispSP(){
/*
var s='<TABLE class="box_width_cont product" style="BACKGROUND: #7FB9F0" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD width=100%>'
+'<TABLE class="" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'

for(var i in mcat){
if(!isNaN(mcat[i])){
s+=imakeSP(i,mcat[i]['t'],mcat[i]['tt'])
}
}

s+='</tr></tbody></table></td></tr></tbody></table>'
FSF_makeMPage('1','S&#7843;n ph&#7849;m',s)
*/
reqDSSP('0');
}

function imakeDV2(id,t,tt){
return '<TR><TD class=bg vAlign=top align=middle width="100%" title="'+t+'" onmouseover=\'this.className="item_ovr";\' onmouseout=\'this.className="item_out";\' onclick=\'FSF_makefURL("reqDVI","'+id+'");\'>'
+'<TABLE cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD width=10>&nbsp;</TD><TD style="PADDING-RIGHT: 10px; VERTICAL-ALIGN: middle" height=32><BR style="LINE-HEIGHT: 15px"><span style="font-weight:bold;font-size:16px;border-bottom:1px solid #888888;border-left:1px solid #888888;padding-left:10px;padding-bottom:5px;padding-right:80px;">'+t+'</span><br><br> </TD></TR>'
+'<TR>'
+'<TD>&nbsp;</TD><TD style="VERTICAL-ALIGN: middle" height=60><span style="font-size:11px;">'+tt+'</span><br><BR><br>'
+'</TD></TR></TBODY></TABLE></TD></TR>'
}


function dispDV(){
var s='<TABLE class="box_width_cont product" style="BACKGROUND: #7FB9F0" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD width=100%>'
+'<TABLE class="" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'

for(var i in mdvu){
if(!isNaN(mdvu[i])){
s+=imakeDV2(i,mdvu[i]['t'],mdvu[i]['tt'])
}
}

s+='</tr></tbody></table></td></tr></tbody></table>'
FSF_makeMPage('1','Custumer care',s)
}


function reqDSSP(p){
FSF_DBReq('res/php/db.php?req=loaddssp&p='+p,loadDSSP)
}

function loadDSSP(db){
var total=Number(db[1])
var page=Number(db[0])

var s='<TABLE class="box_width_cont product" style="BACKGROUND: #7FB9F0" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'
+'<TD>'
+'<TABLE class="" cellSpacing=0 cellPadding=0 border=0>'
+'<TBODY>'
+'<TR>'

if(total>0){

var jrow=0;
for(var i=2;i<db.length;i+=6){
if(jrow==1){
s+='<TD style="WIDTH: 6px"><IMG height=1 alt="" src="" width=6 border=0></TD>'
}
itmp=db[i+2].split('#')

s+=imakeSRCH(db[i],db[i+1],itmp[0],db[i+3],db[i+4],db[i+5],itmp[1])
if(jrow==1){
jrow=0;
s+='</tr><TR><TD colSpan=4 height=6><IMG height=1 alt="" src="" width=1 border=0></TD></TR><tr>'
}else{
jrow++
}
}


if(i==8){
s+='<TD vAlign=top align=middle width="50%">&nbsp;</td>'
}
s+='</tr></tbody></table></td></tr></tbody></table>'
var to=Math.floor(total/per)
if(to!=total/per){
to++
}

if(to>1){
s+='<table width=100%   style="BACKGROUND: #7FB9F0"><tr align=right><td>Trang '
for(var i=0;i<to;i++){
s+=' <span  class=ml2>'
if(i!=page){
s+='<a class=ml2 '+FSF_fixIEL()+' onclick=\'FSF_makefURL("reqDSSP","'+i+'");\'>['+(i+1)+']</a>'
}else{
s+=(i+1)
}
s+='</span> '
}
}


FSF_makeMPage('1','S&#7842;n ph&#7849;m',s)
}

}
