﻿$(function(){$.prompt.setDefaults({top:"35%"});if(screen_type.Message){bestupper("#msg_captcha");maxlength("#msg_message");autogrow("#msg_message")}screen_type.Product&&bestupper("#qck_captcha");inline_label();if($("#qck_send").length||$("#ip_send").length||$("#qck_send_paid").length)$("#qck_send, #qck_send_paid, #ip_send").click(function(){var b=this,a={},c;if($("#qck_send").length)c="qck";else if($("#qck_send_paid").length)c="paid_qck";else if($("#ip_send").length)c="ip";$("input[type=text]").each(function(){a[realId(this.id,
c)]=$(this).realvalue().secure()});a.companyuid=companyuid;a.productuid=$("#ip_send").length?"":productuid;a.channel=getchannel();var d={structure:a,channel:getchannel()};AjaxRequest(b,"Message_Quick_Send",d,true,false)});if($("#btnSendMessage").length||$("#btnSendMessagePaid").length)$("#btnSendMessage, #btnSendMessagePaid").click(function(){var b=this,a={},c=$("#btnSendMessage").length?"msg":"msg_paid";$("input[type=text],textarea").each(function(){a[realId(this.id,c)]=$(this).realvalue().secure()});
a.sender=loginuid;a.receiver=companyuid;a.channel=getchannel();AjaxRequest(b,"Message_Send",{structure:a,channel:a.channel},true,false)});if($("#btnFriend").length||$("#btnFriendP").length)$("#btnFriend, #btnFriendP").click(function(){function b(a,c,d){if(a){a1=$(c).find("#your_name");a2=$(c).find("#friends_name");a3=$(c).find("#email_friends");a1.removeClass("jqimustfield");a2.removeClass("jqimustfield");a3.removeClass("jqimustfield");if(isnull(d.your_name)){a1.addClass("jqimustfield");a1.focus();
return false}if(isnull(d.friends_name)){a2.addClass("jqimustfield");a2.focus();return false}if(isnull(d.email_friends)){a3.addClass("jqimustfield");a3.focus();return false}a='{productuid : "{productuid}",your_name :"{your_name}", friends_name:"{friends_name}",                                       friends_email:"{friends_email}",your_message:"{your_message}", link:"{link}", channel:"{channel}"}'.replace("{productuid}",productuid).replace("{your_name}",$("#your_name").val().secure()).replace("{friends_name}",
$("#friends_name").val().secure()).replace("{friends_email}",$("#email_friends").val().secure()).replace("{your_message}",$("#your_message").val().secure()).replace("{link}",window.location).replace("{channel}",getchannel());AjaxRequest(this,"Product_Friend",a);return false}}$.prompt('Send this product to your friends<br />                        <div class="vspc20"></div>                        <div>                            <div class="lft w30">Your Name</div>                            <div class="rght w60"><input type="text" id="your_name" name="your_name" tabindex="50" /></div>                            <div class="clear vspc10"></div>                            <div class="lft w30">Friend\'s Name</div>                            <div class="rght w60"><input type="text" id="friends_name" name="friends_name" tabindex="51" /></div>                            <div class="clear vspc10"></div>                            <div class="lft w30">Friend\'s E-mail</div>                            <div class="rght w60"><input type="text" id="email_friends" name="email_friends" tabindex="52" /></div>                            <div class="clear vspc10"></div>                            <div class="lft w30">Your Message</div>                            <div class="rght w60"><textarea tabindex="53" rows="5" cols="20" name="your_message" id="your_message"></textarea></div>                            <div class="clear vspc10"></div>                            <div class="font-size:0.7em">Page link will be added automatically.</div>                            <div class="clear vspc10"></div>                        </div>',
{submit:b,buttons:{Send:true,Cancel:false},top:"20%"});$("#your_name").focusEnd();this.id.equals("btnFriendP")&&$("#your_message").css("width","325px")});if($("#btnShare").length||$("#btnShareP").length)$("#btnShare, #btnShareP").click(function(){var b='{name:"{name}",uid:"{uid}",url:"{url}",channel:"{channel}"}'.replace("{name}",product_name).replace("{uid}",productuid).replace("{url}",Request_Url).replace("{channel}",getchannel());AjaxRequest(this,"Product_Share",b,void 0,false)});if(cond_1){$("#msg_paid_message").length&&
$("#msg_paid_message").focus();$("#msg_message").length&&$("#msg_message").focus()}if(PaidVersion){if(screen_type.Home||screen_type.Product||screen_type.BuyingLead||screen_type.Contact)$("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:"normal",padding:40,opacity:0.5,showTitle:true,allowresize:true,counter_separator_label:"/",theme:"light_rounded",callback:function(){}});if(screen_type.Home){$.fn.reverseOrder=function(){return this.each(function(){$(this).prependTo($(this).parent())})};$.fn.simpleSpy=
function(b,a){b=b||4;a=a||4E3;return this.each(function(){function c(){var i=$(f[e]).css({height:0,opacity:0,display:"none"}).prependTo(d);d.find("> li:last").animate({opacity:0},1E3,function(){i.animate({height:height},1E3).animate({opacity:1},1E3);$(this).remove()});e++;if(e>=g)e=0;setTimeout(c,a)}var d=$(this),f=[],e=b,g=0,h=0;height=d.find("> li:first").height();d.find("> li").each(function(){f.push("<li>"+$(this).html()+"</li>")});g=f.length;d.wrap('<div class="spyWrapper">').parent().css({height:height*
b});d.find("> li").filter(":gt("+(b-1)+")").remove();if(h<1){setTimeout(c,4E3);h++}else c()})};$("ul.spy").simpleSpy("2","4000");$("#intpartner").click(function(){var b=$("#intpartner").html();$("#intpartner").html(b.indexOf("\u25bc")>0?b.replace("\u25bc","\u25b2"):b.replace("\u25b2","\u25bc"));$("#intpartnerbox").toggle(600)});bestupper("#ip_captcha")}screen_type.Product&&bestupper("#paid_qck_captcha");$("#search_query").autocomplete("autocomplete.aspx",{minChars:2,width:250,formatItem:formatItem,
onItemSelect:selectItem,onFindValue:findValue,scroll:true,scrollHeight:600,extraParams:{type:"s",uid:company_uid,encyrpted:1}});$("#search_query").result(function(b,a){selecteditem=a[1]});$("#btnSearch").click(function(){dosearch()})}if(screen_type.ZoomItem)if(PaidVersion)PaidVersion&&$(function(){$(".jqzoom").jqzoom({zoomWidth:375,zoomHeight:280,xOffset:20,yOffset:0,lens:true,title:true,preloadText:"Loading zoom",showEffect:"show",hideEffect:"fadeout",fadeoutSpeed:"slow",position:"right"})});else $(function(){$("img.jqzoom").jqueryzoom({xzoom:275,
yzoom:275,offset:10})});if(!PaidVersion&&screen_type.Home){$(function(){$("#btnFreeSearch").click(function(){var b='{companyuid:"{companyuid}", text:"{text}", channel:"{channel}" }'.replace("{companyuid}",companyuid).replace("{text}",$("#txtFreeSearch").val().secure()).replace("{channel}",getchannel());AjaxRequest(this,company_seller.equals("1")?"Product_Search_GetByCompany":"BuyingLead_Search_GetByCompany",b)});$("#txtFreeSearch").length&&$("#txtFreeSearch").focus();$("#txtFreeSearch").bind("keypress",
function(b){if(b.keyCode==13){$("#btnFreeSearch").click();return false}})});ProductCount>7&&$(".jCarouselLite").jCarouselLite({btnNext:".next",btnPrev:".prev",speed:500,mouseWheel:true,scroll:1,visible:7,circular:true,auto:1E3})}});
function AjaxSuccess(b,a,c){if(b.equals("Message_Quick_Send"))if(a.response==0){if(c.id.equals("qck_send_paid"))$("input[id^='paid_qck_']").val("");else if(c.id.equals("qck_send"))$("input[id^='qck_']").val("").removeClass("newform_errfield");else c.id.equals("ip_send")&&$("input[type=text][id^='ip_']").val("");showinfo(a.response_text)}else showerrorlist(a.records);else if(b.equals("Message_Send"))if(a.response==0){c.id.equals("btnSendMessagePaid")?$("input[type=text],textarea").val(""):$("#send_message_content").addClass("nodisplay");
showinfo(a.response_text)}else showerrorlist(a.records);else if(b.match("Product_Search_GetByCompany|BuyingLead_Search_GetByCompany")){b=[];c=a.records;a=a.item_count;$("#divFreeResult").html("");if(a>0){for(var d=0;d<a;d++)b[d]='<div class="newform_results record"> \t                        <p><a href="{link}" class="imagelink"><img src="{picture}" /></a></p> \t                        <p><a href="{link}">{name}</a></p> \t                    </div>'.replaceall("{link}",c[d].link).replace("{picture}",
c[d].picture).replace("{name}",c[d].name);$("#divFreeResult").html(b.join(""))}else showerror(No_Record)}else if(b.equals("Product_Friend"))if(a.response!=0)showerrorlist(a.records);else{showinfo(a.response_text);$("#jqi_state0_buttonCancel").click()}else b.equals("Product_Share")&&a.response==0&&$.prompt(a.reserved1,{top:"20%",width:"110%"})}var selecteditem="";function findValue(){}function formatItem(b){return"<div><div style='float:left'>"+b[0]+"</div></div>"}
function selectItem(b){findValue(b)}function dosearch(){window.location.href="t_company.aspx?u="+client_e(companyuid)+"&t="+Page_Search+"&stx={0}&sid={1}&enc=1".replace("{0}",$("#search_query").val()).replace("{1}",selecteditem)};