function checkEmail(a){if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(a)){return(true);}alert("Invalid E-mail Address! Please re-enter.");return(false);}function isEmpty(a){var b=/^\s{1,}$/g;if((a.length==0)||(a==null)||((a.search(b))>-1)){return true;}else{return false;}}function validateSignUp(){var a=[["username",'Please enter a value for the "Username" field'],["email",'Please enter a value for the "email" field'],["password",'Please enter a value for the "Password" field'],["confirmpassword","Please confirm your password"],["verification","Please enter verfication code"]];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}var d=document.getElementById("username");var c=/^[0-9a-zA-Z]+$/;if(!d.value.match(c)){alert("Please use only Alphabetic or Numeric characters in username");return false;}if(!checkEmail(document.getElementById("email").value)){return false;}if(document.getElementById("password").value!=document.getElementById("confirmpassword").value){alert("Password does not match");document.getElementById("password").focus();return false;}return true;}function validateProfile(){var a=[["firstName",'Please enter a value for the "First Name" field'],["lastName",'Please enter a value for the "Last Name" field']];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}return true;}function validateUpload(){var a=[["upload","Please select a file to upload"],["name","Please enter the name of the torrent"],["description","Please enter the description of the file"]];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}var c=/^(.+)\.torrent$/;if(!c.test(document.getElementById("upload").value.toLowerCase())){alert("Invalid filename (not a .torrent)!");return false;}return true;}function validateChangeEmail(){if(isEmpty(document.getElementById("password").value)){alert("Please enter password!");document.getElementById("password").focus();return false;}return true;}function validateLogin(){if(isEmpty(document.getElementById("email").value)){alert("Please enter Username/Email!");document.getElementById("email").focus();return false;}if(isEmpty(document.getElementById("password").value)){alert("Please enter password!");document.getElementById("password").focus();return false;}return true;}function validateChangePwd(){var a=[["oldPassword","Please enter your current password"],["newPassword","Please enter your new password"],["confirmNewPassword","Please confirm your new password"]];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}if(document.getElementById("newPassword").value!=document.getElementById("confirmNewPassword").value){alert("Password does not match");document.getElementById("newPassword").focus();return false;}return true;}function validateChangeUsername(){var a=[["username","Please enter your new username"],["confirmUsername","Please confirm your new username"]];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}if(document.getElementById("username").value!=document.getElementById("confirmUsername").value){alert("Username does not match");document.getElementById("username").focus();return false;}return true;}function validateRole(){if(isEmpty(document.getElementById("name").value)){alert("Please enter role name");document.getElementById("name").focus();return false;}return true;}function validateUser(){var a=[["username",'Please enter a value for the "Username" field'],["password",'Please enter a value for the "Password" field'],["confirmpassword","Please confirm your password"],["email","Please enter email"]];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}var d=document.getElementById("username");var c=/^[0-9a-zA-Z]+$/;if(!d.value.match(c)){alert("Please use only Alphabetic or Numeric characters in username");return false;}if(!checkEmail(document.getElementById("email").value)){return false;}if(document.getElementById("password").value!=document.getElementById("confirmpassword").value){alert("Password does not match");document.getElementById("password").focus();return false;}return true;}function validateUserEdit(){var a=[["username",'Please enter a value for the "Username" field'],["email","Please enter email"]];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}if(!checkEmail(document.getElementById("email").value)){return false;}return true;}function voteAuction(a,b){if(b=="up"){$("#vote-up-stat").html('<img src="images/ajax-loader-small.gif"/>');$.post("voteAuction.action",{id:a,vote:b},function(c){$("#vote-up-stat").html($("votes",c).text());if($("status",c).text()!="0"){alert($("message",c).text());}});}else{$("#vote-down-stat").html('<img src="images/ajax-loader-small.gif"/>');$.post("voteAuction.action",{id:a,vote:b},function(c){$("#vote-down-stat").html($("votes",c).text());if($("status",c).text()!="0"){alert($("message",c).text());}});}}function voteProduct(a,b){if(b=="up"){$("#vote-up-stat").html('<img src="images/ajax-loader-small.gif"/>');$.post("voteProduct.action",{id:a,vote:b},function(c){$("#vote-up-stat").html($("votes",c).text());if($("status",c).text()!="0"){alert($("message",c).text());}});}else{$("#vote-down-stat").html('<img src="images/ajax-loader-small.gif"/>');$.post("voteProduct.action",{id:a,vote:b},function(c){$("#vote-down-stat").html($("votes",c).text());if($("status",c).text()!="0"){alert($("message",c).text());}});}}function rateProduct(b,a){$("#ratingInfo").html('<img src="images/ajax-loader-small.gif"/>');$.post("rateProduct.action",{id:b,rating:a},function(c){starRating=parseInt($("rating",c).text());allStarRating=parseInt($("all-rating",c).text());voteNumbers=$("number",c).text();starVoted=true;showRating();});}function cancelRating(a){$("#ratingInfo").html('<img src="images/ajax-loader-small.gif"/>');$.post("cancelRating.action",{id:a},function(b){starRating=parseInt($("rating",b).text());allStarRating=starRating;voteNumbers=$("number",b).text();starVoted=false;showRating();});}function voteManual(a,b){if(b=="up"){$("#vote-up-stat").html('<img src="images/ajax-loader-small.gif"/>');$.post("voteManual.action",{id:a,vote:b},function(c){$("#vote-up-stat").html($("votes",c).text());if($("status",c).text()!="0"){alert($("message",c).text());}});}else{$("#vote-down-stat").html('<img src="images/ajax-loader-small.gif"/>');$.post("voteManual.action",{id:a,vote:b},function(c){$("#vote-down-stat").html($("votes",c).text());if($("status",c).text()!="0"){alert($("message",c).text());}});}}function voteComment(a,b){$("#comment-votes-"+a).html('<img src="images/ajax-loader-small.gif"/>');$.post("voteComment.action",{commentId:a,vote:b},function(c){$("#comment-votes-"+a).html($("votes",c).text());if(parseInt($("votes",c).text())<-2){if(!$("#comment-body-"+a).hasClass("hide")){$("#comment-body-"+a).addClass("hide");}$("#comment-show-"+a).html("<a href=\"javascript:showComment('"+a+"')\">Show</a>");$("#comment-show-"+a).show();}if($("status",c).text()!="0"){alert($("message",c).text());}});}function validateComment(){var a=[["username",'Please enter a value for the "Username" field'],["recaptcha_response_field","Please enter the words in the picture"],["content","Please enter your comment"]];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}return true;}function markManual(a){if(confirm("Are you sure to mark this manual for removal?")){$.post("markManual.action",{id:a},function(b){alert($("message",b).text());});}}function markComment(a){$.post("getMarkForRemovalTimes.action",{commentId:a},function(b){if(b.markForRemovalTimes>=1){if(confirm("Are you sure you want to delete this comment?")){$.post("deleteComment.action",{commentId:a},function(c){alert($("message",c).text());if($("status",c).text()=="1"){$("#comment-"+a).remove();}});}}else{if(confirm("Are you sure to mark this comment for removal?")){$.post("markComment.action",{commentId:a},function(c){alert($("message",c).text());if($("status",c).text()=="4"){$("#mark_comment_container_"+a).html("<a href=\"javascript: markComment('"+a+'\')" title="Remove comment">Remove</a>');}});}}},"json");}function votePost(a,b){if(b=="up"){$("#vote-up-stat").html('<img src="images/ajax-loader-small.gif"/>');$.post("votePost.action",{blogPostId:a,vote:b},function(c){$("#vote-up-stat").html($("votes",c).text());if($("status",c).text()!="0"){alert($("message",c).text());}});}else{$("#vote-down-stat").html('<img src="images/ajax-loader-small.gif"/>');$.post("votePost.action",{blogPostId:a,vote:b},function(c){$("#vote-down-stat").html($("votes",c).text());if($("status",c).text()!="0"){alert($("message",c).text());}});}}function reportSpam(a){$.post("getMarkForRemovalTimes.action",{commentId:a},function(b){if(b.markForRemovalTimes>=1){if(confirm("Are you sure to report this comment as spam and delete it?")){$.post("reportSpam.action",{commentId:a,deleteComment:1},function(c){alert($("message",c).text());$("#report_spam_container_"+a).html('<span class="redtext">Spam Found</span>');if($("status",c).text()=="2"){$("#comment-"+a).remove();}});}}else{if(confirm("Are you sure to report this comment as spam?")){$.post("reportSpam.action",{commentId:a},function(c){alert($("message",c).text());if($("status",c).text()!="1"){$("#report_spam_container_"+a).html('<span class="redtext">Spam Found</span>');}});}}},"json");}function removeManual(a){if(confirm("Are you sure to remove this manual?")){$.post("removeManual.action",{id:a},function(b){alert($("message",b).text());});}}function validateModerator(){var a=[["reason","Please enter your reason"]];for(var b=0;b<a.length;b++){if(isEmpty(document.getElementById(a[b][0]).value)){alert(a[b][1]);document.getElementById(a[b][0]).focus();return false;}}return true;}function validateCategory(){if(isEmpty(document.getElementById("name").value)){alert("Please enter category name");document.getElementById("name").focus();return false;}return true;}function validateEbayCategory(){if(isEmpty(document.getElementById("ebayCatId").value)){alert("Please enter ebay category id");document.getElementById("ebayCatId").focus();return false;}if(isEmpty(document.getElementById("name").value)){alert("Please enter category name");document.getElementById("name").focus();return false;}return true;}function validateCategoryType(){if(isEmpty(document.getElementById("name").value)){alert("Please enter category type name");document.getElementById("name").focus();return false;}if(isEmpty(document.getElementById("action").value)){alert("Please enter action url");document.getElementById("action").focus();return false;}return true;}function DrawImage(f,b,c){var e=new Image();e.src=f.src;var d=e.width;var a=e.height;if(e.width>0&&e.height>0){if(e.width/e.height>=b/c){if(e.width>b){d=b;a=Math.ceil((e.height*b)/e.width);}else{d=e.width;a=e.height;}}else{if(e.height>c){a=c;d=Math.ceil((e.width*c)/e.height);}else{d=e.width;a=e.height;}}}if(a==0){a=c;}if(d==0){d=b;}f.style.height=a+"px";f.style.width=d+"px";f.style.visibility="visible";}function showControl(a){document.getElementById("quickViewBtn_"+a).style.display="";}function hideControl(a){document.getElementById("quickViewBtn_"+a).style.display="none";}jQuery.fn.center=function(){this.css("position","absolute");this.css("top",($(window).height()-this.height())/2+$(window).scrollTop()+"px");this.css("left",($(window).width()-this.width())/2+$(window).scrollLeft()+"px");return this;};function showPicture(a,c,d){$("#quickViewImg").fadeOut("slow");$("#quickViewImg").css("visibility","hidden");$("#quickViewImg").attr("src",d);for(var b=0;b<c;b++){if(b==a){if(!$("#idx_"+b).hasClass("quickview_active")){$("#idx_"+b).addClass("quickview_active");}}else{if($("#idx_"+b).hasClass("quickview_active")){$("#idx_"+b).removeClass("quickview_active");}}}}function numeralsOnly(e,c,b){c=(c)?c:event;var a=(c.charCode)?c.charCode:((c.keyCode)?c.keyCode:((c.which)?c.which:0));if(a>31&&(a<48||a>57)&&a!=46){return false;}if(a==46){if(b==0){return false;}else{if(e.indexOf(".")!=-1){return false;}}}else{if(e.indexOf(".")!=-1){var d=e.substring(e.indexOf("."));if(d.length>b){return false;}}}return true;}function checkPriceRange(){var a=$("#minPrice").val();var b=$("#maxPrice").val();if(a!=""&&b!=""){if(parseInt(b)<parseInt(a)){alert("Max price must be greater than min price");return false;}}return true;}$(document).ready(function(){if($.browser.msie&&$.browser.version==6){FollowDiv.follow();}if($(".topbyscroll")&&$(".topbyscroll")!=undefined){$(".topbyscroll").bind("click",function(){$(window).scrollTop(0);});}$("a.nlr").click(function(b){var a=$(this).attr("href");b.preventDefault();$.get("updateProductIndex.action",{productIndex:$(this).attr("rel")},function(c){window.location.href=a;});});$("#keyword").keyup(function(a){if(a.keyCode==13){siteSearch(document.getElementById("searchform"));}});});FollowDiv={follow:function(){$(".topbyscroll").css("position","absolute");$(window).scroll(function(){var a=$(window).scrollTop()+$(window).height()-$(".topbyscroll").outerWidth();$(".topbyscroll").css("top",a);});}};$(window).scroll(function(){var a=$(window).scrollTop();if($("#currentPageRecordsHidden")&&$("#currentPageRecordsHidden")!=undefined&&$("#currentPageRecordsHidden").attr("value")!=undefined&&$("#currentPageRecordsHidden").attr("value")>=30){if(a>50){$(".topbyscroll").css({display:"block",cursor:""});}else{$(".topbyscroll").css({display:"none",cursor:""});}}});function getScrollTop(){if(document.documentElement.scrollTop){return document.documentElement.scrollTop;}return document.body.scrollTop;}function scrollHandler(){var a=document.getElementById("rc_notify");a.style.top=getScrollTop();}function showNotify(b){var a=document.getElementById("rc_notify");a.innerHTML=b;a.style.display="block";a.style.visibility="visible";if(a.currentStyle&&a.currentStyle.position=="absolute"){a.style.top=getScrollTop();}}function hideNotify(){var a=document.getElementById("rc_notify");a.style.display="none";a.style.visibility="hidden";}function siteSearch(a){if(a.searchOption.value=="All"){window.location.href="/blend-search/kw-"+a.keyword.value;}else{if(a.searchOption.value=="News"){window.location.href="/article-search/kw-"+a.keyword.value;}else{if(a.searchOption.value=="Product"){window.location.href="/product-search/kw-"+a.keyword.value;}}}}
