<script>
function getfav(offerid,title,pic)
{	
	var url = '<{$config.weburl}>/ajax_back_end.php';
	var myurl='<{$config.weburl}>/?m=offer%26s=offer_detail%26id='+offerid;
	var u='<{$smarty.cookies.USER}>';
	if(u=='')
	{
		alert('<{$lang.no_logo}>');
		window.location.href='<{$config.weburl}>/login.php?forward='+myurl;
		return false;
	}
	var fu=offerid;
 	var typ='2';
	var ttil=title;
	var mpic=pic;
	var des='';
    var pars = 'user='+u+'&fid='+fu+'&type='+typ+'&title='+ttil+'&url='+myurl+'&des='+des+'&picurl='+mpic;
	$.post(url, pars,showResponse);
	function showResponse(originalRequest)
	{
	    if(originalRequest>1)
	       alert('<{$lang.fav_ok}>');
		else if (originalRequest>0)
	       alert('<{$lang.fav_isbing}>');
		else
	       alert('<{$lang.error}>');
	}
}
function goto(v)
{
	window.location='<{$config.weburl}>/?m=offer&s=list&id=<{$smarty.get.id}>&order='+v;
}
</script>
<link href="<{$config.weburl}>/templates/default/offer.css" rel="stylesheet" type="text/css" />
<div class="main_guide">				
	<{$lang.you_are_here}><a href='<{$config.weburl}>/'><{$lang.indexpage}></a> &raquo; <a href='<{$config.weburl}>/?m=offer'><{$lang.offercat}></a> &raquo; <a><{if !$guide}>Product List<{else}><{$guide}><{/if}></a>
</div>
<div class="big_img_div" id="big_img_div" style="display:none;">&nbsp;</div>
<!---subcat start-->
<{if $subcat.0.catid}>
<div class="el_cat">
	<div class="el_catl">
    	<span class="el_cattit"><{$current_cat}></span>
        <ul class="el_catinf">
			<{foreach item=list from=$subcat}>
				<li><a href="<{$config.weburl}>/?m=buy&s=list&id=<{$list.catid}>"><{$list.cat}></a></li>
			<{/foreach}>
		</ul>
        <div class="clear"></div>
    </div>   
    <{foreach item=list from=$catfile}>
    <{assign var=fieldName value=$list.fieldName}>
    <{assign var=s value=$smarty.get.$fieldName}>
    <div class="el_catl">
      <span class="el_cattit"><{$list.fieldDisplay}></span>
        <ul class="el_catinf">
          <{foreach item=slist from=$list.catItem}>
          <li> <a <{if $smarty.get.$fieldName==$slist.0}><{/if}> href="<{$config.weburl}>/?<{$url|replace:"&$fieldName=$s":""}>&<{$list.fieldName}>=<{$slist.0}>"><{$slist.1}></a> </li>
          <{/foreach}>
        </ul>
      <div class="clear"></div>
      <{/foreach}> 
      </div>
	
</div>
<{/if}>
<!---subcat end-->
	<!--主体左侧 -->
    
    <div id="container">
    <div class="el_view">
        <div class="el_inq">
         	<input type="checkbox" name="checkbox" id="checkbox_2" onclick="do_select();">
        	<a rel="NoFollow" onclick="get_inquery();" href="#"> Inquire now</a> | <a rel="NoFollow" onclick="add_inquery('info','<{$config.weburl}>','');" href="javascript:void(0);"> Add to basket </a>
        </div>

        <div class="el_sta">
        	<div class="el_split"></div>
            <span>Sort by:</span>
            <select name="orderby" class="sltit" onchange="goto(this.value)">
                <option <{if $smarty.get.order==1}>selected="selected"<{/if}> value="1">Supplier Rank</option>
                <option <{if $smarty.get.order==2}>selected="selected"<{/if}> value="2">Date Product Posted</option>
            </select>
        </div>
        <div class="el_pic">
        	View : 
            <a class="<{if $smarty.get.type==""}>rmal<{else}>normal<{/if}>" href="<{$config.weburl}>/?m=offer&s=list<{if $smarty.get.id != ""}>&id=<{$smarty.get.id}><{/if}>"><span class="<{if $smarty.get.type==""}>rmal<{else}><{/if}>"></span><b></b></a>
            
