function showPLmenu(){
	var _html = 
		'<table class="pl_menu" width="100%" border="0" cellpadding="0" cellspacing="0">' + 
		  '<tr>' + 
		  '<td class="pl_menu_left">&nbsp;</td>' + 
		  '<td width="150">Sort by ' + 
			'<select id="pl_sort" name="sort_by" size="1">' + getSortValue() + '</select>&nbsp;&nbsp;&nbsp;' + 
			'<a id="pl_sortdir" href="javascript:void(0)" title="'+pl.sort_dir+'"><img src="'+pl.pl_imgpath+pl.sort_dir+'.gif" border="0" /></a>' + 
			'</td>' + 
			'<td class="pl_sep"></td>' + 
			'<td width="120" id="pl_viewnum">' + 
			'<a href="javascript:void(0)" title="large">' + view['large'][0] + '</a>&nbsp;&nbsp;' + 
			'<a href="javascript:void(0)" title="med">' + view['med'][0] + '</a>&nbsp;&nbsp;' + 
			'<a href="javascript:void(0)" title="small">' + view['small'][0] + '</a>&nbsp;&nbsp;&nbsp;per page' + 
			'</td>' + 
			'<td class="pl_sep"></td>' + 
			'<td width="120" id="pl_viewbuttons">' + 
			'<a href="javascript:void(0)" title="small"><img src="'+pl.pl_imgpath+'az_pl_button_small.png" border="0" align="middle" /></a> ' + 
			'<a href="javascript:void(0)" title="med"><img src="'+pl.pl_imgpath+'az_pl_button_med.png" border="0" align="middle" /></a> ' + 
			'<a href="javascript:void(0)" title="large"><img src="'+pl.pl_imgpath+'az_pl_button_large.png" border="0" align="middle" /></a>' + 
			'</td>' + 
			'<td class="pl_sep"></td>' +
			'<td width="160">' +
			'<div class="pl_slider_container">' + 
			'<div id="pl_prev" title="previous"></div>' + 
			'<div id="pl_slider"><div class="pl_handle"></div></div>' + 
			'<div id="pl_next" title="next"></div></div> ' + 
			'</td>' + 
			'<td><span id="page_result">&nbsp;</span></td>' +
			'<td class="pl_menu_right">&nbsp;</td>' +
		  '</tr>' +
		'</table>';
	return _html;
}

