function showStudio(a){document.getElementById("studio_chk1").style.display="none";document.getElementById("studio_chk").style.display=(a?"":"none");document.getElementById("studio_chk2").style.display=(a?"":"none")}function showStudio1(a){document.getElementById("studio_chk").style.display="none";document.getElementById("studio_chk1").style.display=(a?"":"none");document.getElementById("studio_chk2").style.display="none"}function check_review_login(){if(document.getElementById("username").value.trim()==""){alert("Please enter username");document.getElementById("username").focus();return false}if(document.getElementById("password").value.trim()==""){alert("Please enter password");document.getElementById("password").focus();return false}}function check_review_step1(){var b=document.getElementById("review_type").checked;var a=document.getElementById("review_type1").checked;if(b==false&&a==false){alert("Please select review type");document.getElementById("review_type").focus();return false}if(get_reviewChkCount("review_category")==0){alert("Please select atleast one category");return false}}function get_reviewChkCount(b){f1=document.review_step1;var c=0;for(i=0;i<f1.length;i++){var a=f1[i].name;if(a.indexOf(b)>=0&&f1[i].type=="checkbox"&&f1[i].checked==true){c++}}return c}function get_reviewChkCount1(b){f1=document.review_step2;var c=0;for(i=0;i<f1.length;i++){var a=f1[i].name;if(a.indexOf(b)>=0&&f1[i].type=="checkbox"&&f1[i].checked==true){c++}}return c}function check_review_step2(f){var e=document.getElementById("rating1").checked;var d=document.getElementById("rating2").checked;var c=document.getElementById("rating3").checked;var b=document.getElementById("rating4").checked;var a=document.getElementById("rating5").checked;if(document.getElementById("review_author").value.trim()==""){alert("Please enter author name");document.getElementById("review_author").focus();return false}if(document.getElementById("author_pic").value.trim()==""&&document.getElementById("author_pic1").value.trim()==""){alert("Please upload author's picture");document.getElementById("author_pic").focus();return false}if(document.getElementById("author_pic").value.trim()!=""){if(LimitAttach1(document.getElementById("author_pic").value)==false){alert("Please upload valid author's picture");document.getElementById("author_pic").focus();return false}}if(get_reviewChkText("product_name")>0){alert("Please enter product name");return false}if(get_reviewChkText("manufacturer")>0){alert("Please enter manufacturer");return false}if(get_reviewChkUrl("manufacture_website")>0){alert("Please enter valid manufacturer website. Your website must include  http://www");return false}if(document.getElementById("DownloadUrl").value.trim()!=""){if(isValidURL(document.getElementById("DownloadUrl").value)==false){alert("Please enter valid download URL. It must include http://www");document.getElementById("DownloadUrl").focus();return false}}if(document.getElementById("RetypeDownloadUrl").value.trim()!=""){if(isValidURL(document.getElementById("RetypeDownloadUrl").value)==false){alert("Please enter valid retype download URL. It must include http://www");document.getElementById("RetypeDownloadUrl").focus();return false}}if(document.getElementById("DownloadUrl").value.trim()!=""&&document.getElementById("RetypeDownloadUrl").value.trim()==""){alert("Please enter retype download URL.");document.getElementById("RetypeDownloadUrl").focus();return false}if(document.getElementById("DownloadUrl").value.trim()==""&&document.getElementById("RetypeDownloadUrl").value.trim()!=""){alert("Please enter download URL.");document.getElementById("DownloadUrl").focus();return false}if(document.getElementById("DownloadUrl").value.trim()!=""&&document.getElementById("RetypeDownloadUrl").value.trim()!=""){if(document.getElementById("DownloadUrl").value.trim()!=document.getElementById("RetypeDownloadUrl").value.trim()!=""){alert("Download URL and retype download URL should be same.");document.getElementById("DownloadUrl").focus();return false}}if(get_reviewChkText("retail_price")>0){alert("Please enter suggested retail price");return false}if(get_reviewChkPrice("retail_price")>0){alert("Please enter valid suggested retail price");return false}if(document.getElementById("description").value.trim()==""){alert("Please enter article");return false}if(get_reviewChkText("pros")>0){alert("Please enter pros");return false}if(get_reviewChkText("cons")>0){alert("Please enter cons");return false}if(e==false&&d==false&&c==false&&b==false&&a==false){alert("Please rate this product");document.getElementById("rating1").focus();return false}document.getElementById("Post").disabled="true";hidden_span=document.getElementById("hide_stuff");hidden_span.style.display="block";return true}function check_review_edit(h){var g=document.getElementById("review_type").checked;var f=document.getElementById("review_type1").checked;if(g==false&&f==false){alert("Please select review type");document.getElementById("review_type").focus();return false}if(get_reviewChkCount1("review_category")==0){alert("Please select atleast one category");return false}var e=document.getElementById("rating1").checked;var d=document.getElementById("rating2").checked;var c=document.getElementById("rating3").checked;var b=document.getElementById("rating4").checked;var a=document.getElementById("rating5").checked;if(document.getElementById("review_author").value.trim()==""){alert("Please enter author name");document.getElementById("review_author").focus();return false}if(get_reviewChkText("product_name")>0){alert("Please enter product name");return false}if(get_reviewChkText("manufacturer")>0){alert("Please enter manufacturer");return false}if(get_reviewChkUrl("manufacture_website")>0){alert("Please re-enter your web site address. It must include http://www");return false}if(document.getElementById("DownloadUrl").value.trim()!=""){if(isValidURL(document.getElementById("DownloadUrl").value)==false){alert("Please enter valid download URL. It must include http://www");document.getElementById("DownloadUrl").focus();return false}}if(document.getElementById("RetypeDownloadUrl").value.trim()!=""){if(isValidURL(document.getElementById("RetypeDownloadUrl").value)==false){alert("Please enter valid retype download URL. It must include http://www");document.getElementById("RetypeDownloadUrl").focus();return false}}if(document.getElementById("DownloadUrl").value.trim()!=""&&document.getElementById("RetypeDownloadUrl").value.trim()==""){alert("Please enter retype download URL.");document.getElementById("RetypeDownloadUrl").focus();return false}if(document.getElementById("DownloadUrl").value.trim()==""&&document.getElementById("RetypeDownloadUrl").value.trim()!=""){alert("Please enter download URL.");document.getElementById("DownloadUrl").focus();return false}if(document.getElementById("DownloadUrl").value.trim()!=""&&document.getElementById("RetypeDownloadUrl").value.trim()!=""){if(document.getElementById("DownloadUrl").value.trim()!=document.getElementById("RetypeDownloadUrl").value.trim()!=""){alert("Download URL and retype download URL should be same.");document.getElementById("DownloadUrl").focus();return false}}if(get_reviewChkText("retail_price")>0){alert("Please enter suggested retail price");return false}if(get_reviewChkPrice("retail_price")>0){alert("Please enter valid suggested retail price");return false}if(document.getElementById("description").value.trim()==""){alert("Please enter article");return false}if(get_reviewChkText("pros")>0){alert("Please enter pros");return false}if(get_reviewChkText("cons")>0){alert("Please enter cons");return false}if(e==false&&d==false&&c==false&&b==false&&a==false){alert("Please rate this product");document.getElementById("rating1").focus();return false}document.getElementById("Post").disabled="true";hidden_span=document.getElementById("hide_stuff");hidden_span.style.display="block";return true}function get_reviewChkText(b){f1=document.review_step2;var c=0;for(i=0;i<f1.length;i++){var a=f1[i].name;if(a.indexOf(b)>=0&&f1[i].type=="text"&&f1[i].value.trim()==""){c++}}return c}function get_reviewChkUrl(b){f1=document.review_step2;var c=0;for(i=0;i<f1.length;i++){var a=f1[i].name;if(a.indexOf(b)>=0&&f1[i].type=="text"&&f1[i].value.trim()!=""&&isValidURL(f1[i].value)==false){c++}}return c}function get_reviewChkPrice(b){f1=document.review_step2;var c=0;for(i=0;i<f1.length;i++){var a=f1[i].name;if(a.indexOf(b)>=0&&f1[i].type=="text"&&f1[i].value.trim()!=""&&checknumber(f1[i].value)==false){c++}}return c}function get_reviewChkFile(b){f1=document.review_step2;var c=0;for(i=0;i<f1.length;i++){var a=f1[i].name;if(a.indexOf(b)>=0&&f1[i].type=="file"&&f1[i].value.trim()==""){c++}}return c}function get_reviewValidFile(b){f1=document.review_step2;var c=0;for(i=0;i<f1.length;i++){var a=f1[i].name;if(a.indexOf(b)>=0&&f1[i].type=="file"&&f1[i].value.trim()!=""&&LimitAttach1(f1[i].value)==false){c++}}return c}function check_review_product(b){var c=b.elements.length;var a=0;for(i=0;i<c;i++){if(b.elements[i].name=="review_product[]"&&b.elements[i].value!=""){return true}}alert("Please Enter Atleast One Product Name");return false}function CountLeft(c,b,a){if(c.value.length>a){c.value=c.value.substring(0,a)}else{b.value=a-c.value.length}}function addPros(){var a=document.getElementById("div_pros");var b=(document.review_step2.num_pros.value-1)+2;document.review_step2.num_pros.value=b;if(b<=20){var c=document.createElement("div");var d="div_pros_"+b;c.setAttribute("id",d);c.innerHTML="<input type='text'  name='pros[]' size='60>><span style='padding-left:5px;color:#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:deletePros("+b+")'>Remove</a></span>";a.appendChild(c)}}function deletePros(b){var c=document.getElementById("div_pros");var d=document.review_step2.num_pros.value;var a=document.getElementById("div_pros_"+b);c.removeChild(a);document.review_step2.num_pros.value=d-1}function addCons(){var a=document.getElementById("div_cons");var b=(document.review_step2.num_cons.value-1)+2;document.review_step2.num_cons.value=b;if(b<=20){var c=document.createElement("div");var d="div_cons_"+b;c.setAttribute("id",d);c.innerHTML="<input type='text'  name='cons[]'  size='60>><span style='padding-left:5px;color:#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:deleteCons("+b+")'>Remove</a></span>";a.appendChild(c)}}function deleteCons(b){var c=document.getElementById("div_cons");var d=document.review_step2.num_cons.value;var a=document.getElementById("div_cons_"+b);c.removeChild(a);document.review_step2.num_cons.value=d-1}function addProduct(){var a=document.getElementById("div_review_product");var b=(document.review_step2.num_review_product.value-1)+2;document.review_step2.num_review_product.value=b;if(b<=20){var c=document.createElement("div");var d="div_review_product_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<input type='text' name='product_name[]' size='60' maxlength='50'><span style='padding-left:5px;color:#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:deleteProduct("+b+")'>Remove</a></span>";a.appendChild(c)}}function deleteProduct(b){var c=document.getElementById("div_review_product");var d=document.review_step2.num_review_product.value;var a=document.getElementById("div_review_product_"+b);c.removeChild(a);document.review_step2.num_review_product.value=d-1}function addManufacturer(){var a=document.getElementById("div_manufacturer");var b=(document.review_step2.num_manufacturer.value-1)+2;document.review_step2.num_manufacturer.value=b;if(b<=20){var c=document.createElement("div");var d="div_manufacturer_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<input type='text' name='manufacturer[]' maxlength='50' size='60>><span style='padding-left:5px;color:#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:deleteManufacturer("+b+")'>Remove</a></span>";a.appendChild(c)}}function deleteManufacturer(b){var c=document.getElementById("div_manufacturer");var d=document.review_step2.num_manufacturer.value;var a=document.getElementById("div_manufacturer_"+b);c.removeChild(a);document.review_step2.num_manufacturer.value=d-1}function addUrl(){var a=document.getElementById("div_url");var b=(document.review_step2.num_url.value-1)+2;document.review_step2.num_url.value=b;if(b<=20){var c=document.createElement("div");var d="div_url_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<input type='text'  name='manufacture_website[]' size='60><span style='padding-left:5px;color:#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:deleteUrl("+b+")'>Remove</a></span>";a.appendChild(c)}}function deleteUrl(b){var c=document.getElementById("div_url");var d=document.review_step2.num_url.value;var a=document.getElementById("div_url_"+b);c.removeChild(a);document.review_step2.num_url.value=d-1}function addPrice(){var a=document.getElementById("div_price");var b=(document.review_step2.num_price.value-1)+2;document.review_step2.num_price.value=b;if(b<=20){var c=document.createElement("div");var d="div_price_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<input type='text'  name='retail_price[]' size=20'><span style='padding-left:5px;color:#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:deletePrice("+b+")'>Remove</a></span>";a.appendChild(c)}}function deletePrice(b){var c=document.getElementById("div_price");var d=document.review_step2.num_price.value;var a=document.getElementById("div_price_"+b);c.removeChild(a);document.review_step2.num_price.value=d-1}function addReviewImage(){var a=document.getElementById("div_images");var b=(document.review_step2.num_images.value-1)+2;document.review_step2.num_images.value=b;if(b<=20){var c=document.createElement("div");var d="div_images_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<input type='file' id='review_img[]' name='review_img[]'> &nbsp;&nbsp;&nbsp; <strong>Image caption:</strong>&nbsp; <input type='text' id='image_caption[]' name='image_caption[]' value='' size='30' maxlength='30'><span style='padding-left:5px;color:#FF0000'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:deleteReviewImage("+b+")'>Remove</a></span>";a.appendChild(c)}}function deleteReviewImage(b){var c=document.getElementById("div_images");var d=document.review_step2.num_images.value;var a=document.getElementById("div_images_"+b);c.removeChild(a);document.review_step2.num_images.value=d-1}function check_com_Files(b){var c=b.elements.length;var a=0;for(i=0;i<c;i++){if(b.elements[i].name=="web_address[]"&&b.elements[i].value!=""){if(isValidURL(b.elements[i].value)==false){alert("Invalid Sales Web Site/URL. You Must Type http:// (Example: http://www.companyname.com)");return false}return true}}alert("Please Enter Atleast One Web Site Address");return false}function check_com_retail_price(b){var c=b.elements.length;var a=0;for(i=0;i<c;i++){if(b.elements[i].name=="retail_price[]"&&b.elements[i].value!=""){if(checknumber(b.elements[i].value)==false){alert("Please Enter Valid Suggested Retail Price");return false}return true}}alert("Please Enter Atleast One Suggested Retail Price");return false}function checknumber(a){var b=/(^\d+$)|(^\d+\.\d+$)/;if(b.test(a)){testresult=true}else{testresult=false}return(testresult)}function check_com_pros(b){var c=b.elements.length;var a=0;for(i=0;i<c;i++){if(b.elements[i].name=="review_pros[]"&&b.elements[i].value!=""){return true}}alert("Please Enter Atleast One Pros");return false}function check_com_cons(b){var c=b.elements.length;var a=0;for(i=0;i<c;i++){if(b.elements[i].name=="review_cons[]"&&b.elements[i].value!=""){return true}}alert("Please Enter Atleast One Cons");return false}function check_step3(){if(document.getElementById("captcha_code").value.trim()==""){alert("Please Enter Security Code");return false}}function show_reviewAlert(){alert("You need to login / register to save this search as an alert.")}function show_edit_reviewAlert(){alert("You Need To Login To Edit Alerts")}function del_review_alert(){if(confirm("Are you sure you want to delete review alert?")){return true}else{return false}}function back_viewReviewAlert(){window.location="index.php?option=com_review_alert&task=viewAll"}function redirect_editReview_post(b){var a="com_reviews_post|step3";window.location.href="http://www.macdirectory.com/component/option,com_reviews3/task,editReview/review_id,"+b+"/next,"+a+"/"}function check_review_search(){if(document.getElementById("review_keyword").value.trim()=="&nbsp;&nbsp;Type keyword(s)"){alert("Please enter keyword to search");return false}}function check_reviewRating(){var e=document.getElementById("rating1").checked;var d=document.getElementById("rating2").checked;var c=document.getElementById("rating3").checked;var b=document.getElementById("rating4").checked;var a=document.getElementById("rating5").checked;if(e==false&&d==false&&c==false&&b==false&&a==false){alert("Please rate this review");document.getElementById("rating1").focus();return false}}function post_reviewComment(a){document.getElementById("link_postComment").style.display="none";document.getElementById("new_reviewComment").style.display=""}function chk_postReviewComment(){if(document.getElementById("comment_txt").value.trim()==""){alert("Please enter comment");document.getElementById("comment_txt").focus();return false}}function show_reviewCommentReply(b){var c="video_comment_reply_"+b;var a="commment_reply_"+b;document.getElementById(c).style.display="";document.getElementById(a).style.display="none"}function chk_reviewCommentReply(a){var b="reply_text_"+a;if(document.getElementById(b).value.trim()==""){alert("Please enter your comment reply");document.getElementById(b).focus();return false}}function chk_suggestion(){if(document.getElementById("message").value.trim()==""){alert("Please enter message");document.getElementById("message").focus();return false}}function check_reviewReply(){if(document.getElementById("message").value.trim()==""){alert("Please enter message");document.getElementById("message").focus();return false}}function addReviewsVideos(){var a=document.getElementById("div_videos");var b=(document.review_step2.num_videos.value-1)+2;document.review_step2.num_videos.value=b;if(b<=20){var c=document.createElement("div");var d="div_videos_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<table width='100%'  border='0' cellspacing='2' cellpadding='2'><td align='left' valign='top'><strong>Video caption:</strong></td><td align='left' valign='top'><input type='text' id='video_caption[]' name='video_caption[]' value='' size='23' maxlength='30'><br>(max of 30 characters)</td><td align='left' valign='top'><input type='file' id='review_video[]' name='review_video[]' ><br><a href='javascript:deleteReviewsVideos("+b+")' class='blue_link'>Remove</a></td></tr></table>";a.appendChild(c)}}function deleteReviewsVideos(b){var c=document.getElementById("div_videos");var d=document.review_step2.num_videos.value;var a=document.getElementById("div_videos_"+b);c.removeChild(a);document.review_step2.num_videos.value=d-1}function ListCategoryReviews(){var a=document.getElementById("category").value;if(a=="all"){window.location.href="http://www.macdirectory.com/component/option,com_reviews/task,viewAll/"}else{if(a=="Books"||a=="Games"||a=="Hardware"||a=="iPhone"||a=="iPod"||a=="Laptop"||a=="Software"){window.location.href="http://www.macdirectory.com/component/option,com_reviews1/task,viewCategory/catName,"+a+"/"}else{window.location.href="http://www.macdirectory.com/component/option,com_reviews1/task,searchCategory/catName,"+a+"/"}}}function CheckNewsletterForm(){if(document.getElementById("NewsletterEmail").value.trim()==""){alert("Please enter email");document.getElementById("NewsletterEmail").focus();return false}if(document.getElementById("NewsletterEmail").value.trim()=="Enter Email"){alert("Please enter email");document.getElementById("NewsletterEmail").focus();return false}if(document.getElementById("NewsletterEmail").value.trim()!=""){if(emailCheck(document.getElementById("NewsletterEmail").value)==false){alert("Please enter valid email");document.getElementById("NewsletterEmail").focus();return false}}}function VerifyNewsletterEmail(){if(document.getElementById("VerifyEmail").value.trim()==""){alert("Please enter email");document.getElementById("VerifyEmail").focus();return false}if(document.getElementById("VerifyEmail").value.trim()!=""){if(emailCheck(document.getElementById("VerifyEmail").value)==false){alert("Please enter valid email");document.getElementById("VerifyEmail").focus();return false}}if(document.getElementById("VerifyEmail").value!=document.getElementById("CheckEmail").value){alert("Your previous and current email address are not matching. Please enter correct email address.");document.getElementById("VerifyEmail").focus();return false}};
