function check_software_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_software_step1(){if(document.getElementById("LicenseType1").checked==false&&document.getElementById("LicenseType2").checked==false&&document.getElementById("LicenseType3").checked==false){alert("Please select license type");document.getElementById("LicenseType1").focus();return false}if(get_softwareChkCount("ProductCompatibility")==0){alert("Please select atleast one product compatibility");return false}if(get_softwareChkCount("software_category")==0){alert("Please select atleast one category");return false}if(get_softwareChkCount("software_category")>2){alert("Please select maximum of 2 categorires");return false}}function get_softwareChkCount(b){f1=document.software_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 ShowOtherProductCompatibility(){if(document.getElementById("other").checked==true){document.getElementById("OtherProductCompatibility").style.display=""}else{document.getElementById("OtherProductCompatibility").style.display="none"}}function check_software_step2(a){if(document.getElementById("ProductName").value.trim()==""){alert("Please enter product name");document.getElementById("ProductName").focus();return false}if(document.getElementById("Version").value.trim()==""){alert("Please enter product version");document.getElementById("Version").focus();return false}if(document.getElementById("ProductDescription").value.trim()==""){alert("Please enter brief product description");document.getElementById("ProductDescription").focus();return false}if(document.getElementById("CompanyName").value.trim()==""){alert("Please enter company name");document.getElementById("CompanyName").focus();return false}if(document.getElementById("CompanyUrl").value.trim()==""){alert("Please enter company website or product URL");document.getElementById("CompanyUrl").focus();return false}if(document.getElementById("CompanyUrl").value.trim()!=""){if(isValidURL(document.getElementById("CompanyUrl").value)==false){alert("Please enter valid company website or product URL");document.getElementById("CompanyUrl").focus();return false}}if(document.getElementById("DownloadUrl").value.trim()==""){alert("Please enter download URL");document.getElementById("DownloadUrl").focus();return false}if(document.getElementById("DownloadUrl").value.trim()!=""){if(isValidURL(document.getElementById("DownloadUrl").value)==false){alert("Please enter valid download URL");document.getElementById("DownloadUrl").focus();return false}}if(document.getElementById("RetypeDownloadUrl").value.trim()==""){alert("Please retype download URL");document.getElementById("RetypeDownloadUrl").focus();return false}if(document.getElementById("RetypeDownloadUrl").value.trim()!=""){if(isValidURL(document.getElementById("RetypeDownloadUrl").value)==false){alert("Please retype valid download URL");document.getElementById("RetypeDownloadUrl").focus();return false}}if(document.getElementById("DownloadUrl").value!=document.getElementById("RetypeDownloadUrl").value){alert("Download URL and retype download URL should be same");document.getElementById("RetypeDownloadUrl").focus();return false}if(document.getElementById("DownLoadSize").value.trim()==""){alert("Please enter download file size");document.getElementById("DownLoadSize").focus();return false}if(document.getElementById("DownLoadSize").value.trim()!=""){if(checknumber(document.getElementById("DownLoadSize").value)==false){alert("Please enter valid download file size");document.getElementById("DownLoadSize").focus();return false}}if(document.getElementById("LicenseType").value.trim()=="Freeware"&&document.getElementById("Price").value.trim()!=""){if(document.getElementById("Price").value.trim()!="0"){alert("You selected Freeware for this product upload. This means your product should be free. If your software is not free, return to the previous page and select the appropriate software license type.");document.getElementById("Price").focus();return false}}if(document.getElementById("Price").value.trim()!=""){if(checknumber(document.getElementById("Price").value)==false){alert("Please enter valid price");document.getElementById("Price").focus();return false}}if(CheckOsRequirements()>0){alert("Please enter OS requirements");document.getElementById("OsRequirements_0").focus();return false}if(document.getElementById("Description").value.trim()==""){alert("Please enter description");document.getElementById("Description").focus();return false}if(get_softwareValidFile("software_img")>0){alert("Please upload valid software image(s)");return false}if(document.getElementById("HelpingHand").checked==true){if(document.getElementById("HelpingWebAddress").value.trim()==""){alert("Please enter website address");document.getElementById("HelpingWebAddress").focus();return false}if(document.getElementById("HelpingWebAddress").value.trim()!=""){if(isValidURL(document.getElementById("HelpingWebAddress").value)==false){alert("Please enter valid website address");document.getElementById("HelpingWebAddress").focus();return false}}}document.getElementById("Post").disabled="true";hidden_span=document.getElementById("hide_stuff");hidden_span.style.display="block";return true}function get_softwareValidFile(b){f1=document.software_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 CheckOsRequirements(){var a=document.getElementById("num_OsRequirements").value;var b=0;for(j=0;j<a;j++){txt="OsRequirements_"+j;b=b+ValidateOsRequirements(txt)}if(b<a){b=0}return b}function ValidateOsRequirements(b){f1=document.software_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 CheckNewVersionFeature(){var b=document.getElementById("num_NewVersionFeature").value;var a=0;for(j=0;j<b;j++){txt="NewVersionFeature_"+j;a=a+ValidateNewVersionFeature(txt)}if(a<b){a=0}return a}function ValidateNewVersionFeature(b){f1=document.software_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 addSoftwareImage(){var a=document.getElementById("div_images");var b=document.software_step2.num_images.value;document.software_step2.num_images.value=b;if(b<=10){var c=document.createElement("div");var d="div_images_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<table width='100%' border='0' cellspacing='2' cellpadding='2'><tr><td align='right' valign='top' width='15%'>Image title:&nbsp;</td><td align='left' valign='top'><input name='ImageTitle_"+b+"' id='ImageTitle_"+b+"' type='text' size='60' value='' onKeyDown='CountLeft(this.form.ImageTitle_"+b+",this.form.ImageTitle_"+b+"Cnt,50);'  onKeyUp='CountLeft(this.form.ImageTitle_1,this.form.ImageTitle_"+b+"Cnt,50);'></td></tr><tr><td align='right' valign='top'>&nbsp;</td><td align='left' valign='top'>Characters Remaining: <input name='ImageTitle_"+b+"Cnt' type='text' class='search_box2' size='4' maxlength='4' value='50' readonly=''></td></tr><tr><td align='right' valign='top' width='15%'>Image description:&nbsp;										</td><td align='left' valign='top'><input name='ImageDescription_"+b+"' id='ImageDescription_"+b+"' type='text' size='60' value='' onKeyDown='CountLeft(this.form.ImageDescription_"+b+",this.form.ImageDescription_"+b+"Cnt,300);'  onKeyUp='CountLeft(this.form.ImageDescription_"+b+",this.form.ImageDescription_"+b+"Cnt,300);'></td></tr><tr><td align='right' valign='top'>&nbsp;</td><td align='left' valign='top'>Characters Remaining: <input name='ImageDescription_"+b+"Cnt' type='text' class='search_box2' size='4' maxlength='4' value='300' readonly=''></td></tr><tr><td align='right' valign='top'>&nbsp;</td><td align='left' valign='top'><input type='file' id='software_img[]' name='software_img[]'>&nbsp;&nbsp; <a href='javascript:deleteSoftwareImage("+b+")' class='blue_link'>Remove</a></td></tr></table>";a.appendChild(c)}}function deleteSoftwareImage(b){var c=document.getElementById("div_images");var d=document.software_step2.num_images.value;var a=document.getElementById("div_images_"+b);c.removeChild(a);document.software_step2.num_images.value=d-1}function addOsRequirements(){var a=document.getElementById("div_OsRequirements");var b=(document.software_step2.num_OsRequirements.value-1)+2;document.software_step2.num_OsRequirements.value=b;if(b<=5){var c=document.createElement("div");var d="div_OsRequirements_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<table width='100%'  border='0' cellspacing='2' cellpadding='2'><tr><td align='left' valign='top' class='font12'><input name='OsRequirements_"+b+"' id='OsRequirements_"+b+"' type='text' size='60'  onKeyDown='CountLeft(this.form.OsRequirements_"+b+",this.form.OsRequirements_"+b+"Cnt,100);'  onKeyUp='CountLeft(this.form.OsRequirements_"+b+",this.form.OsRequirements_"+b+"Cnt,100);'>&nbsp;&nbsp; <a href='javascript:deleteOsRequirements("+b+")' class='blue_link'>Remove</a></td></tr><tr><td align='left' valign='top' class='font12'>Characters Remaining: <input name='OsRequirements_"+b+"Cnt' type='text' class='search_box2' size='4' maxlength='4' value='100' readonly=''></td></tr></table>";a.appendChild(c)}}function deleteOsRequirements(b){var c=document.getElementById("div_OsRequirements");var d=document.software_step2.num_OsRequirements.value;var a=document.getElementById("div_OsRequirements_"+b);c.removeChild(a);document.software_step2.num_OsRequirements.value=d-1}function addNewVersionFeature(){var a=document.getElementById("div_NewVersionFeature");var b=(document.software_step2.num_NewVersionFeature.value-1)+2;document.software_step2.num_NewVersionFeature.value=b;if(b<=5){var c=document.createElement("div");var d="div_NewVersionFeature_"+b;c.setAttribute("id",d);c.setAttribute("style","padding-top:10px;");c.innerHTML="<table width='100%'  border='0' cellspacing='2' cellpadding='2'><tr><td align='left' valign='top' class='font12'><input name='NewVersionFeature_"+b+"' id='NewVersionFeature_"+b+"' type='text' size='60'  onKeyDown='CountLeft(this.form.NewVersionFeature_"+b+",this.form.NewVersionFeature_"+b+"Cnt,60);'  onKeyUp='CountLeft(this.form.NewVersionFeature_"+b+",this.form.NewVersionFeature_"+b+"Cnt,60);'>&nbsp;&nbsp; <a href='javascript:deleteNewVersionFeature("+b+")' class='blue_link'>Remove</a></td></tr><tr><td align='left' valign='top' class='font12'>Characters Remaining: <input name='NewVersionFeature_"+b+"Cnt' type='text' class='search_box2' size='4' maxlength='4' value='60' readonly=''></td></tr></table>";a.appendChild(c)}}function deleteNewVersionFeature(b){var c=document.getElementById("div_NewVersionFeature");var d=document.software_step2.num_NewVersionFeature.value;var a=document.getElementById("div_NewVersionFeature_"+b);c.removeChild(a);document.software_step2.num_NewVersionFeature.value=d-1}function redirect_editSoftware_post(b){var a="com_software_post|step3";window.location.href="http://www.macdirectory.com/component/option,com_software3/task,editSoftware/software_id,"+b+"/next,"+a+"/"}function checknumber(a){var b=/(^\d+$)|(^\d+\.\d+$)/;if(b.test(a)){testresult=true}else{testresult=false}return(testresult)}function ListCategorySoftwares(){var a=document.getElementById("category").value;if(a=="all"){window.location.href="http://www.macdirectory.com/component/option,com_software/task,viewAll/"}else{window.location.href="http://www.macdirectory.com/component/option,com_software1/task,SearchCategory/Category,"+a+"/"}}function check_SoftwareReply(){if(document.getElementById("sen_name").value.trim()==""){alert("Please enter your name");document.getElementById("sen_name").focus();return false}if(document.getElementById("sen_email").value.trim()==""){alert("Please enter your email");document.getElementById("sen_email").focus();return false}if(document.getElementById("sen_email").value.trim()!=""){if(emailCheck(document.getElementById("sen_email").value)==false){alert("Please enter valid your email");document.getElementById("sen_email").focus();return false}}if(document.getElementById("message").value.trim()==""){alert("Please enter message");document.getElementById("message").focus();return false}}function ViewRelatedDownload(){document.getElementById("RelatedDownloadDiv").style.display="";document.getElementById("TopDownloadDiv").style.display="none";document.getElementById("RelatedReviewsDiv").style.display="none";document.getElementById("RelatedDownloadLink").className="tab_links";document.getElementById("TopDownloadLink").className="tab_links1";document.getElementById("ReviewsLink").className="tab_links1";document.getElementById("MoreRelatedLink").style.display="";document.getElementById("MoreTopLink").style.display="none";document.getElementById("MoreReviewsLink").style.display="none";document.getElementById("RelatedDownloadImgUp").style.display="none";document.getElementById("RelatedDownloadImgDown").style.display="";document.getElementById("TopDownloadsImgUp").style.display="";document.getElementById("TopDownloadsImgDown").style.display="none";document.getElementById("RelatedReviewsImgUp").style.display="";document.getElementById("RelatedReviewsImgDown").style.display="none"}function ViewTopDownloads(){document.getElementById("RelatedDownloadDiv").style.display="none";document.getElementById("TopDownloadDiv").style.display="";document.getElementById("RelatedReviewsDiv").style.display="none";document.getElementById("RelatedDownloadLink").className="tab_links1";document.getElementById("TopDownloadLink").className="tab_links";document.getElementById("ReviewsLink").className="tab_links1";document.getElementById("MoreRelatedLink").style.display="none";document.getElementById("MoreTopLink").style.display="";document.getElementById("MoreReviewsLink").style.display="none";document.getElementById("RelatedDownloadImgUp").style.display="";document.getElementById("RelatedDownloadImgDown").style.display="none";document.getElementById("TopDownloadsImgUp").style.display="none";document.getElementById("TopDownloadsImgDown").style.display="";document.getElementById("RelatedReviewsImgUp").style.display="";document.getElementById("RelatedReviewsImgDown").style.display="none"}function ViewSoftwareRelatedReviews(){document.getElementById("RelatedDownloadDiv").style.display="none";document.getElementById("TopDownloadDiv").style.display="none";document.getElementById("RelatedReviewsDiv").style.display="";document.getElementById("RelatedDownloadLink").className="tab_links1";document.getElementById("TopDownloadLink").className="tab_links1";document.getElementById("ReviewsLink").className="tab_links";document.getElementById("MoreRelatedLink").style.display="none";document.getElementById("MoreTopLink").style.display="none";document.getElementById("MoreReviewsLink").style.display="";document.getElementById("RelatedDownloadImgUp").style.display="";document.getElementById("RelatedDownloadImgDown").style.display="none";document.getElementById("TopDownloadsImgUp").style.display="";document.getElementById("TopDownloadsImgDown").style.display="none";document.getElementById("RelatedReviewsImgUp").style.display="none";document.getElementById("RelatedReviewsImgDown").style.display=""}function get_EditSoftwareChkCount(b){f1=document.software_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_software_edit(a){if(document.getElementById("LicenseType1").checked==false&&document.getElementById("LicenseType2").checked==false&&document.getElementById("LicenseType3").checked==false){alert("Please select license type");document.getElementById("LicenseType1").focus();return false}if(document.getElementById("ProductCompatibility1").checked==false&&document.getElementById("ProductCompatibility2").checked==false&&document.getElementById("ProductCompatibility3").checked==false&&document.getElementById("ProductCompatibility4").checked==false){alert("Please select product compatibility");document.getElementById("ProductCompatibility1").focus();return false}if(get_EditSoftwareChkCount("software_category")==0){alert("Please select atleast one category");return false}if(get_EditSoftwareChkCount("software_category")>2){alert("Please select maximum of 2 categorires");return false}if(document.getElementById("ProductName").value.trim()==""){alert("Please enter product name");document.getElementById("ProductName").focus();return false}if(document.getElementById("Version").value.trim()==""){alert("Please enter product version");document.getElementById("Version").focus();return false}if(document.getElementById("ProductDescription").value.trim()==""){alert("Please enter brief product description");document.getElementById("ProductDescription").focus();return false}if(document.getElementById("CompanyName").value.trim()==""){alert("Please enter company name");document.getElementById("CompanyName").focus();return false}if(document.getElementById("CompanyUrl").value.trim()==""){alert("Please enter company website or product URL");document.getElementById("CompanyUrl").focus();return false}if(document.getElementById("CompanyUrl").value.trim()!=""){if(isValidURL(document.getElementById("CompanyUrl").value)==false){alert("Please enter valid company website or product URL");document.getElementById("CompanyUrl").focus();return false}}if(document.getElementById("DownloadUrl").value.trim()==""){alert("Please enter download URL");document.getElementById("DownloadUrl").focus();return false}if(document.getElementById("DownloadUrl").value.trim()!=""){if(isValidURL(document.getElementById("DownloadUrl").value)==false){alert("Please enter valid download URL");document.getElementById("DownloadUrl").focus();return false}}if(document.getElementById("RetypeDownloadUrl").value.trim()==""){alert("Please retype download URL");document.getElementById("RetypeDownloadUrl").focus();return false}if(document.getElementById("RetypeDownloadUrl").value.trim()!=""){if(isValidURL(document.getElementById("RetypeDownloadUrl").value)==false){alert("Please retype valid download URL");document.getElementById("RetypeDownloadUrl").focus();return false}}if(document.getElementById("DownloadUrl").value!=document.getElementById("RetypeDownloadUrl").value){alert("Download URL and retype download URL should be same");document.getElementById("RetypeDownloadUrl").focus();return false}if(document.getElementById("DownLoadSize").value.trim()==""){alert("Please enter download file size");document.getElementById("DownLoadSize").focus();return false}if(document.getElementById("DownLoadSize").value.trim()!=""){if(checknumber(document.getElementById("DownLoadSize").value)==false){alert("Please enter valid download file size");document.getElementById("DownLoadSize").focus();return false}}if(CheckOsRequirements()>0){alert("Please enter OS requirements");document.getElementById("OsRequirements_0").focus();return false}if(document.getElementById("Description").value.trim()==""){alert("Please enter description");document.getElementById("Description").focus();return false}if(get_softwareValidFile("software_img")>0){alert("Please upload valid software image(s)");return false}if(document.getElementById("HelpingHand").checked==true){if(document.getElementById("HelpingWebAddress").value.trim()==""){alert("Please enter website address");document.getElementById("HelpingWebAddress").focus();return false}if(document.getElementById("HelpingWebAddress").value.trim()!=""){if(isValidURL(document.getElementById("HelpingWebAddress").value)==false){alert("Please enter valid website address");document.getElementById("HelpingWebAddress").focus();return false}}}document.getElementById("Post").disabled="true";hidden_span=document.getElementById("hide_stuff");hidden_span.style.display="block";return true}function ViewSoftwareImage1(){document.getElementById("DeleteImageLink1").style.display=""}function DeleteSoftwareImage1(){document.getElementById("DeleteImageLink1").style.display="none";document.getElementById("ImageDescription_0").value="";document.getElementById("ImageTitle_0").value="";document.getElementById("software_img_0").value=""}function ViewSoftwareImage2(){document.getElementById("DeleteImageLink2").style.display=""}function DeleteSoftwareImage2(){document.getElementById("DeleteImageLink2").style.display="none";document.getElementById("ImageDescription_1").value="";document.getElementById("ImageTitle_1").value="";document.getElementById("software_img_1").value=""}function ViewSoftwareVideo(){document.getElementById("DeleteVideoLink").style.display=""}function DeleteSoftwareVideo(){document.getElementById("DeleteVideoLink").style.display="none";document.getElementById("VideoDescription").value="";document.getElementById("VideoTitle").value="";document.getElementById("software_Video").value=""};