function showPLcontent(pl_data){
	var _html = '';
	var add_to_cart_btn = '';
	var our_price = '';
	
	switch(pl.view){
		case "large":
			$(pl_data).each(function(i, data){
									 
				add_to_cart_btn = '';
				our_price = '<td class="pl_text">' + 
						 '<span class="pl_price"></span>' + 
						 '</td>';
				
				imgpath = pl.imgpath + data['image'];
				
				if(data['cart'] != '-1'){
					add_to_cart_btn = '<a href="javascript:void(0)" title="'+data['id']+'" class="addtocart">' + 
						   '<img title="add to cart" src="'+pl.pl_imgpath+'pl_cart.gif" border="0" /></a>';

					our_price = '<td class="pl_text">Our Price ' + 
						 '<span class="pl_price">' + getPrice(data['price'], data['sprice']) + '</span>' + 
						 '</td>';
				}else{
				    add_to_cart_btn = call_for_price_button;
				}
                
                if(pl_data[i]['quantity'] == 0){
                   add_to_cart_btn = sold_out_button; 
                }
                
				imgDimension = (view[pl.view][2] ? 'width="'+view[pl.view][2]+'" ' : '') + (view[pl.view][3] ? 'height="'+view[pl.view][3]+'" ' : '');
				ptitle = data['title'].length > 25 ? data['title'].substr(0,25)+'...' : data['title'];
				_html += '<div class="pl_large">' + 
    					 '<table width="98%" align="center" border="0" cellpadding="2" cellspacing="0"><tr>' + 
	    				 '<td width="38%" align="center" valign="middle">' + 
					  	 '<img src="'+imgpath+'" border="0" ' + imgDimension + ' />' + 
						 '</td>' + 
						 '<td width="62%" valign="top">' + 
		  				 '<table width="100%" border="0" cellpadding="2" cellspacing="2"><tr>' + 
			  			 '<th colspan="2" align="left">' + 
						 '<div id="err'+data['id']+'" class="pl_errorbox"><img src="'+pl.loading1+'" border="0" width="16" height="16" /></div>' + 
						 '<div>' + 
			    		 '<span class="pl_title">' + ptitle + '</span>' + 
						 '<span id="cart'+data['id']+'" class="pl_cart">' + (data['cart']>0 ? '&nbsp;'+data['cart'] + ' IN CART&nbsp;' : '') +'</span>' + 
						 '</div>' + 
			  			 '</th>' + 
						 '</tr>' + 
						 '<tr>' + 
						 '<td colspan="2"><p class="pl_desc">' + data['desc'] + '</p></td>' + 
						 '</tr>' + 
						 '<tr height="40">' + our_price + 
						 '<td align="right">' + 
						 '<a href="'+pl.xmlsrc+'?task=viewinfo&'+pl.params+'&pid='+data['id']+'" rel="facebox" title="More Info">' + 
						 '<img src="'+pl.pl_imgpath+'pl_info.gif" border="0" /></a> ' + add_to_cart_btn +
					     '</td></tr></table></td>' + 
						 '</tr></table>' + 
					  	 '</div>';
				if(((i+1)%view[pl.view][1]) == 0 && i < (pl_data.length-1)){
					_html += '<div class="prod_sep_hor sep_large"></div>';
				}
			});
		break;
		case "med":
			$(pl_data).each(function(i, data){
				add_to_cart_btn = '';
				imgpath = pl.imgpath + data['image'];				
				
				if(data['cart'] != '-1' && data['quantity'] > 0){
					add_to_cart_btn = '<a href="javascript:void(0)" title="'+data['id']+'" class="addtocart">' + '<img title="add to cart" src="'+pl.pl_imgpath+'az_pl_addtocart.gif" border="0" /></a>' + '&nbsp;&nbsp;';						 
				}
				
				imgDimension = (view[pl.view][2] ? 'width="'+view[pl.view][2]+'" ' : '') + (view[pl.view][3] ? 'height="'+view[pl.view][3]+'" ' : '');
				ptitle = data['title'].length > 10 ? data['title'].substr(0,10)+'...' : data['title'];
				_html += '<div class="pl_med">' + 
						 '<div id="err'+data['id']+'" class="pl_errorbox"><img src="'+pl.loading1+'" border="0" width="16" height="16" /></div>' + '<div>' +  
						 '<span class="pl_title">' + ptitle + '</span>' + 
						 '<span id="cart'+data['id']+'" class="pl_cart">' + 
						   (data['cart']>0 ? '&nbsp;'+data['cart'] + ' IN CART&nbsp;' : '') +'</span>' + 
						 '<br class="clear" />' + 
						 '<center><a href="'+pl.xmlsrc+'?task=viewinfo&'+pl.params+'&pid='+data['id']+'" rel="facebox" title="More Info">' + 
						 '<img src="'+imgpath+'" border="0" ' + imgDimension + ' />' + 
						 '</a></center>' + 
						 '<span class="pl_price">' + getPrice(data['price'], data['sprice']) + '</span>' + 
						 '<span class="pl_buttons">' + add_to_cart_btn
						 + 
						 '<a href="' + imgpath + '" title="' + data['title'] + '" rel="facebox">' + 
						   '<img src="'+pl.pl_imgpath+'az_pl_zoom.gif" border="0" /></a>' + 
						 '</span>' +  '</div>' +
						 '</div>';
				if(((i+1)%view[pl.view][1]) == 0 && i < (pl_data.length-1)){
					_html += '<div class="prod_sep_hor"></div>';
				}else{
					if(i < (pl_data.length-1))	_html += '<div class="prod_sep_ver sep_med"></div>';
				}
			});
		break;
		case "small":
			$(pl_data).each(function(i, data){
				add_to_cart_btn = '';
				imgpath = pl.imgpath + data['image'];
				
				if(data['cart'] != '-1' && data['quantity'] > 0){
					add_to_cart_btn = '<a href="javascript:void(0)" title="'+data['id']+'" class="addtocart">' + 
						   '<img title="add to cart" src="'+pl.pl_imgpath+'az_pl_addtocart.gif" border="0" /></a>';
				}
				
				imgDimension = (view[pl.view][2] ? 'width="'+view[pl.view][2]+'" ' : '') + (view[pl.view][3] ? 'height="'+view[pl.view][3]+'" ' : '');
				ptitle = data['title'].length > 10 ? data['title'].substr(0,10)+'...' : data['title'];
				_html += '<div class="pl_small">' + 
						 '<div id="err'+data['id']+'" class="pl_errorbox"><img src="'+pl.loading1+'" border="0" width="16" height="16" /></div>' + 
						 '<div>' + 
						 '<span class="pl_title">' + ptitle + '</span>' + 
						 '<span id="cart'+data['id']+'" class="pl_cart"> ' + 
						   (data['cart']>0 ? '&nbsp;'+data['cart'] + ' IN CART&nbsp;' : '') +' </span>' + 
						 '<br class="clear" />' + 
						 '<center><a href="'+pl.xmlsrc+'?task=viewinfo&'+pl.params+'&pid='+data['id']+'" rel="facebox" title="More Info">' + 
						 '<img src="'+imgpath+'" border="0" ' + imgDimension + ' />' + 
						 '</a></center>' + 
						 '<span class="pl_price">' + getPrice(data['price'], data['sprice']) + '</span>' + 
						 '<span class="pl_buttons">' + add_to_cart_btn + 
						 '&nbsp;&nbsp;' + 
						 '<a href="' + imgpath + '" title="' + data['title'] + '" rel="facebox">' + 
						   '<img src="'+pl.pl_imgpath+'az_pl_zoom.gif" border="0" /></a>' + 
						 '</span>' + 
						 '</div>' + 
						 '</div>';
				if(((i+1)%view[pl.view][1]) == 0 && i < (pl_data.length-1)){
					_html += '<div class="prod_sep_hor"><img src="'+pl.pl_imgpath+'spacer.gif" border="0" width="1" height="12" /></div>';
				}else{
					if(i < (pl_data.length-1))	_html += '<div class="prod_sep_ver sep_small"></div>';
				}
			});
		break;
	}
	_html += '<div class="clear"></div>';
		
	$("#pl_content").html(_html);
		
	$("div.pl_med, div.pl_small").mouseover(function(){
		$(this).toggleClass("pl_view_hover");
	}).mouseout(function(){
		$(this).toggleClass("pl_view_hover");
	});
	
	$(".pl_buttons img").mouseover(function(){
		$(this).css({"width": 18, "height": 18});
	}).mouseout(function(){
		$(this).css({"width": 15, "height": 15});
	});
	
	$("a.addtocart").click(function(){
		if($(".pl_errorbox").is(":animated")==false){
			addtocart(this.title);
		}
	});
	
	jQuery('a[rel*=facebox]').facebox();
	$('#facebox').bgiframe();
}

