function changeDataMatchResolution(sel){if(sel=="")sel=".list_product,.list_review,.list_category";$(sel).each(function(index){width=(typeof($(this).attr("dataWidth"))!="undefined"?$(this).attr("dataWidth"):(isIE?157:158));col=(typeof($(this).attr("dataCol"))!="undefined"?$(this).attr("dataCol"):8);numCol=parseInt($(this).width()/width);if(numCol<3)numCol=3;if(numCol>col)numCol=col;colWidth=100/numCol;if(isIE6||isIE7)colWidth=colWidth-0.1;$(this).find(".fl").width(colWidth+"%");n=$(this).attr("dataLine")*numCol;$(this).find(".fl:lt("+n+")").removeClass("hidden");if(n>0)$(this).find(".fl:gt("+(n-1)+")").addClass("hidden");$(this).find(".page_div a,.page_div_top a").each(function(index2){$(this).attr("href",function(index3,attr){return changePageSize(attr,n)})});if($(this).hasClass("view_thumbnail_table")==true){$(this).parent().find(".page_div a,.page_div_top a").each(function(index2){$(this).attr("href",function(index3,attr){return changePageSize(attr,n)})})}})}function changePage(sel,index){$("."+sel+" > ul").hide();$("."+sel+" > ul:eq("+index+")").fadeIn("slow");$("."+sel+" > .page_break a").removeClass("current");$("."+sel+" > .page_break a:eq("+index+")").addClass("current")}function changePageSize(url,n){urlReturn="";check=url.lastIndexOf(".php?");if(check==-1){temp=url.lastIndexOf("_");if(temp!=-1)urlReturn=url.substr(0,temp)+"_"+n;else urlReturn=url+"_"+n}else{temp=url.lastIndexOf("page=");if(temp==-1){urlReturn=url}else{temp1=url.substr(0,temp);temp2=url.substr((temp+5));urlReturn=temp1+"page="+parseInt(temp2)+"_"+n}}return urlReturn}function checkProductFormAction(form,type){ob=$("form[name='"+form+"']");if(ob.find("input[name='c\[\]']:checked").length==0){alert("Bạn hãy chọn ít nhất 1 sản phẩm.");return}ob.find("input[name='redirect']").removeAttr("disabled");switch(type){case"add_to_favorites":url=con_root_path+"add_to_favorites.php";break;case"add_to_estore_temp":url=con_root_path+"add_to_estore_temp.php";break;default:ob.find("input[name='redirect']").attr("disabled",true);url=con_root_path+"compare.php";break}ob.attr({action:url,method:"get"});ob.submit()}function deleteExclusivePicture(iPro,iGal,authen_code){if(confirm("Bạn có muốn xóa ảnh n y không?")){$("#picture_"+iPro+"_"+iGal).load(con_ajax_path+"delete_exclusive_picture.php?iPro="+iPro+"&iGal="+iGal+"&authen_code="+authen_code)}}function fixHeightFooter(){$(".fix_height_footer").height(0);if($(".container_content_left").height()!==null){if($(".container_content_center").height()!==null){height=($(".container_content_center").height()<$(".container_content_right").height()?$(".container_content_right").height():$(".container_content_center").height());if(height<$(".container_content_left").height()){fix_height_footer=$(".container_content_left").height()-height;$(".fix_height_footer").height(fix_height_footer)}}else{if($(".container_content_center_right").height()<$(".container_content_left").height()){fix_height_footer=$(".container_content_left").height()-$(".container_content_center_right").height();$(".fix_height_footer").height(fix_height_footer)}}}}function generateDataOption(compare,add_to_estore,logged,supplier){if(compare==1)document.write('<a class="compare" href="javascript:checkProductFormAction(\'product\', \'compare\');">So sánh sản phẩm</a> &nbsp; &nbsp; ');favorites=(logged==1?"checkProductFormAction('product', 'add_to_favorites')":"alert('Bạn phải đăng nhập mới sử dụng được tính năng n y.')");document.write('<a class="add_to_favorites" href="javascript:'+favorites+';">Tôi thích sản phẩm n y</a>');if(supplier==1&&add_to_estore==1)document.write(' &nbsp; &nbsp; <a class="add_to_estore_temp" href="javascript:checkProductFormAction(\'product\', \'add_to_estore_temp\');">Cho v o gian h ng</a>')}function generateEstoreDataOption(type,id,arrUpPrice,authen_code){if(type=="add"){document.write('<a title="Thêm sản phẩm v o gian h ng" class="colorbox_iframe text_link add" href="'+con_ajax_path+'load_add_product.php?iData='+id+'" target="_blank" rel="nofollow">Tôi muốn bán sản phẩm n y</a>')}else{document.write('<a title="Sửa thông tin sản phẩm" class="colorbox_iframe text_link edit" href="'+con_ajax_path+'load_edit_product.php?iData='+id+'" target="_blank" rel="nofollow">Sửa</a> &nbsp; '+'<a title="Sản phẩm theo mùa" class="colorbox_iframe text_link season" href="'+con_ajax_path+'load_season_product.php?iData='+id+'" target="_blank" rel="nofollow">Theo mùa</a> &nbsp; '+'<a title="Tự động đưa sản phẩm lên đầu danh mục" class="text_link auto_up" href="/profile/?module=product_auto_up&record_id='+id+'" target="_blank" rel="nofollow">Tự động up</a> &nbsp; '+'<a title="Đưa sản phẩm lên đầu danh mục" class="text_link up" href="javascript:if(confirm(\'Bạn có chắc muốn Up sản phẩm n y lên đầu danh mục, sản phẩm đặc biệt, season (v o phần Sản phẩm mới cập nhật) không?\\nMỗi lần Up chúng tôi sẽ thu phí l  '+arrUpPrice[0]+'đ / '+arrUpPrice[1]+'\')) window.location.href=\'/home/up_product.php?record_id='+id+'&redirect='+fs_redirect+'\';" rel="nofollow">Up lên đầu</a> &nbsp; '+'<a title="Xóa sản phẩm" class="text_link delete" href="javascript:if(confirm(\'Bạn có muốn xóa sản phẩm n y tại gian h ng của mình không?\')) window.location.href=\''+con_root_path+'delete_product.php?record_id='+id+'&authen_code='+authen_code+'&redirect='+fs_redirect+'\';" rel="nofollow">Xóa</a>')}}function generatePageBreak(sel){if($("."+sel+" > ul").length<=1)return;strReturn="";$("."+sel+" > ul").each(function(index){strReturn=strReturn+'<a'+(index==0?' class="current"':"")+' href="javascript:;" onClick="changePage(\''+sel+'\', '+index+')">'+(index+1)+'</a>'});$("."+sel+" > .page_break").html(strReturn)}function generateViewOption(){if(typeof(defViewName)=="undefined")defViewName="view";if(typeof(defViewValue)=="undefined")defViewValue=0;arrView=Array("list|Hiển thị chi tiết","thumbnail|Hiển thị theo cột","collapse|Hiển thị rút gọn");def=$.cookie(defViewName);if(typeof(arrView[def])=="undefined")def=defViewValue;for(i=0;i<arrView.length;i++){show=(i==def?"on":"off");temp=arrView[i].split("|");document.write('<img title="'+temp[1]+'" src="'+fs_imagepath+'icon_view_'+temp[0]+'_'+show+'.gif" onClick="$.cookie(\''+defViewName+'\', '+i+', { expires: null, path: \'/\' }); window.location.reload(false)" />')}}function resizeWindow(){minWidth=994;width=($("body").width()<minWidth?minWidth:$("body").width());if(typeof(fixBodyWidth)!="undefined")width=fixBodyWidth;$("#container_body,.header_bar").width(width);search_keyword_width=width-$(".header_search .search_help").width()-$(".header_search .search_in").width()-$(".header_search .search_area").width()-(typeof($(".header_search .search_area").css("margin-right"))!="undefined"?parseInt($(".header_search .search_area").css("margin-right")):0)-$(".header_search .register_estore").width()-170;$(".header_search .search_keyword").width(search_keyword_width);$(".header_banner_top").width(width-$(".header .fl").width()-$(".header .fr").width()-20);changeDataMatchResolution("")}function showTeaserProduct(){$(".view_list_table .teaser,.view_list_table .exclusive_teaser").each(function(index,domEle){defHeight=$(domEle).css("height");$(".view_list_table .show_teaser a:eq("+index+")").toggle(function(){$(this).attr("title","Thu nhỏ");$(this).removeClass("expand");$(domEle).css("height","auto")},function(){$(this).attr("title","Mở rộng");$(this).addClass("expand");$(domEle).css("height",defHeight)})})}function tooltipProduct(){$(".list_product pre,.view_list_table pre,.view_collapse_table pre,.compare_table pre,.suggestion_product_content pre,.upload_gallery pre,.other_estore_product_exclusive_table pre,.show_cart_table pre").each(function(index,domEle){ob=$(domEle).parent().find(".tooltip");var img=$(domEle).parent().find(".tooltip img");ob.tooltip({bodyHandler:function(){tooltipWidth=(typeof(ob.attr("tooltipWidth"))!="undefined"?ob.attr("tooltipWidth"):300);$("#tooltip").css("width",tooltipWidth+"px");$(domEle).find(".picture,.picture_only").html(function(index,html){width=(typeof($(this).attr("width"))!="undefined"?$(this).attr("width"):img.width());height=(typeof($(this).attr("height"))!="undefined"?$(this).attr("height"):img.height());maxWidth=(typeof($(this).attr("maxWidth"))!="undefined"?$(this).attr("maxWidth"):300);maxHeight=(typeof($(this).attr("maxHeight"))!="undefined"?$(this).attr("maxHeight"):200);arrFixSize=fixImageSize(width,height,maxWidth,maxHeight);return'<img width="'+arrFixSize[0]+'" height="'+arrFixSize[1]+'" src="'+$(this).attr("src")+'" />'});return $(domEle).html()},track:true,showURL:false,extraClass:"tooltip_product"})})}function tooltipReview(){$(".list_review pre").each(function(index,domEle){ob=$(domEle).parent().find(".tooltip");ob.tooltip({bodyHandler:function(){$("#tooltip").css("width","300px");$(domEle).find(".picture,.picture_only").html(function(index,html){return'<img src="'+$(this).attr("src")+'" />'});return $(domEle).html()},track:true,showURL:false,extraClass:"tooltip_product"})})}function tooltipPicture(){$(".tooltip_picture").tooltip({bodyHandler:function(){$("#tooltip").css("width","auto");strReturn='<div class="picture">'+resizeImageSrc(this.href,$(this).find("img").width(),$(this).find("img").height(),350,300)+'</div>';if($(this).attr("title")!="")strReturn=strReturn+'<div class="comment">'+$(this).attr("title")+'</div>';return strReturn},track:true,showURL:false,extraClass:"tooltip_picture"})}function initLoad(){if(!isIE6){resizeWindow();$(window).resize(function(){resizeWindow()})}headerBarDropdown();$(".tooltip_search_help").tooltip({bodyHandler:function(){$("#tooltip").css("width","500px");return tooltip_search_help},track:true,showURL:false,extraClass:""});$(".generate_star").html(function(index,html){$(this).attr("class","star_vote");return generateVote(html)});$(".logout").attr("href",'javascript:if(confirm("Bạn có muốn thoát khỏi hệ thống không?")) window.location.href = con_root_path + "act_logout.php";');$("ul.header_navigate li").hover(function(){$(this).addClass("hover");$("ul:first",this).css("visibility","visible")},function(){$(this).removeClass("hover");$("ul:first",this).css("visibility","hidden")});$("ul.header_navigate li ul li:has(ul)").find("a:first").addClass("level_1");$(".left_menu li:last-child,.left_menu_quick_search div:last-child,.left_menu_quick_search li:last-child,.left_banner td:last,.right_banner td:last").addClass("end");defaultValueHeaderSearch()}function initLoaded(){resizeImage();tooltipProduct();initColorBox();ajaxLink();fixHeightFooter();if(screen.width>1024)$(".center_banner table td div").css("width","auto")}