<a class="<{if $smarty.get.type!=""}>rmat<{else}>normat<{/if}>" href="<{$config.weburl}>/?m=offer&s=list<{if $smarty.get.id != ""}>&id=<{$smarty.get.id}><{/if}>&type=1"><span class="<{if $smarty.get.type!=""}>rmat<{else}><{/if}>"></span><b></b></a>
        </div>
        <div class="clear"></div>
    </div>
	<div class="rightbar1" style="width:782px;">
         <{if $smarty.get.type==""}>  
            <div class="contentel">
            <ul class="list9">
            <{foreach item=list from=$info.list}>
                <li  style="padding:12px 0px;">
                    <div class="el_Lb0"><input name="inquery" type="checkbox" value="<{$list.id}>" /></div>
                    <div class="el_Lb1">
                    <{assign var="img" value=$list.img}>
                    <{assign var=big_img value=$list.big_img}>
                    <a href="<{$config.weburl}>/?m=offer&s=detail&id=<{$list.id}>" target="_blank" title="<{$list.title}>">
                    <{html_image onmouseout="view_big_img(this, '');" onmouseover="view_big_img(this,'$big_img');" file=$img width=150 alt=$list.title}>
                    </a>
                    </div>
                    <div class="el_Lb2">
						<a class="el_ltit" href="<{$config.weburl}>/?m=buy&s=detail&id=<{$list.id}>" target="_blank" title="<{$list.title}>"><{$list.title}></a>
                            <span class="dateTrade" style="padding-left:6px;"><{$list.uptime|date_format}></span>
                        <p><{$list.con|strip_tags|truncate:200:"...":true}></p>
                        <div class="el_catl2">
                               <a class="btnba" href="javascript:void(0);" onclick="add_inquery('info','<{$config.weburl}>','<{$list.id}>');" rel="NoFollow">Add to Basket</a>

                               <a  class="btnpo" href="javascript:void(0);" onclick="getfav(<{$list.id}>,'<{$list.title}>','<{$img}>');" rel="NoFollow">Add to My Products</a>
                        </div>
                    </div>
                    <div class="el_Lb3">
                    <{if !$smarty.get.key}>
                    <span>
                    <a class="el_lcompany" rel="nofollow" href="<{geturl uid=$list.userid user=$list.user}>" target="_blank" ><{$list.company}></a>
                    </span>
                    <{/if}>
                    <br />
                    <span class="el_lcity">Region: <{$list.province}>(<{$list.city}>)</span>
                    <{$list.user_type}> 
                    <br />
                    <a class="btnco" style="margin-left:0;" href="shop.php?uid=<{$list.userid}>&action=mail&m=company" target="_blank" rel="NoFollow">Contact Now</a></span> 
                    </div>
            </li>
            <{foreachelse}>
                  <div style="padding:20px; font-weight:bold">
                  <{$lang.no_offer}> 
                  <a href="<{$config.weburl}>/main.php"><font color="#FF0000"><{$lang.now_add}></font></a>
                  </div>
                <{/foreach}>
            </ul>
            <div class="page"><{$info.page}></div>
            </div>
        <{else}>
            <div class="contentel">
            <ul class="listdt">
            <{foreach item=list from=$info.list}>
                <li>
                    <dl class="imgText">
                            <dd class="Photo222">
                                <a href="<{$config.weburl}>/?m=offer&s=detail&id=<{$list.id}>" target="_blank">
                                    <{assign var="img" value=$list.img}>
                                    <{html_image file=$img width=222 height=220 alt=$list.title}>
                                </a>
                            </dd>
                            <dt class="dtitle">
                            <input name="inquery" type="checkbox" value="<{$list.id}>" />
                            <a  class="el_ltit" href="<{$config.weburl}>/?m=offer&s=detail&id=<{$list.id}>" target="_blank" title="<{$list.title}>"><{$list.title}></a>
                            </dt>
                            <dd class="el_lcity">Region: <{$list.province}>(<{$list.city}>)</dd>
                            <dd class="el_catl2"><a class="btnba" href="javascript:void(0);" onclick="add_inquery('info','<{$config.weburl}>','<{$list.id}>');" rel="NoFollow"> Add to Basket</a>
                            <a class="btnco" href="shop.php?uid=<{$list.userid}>&action=mail&m=company" target="_blank" rel="NoFollow"> Contact Now</a></dd>
                            
                            <dd class="imgListRnak"><div class="imgListRnak2"></div></dd>
                        </dl>
                </li>
            <{foreachelse}>
                      <div style="padding:20px; font-weight:bold">
                     <{$lang.no_offer}> 
                      <a href="<{$config.weburl}>/main.php">
                       <font color="#FF0000">
                      <{$lang.now_add}>
                      </font>
                      </a>
                      </div>
                <{/foreach}>
            </ul>
            <div class="page"><{$info.page}></div>
            <!--  PRODUCT LIST END -->
        </div>
        <!--contents end-->
        <{/if}>
	</div>
    <!--主体右侧-->
    <div class="efleftbar">
    	<div class="eflefts m1">
            <h3>Premium Related Products</h3>
            <ul class="eflistr">
                <{insert name="label" catid=$smarty.get.id type="buy" temp="buy_piclistel" limit=3}>
           	</ul>
		</div>
	</div>
    <div class="clear"></div>
<script>
function do_select()
{
	 var box_l = document.getElementsByName("inquery").length;
	 for(var j = 0 ; j < box_l ; j++)
	 {
		if(document.getElementsByName("inquery")[j].checked==true)
		  document.getElementsByName("inquery")[j].checked = false;
		else
		  document.getElementsByName("inquery")[j].checked = true;
	 }
}

function get_inquery()
{	
	var pid='';
	var boxes = document.getElementsByName("inquery");   
	for (var i = 0; i < boxes.length; i++)  
	{  
		if(boxes[i].checked)  
		{  
			pid+=boxes[i].value+',';  
		} 
	}
	window.location='<{$config.weburl}>/?m=message&s=inquire&contype=2&offerid='+pid;
}
</script>