function getSortValue(){
	var opt = "";
	opt += '<option value="latest"'+(pl.sortby=="latest" ? ' selected="selected"' : '' )+'>Latest</option>' + 
		   '<option value="name"'+(pl.sortby=="name" ? ' selected="selected"' : '' )+'>Name</option>' + 
		   '<option value="price"'+(pl.sortby=="price" ? ' selected="selected"' : '' )+'>Price</option>' + 
		   '<option value="brand"'+(pl.sortby=="brand" ? ' selected="selected"' : '' )+'>Brand</option>';
	
	return opt;
}

function toggleProdInfo(show, obj){
	if(show == true){
		$(".pl_title", obj).css({visibility:"visible"});
		$(".pl_cart", obj).css({visibility:"visible"});
		$(".pl_price", obj).css({visibility:"visible"});
		$(".pl_buttons", obj).css({visibility:"visible"});
	}else{
		$(".pl_title", obj).css({visibility:"hidden"});
		$(".pl_cart", obj).css({visibility:"hidden"});
		$(".pl_price", obj).css({visibility:"hidden"});
		$(".pl_buttons", obj).css({visibility:"hidden"});
	}
}

function getPrice(price, sprice){
	if(!sprice == 0){
		price = '<s>' + price + '</s> ' + sprice;
	}
	return price;
}

function getLoading1(){
	return '<img src="'+pl.loading1+'" border="0" width="16" height="16" />';
}