function runOnLoad_edit_key_people(){addMaximumCharLimit($("employee1Description"),250,$("charsLeftEmp1"));calcRemainingChars($("employee1Description"),250,$("charsLeftEmp1"));if(isUpgrade()){addMaximumCharLimit($("employee2Description"),250,$("charsLeftEmp2"));addMaximumCharLimit($("employee3Description"),250,$("charsLeftEmp3"));addMaximumCharLimit($("employee4Description"),250,$("charsLeftEmp4"));addMaximumCharLimit($("employee5Description"),250,$("charsLeftEmp5"));calcRemainingChars($("employee2Description"),250,$("charsLeftEmp2"));calcRemainingChars($("employee3Description"),250,$("charsLeftEmp3"));calcRemainingChars($("employee4Description"),250,$("charsLeftEmp4"));calcRemainingChars($("employee5Description"),250,$("charsLeftEmp5"));}}var maxEmployees=5;function addEmployee(){var A=getTotalEmployees()+1;$j("#person"+A).show();$j("#employee"+A+"Exists").val("true");if(A==maxEmployees||!isUpgrade()&&A>=1){$j("#addEmployee").hide();}}function confirmDeleteEmployee(A){$("deleteName").innerHTML=$("employee"+A+"FullName").value;$("confirmDelete").innerHTML="<a class='mediumButton' href='javascript:deleteEmployee("+A+");'><span>remove</span></a>";coverScreen();showDivAtScreenCentre("deletePopup");}function deleteEmployee(B){var C=B+1;if(isUpgrade()){for(;C<=maxEmployees;C++){moveEmployeeUp(C);}}var A=getTotalEmployees();$j("#person"+A).hide();$("employee"+A+"Exists").value="false";$("employee"+A+"FullName").value="";$("employee"+A+"Position").value="";$("employee"+A+"PhoneNumber").value="";$("employee"+A+"EmailAddress").value="";$("employee"+A+"YearsEmployed").selectedIndex="";$("employee"+A+"Description").value="";$("employee"+A+"PortraitURI").value="";$("employeeImage"+A).innerHTML='<div class="dummyPersonImage"></div>';$j("#addEmployee").show();$j("#deletePopup").hide();uncoverScreen();}function moveEmployeeUp(A){$("employee"+(A-1)+"FullName").value=$("employee"+A+"FullName").value;$("employee"+(A-1)+"Position").value=$("employee"+A+"Position").value;$("employee"+(A-1)+"PhoneNumber").value=$("employee"+A+"PhoneNumber").value;$("employee"+(A-1)+"EmailAddress").value=$("employee"+A+"EmailAddress").value;$("employee"+(A-1)+"YearsEmployed").selectedIndex=$("employee"+A+"YearsEmployed").selectedIndex;$("employee"+(A-1)+"Description").value=$("employee"+A+"Description").value;$("employee"+(A-1)+"PortraitURI").value=$("employee"+A+"PortraitURI").value;$("employeeImage"+(A-1)).innerHTML=$("employeeImage"+A).innerHTML;}function isUpgrade(){return $("listingUpgrade").value=="true";}function getTotalEmployees(){var A=0;A+=$("employee1Exists").value=="true"?1:0;A+=$("employee2Exists").value=="true"?1:0;A+=$("employee3Exists").value=="true"?1:0;A+=$("employee4Exists").value=="true"?1:0;A+=$("employee5Exists").value=="true"?1:0;return A;}function editBusinessOwnerFinancialData(E){var B=$("editTurnover").value;var D=$("editEmployees").value;var C=$("editYearEstablished").value;var A=$("hideEquifaxData").checked;setCursorWait();AjaxService.financialEditBusinessOwnerFinancialData(D,B,C,A,E,function(F){processAuthenticationError(F);$("editTurnoverErrors").innerHTML="";$("editEmployeesErrors").innerHTML="";$("editYearEstablishedErrors").innerHTML="";if(!F.validationError){window.location.reload();}else{processValidationError(F,"editTurnoverErrors","editTurnoverErrors");processValidationError(F,"editEmployeesErrors","editEmployeesErrors");processValidationError(F,"editYearEstablishedErrors","editYearEstablishedErrors");}setCursorDefault();});}function editMarketLocationsNote(B){var A=$("marketLocationsNoteTextArea").value;if(A.length<=250){setCursorWait();AjaxService.financialEditMarketLocationsNote(A,B,function(C){processAuthenticationError(C);if(!C.validationError){$("marketLocationsNoteDisplay").innerHTML=A;$("editMarketLocationsNoteErrors").innerHTML="";$("currentMarketLocationsNoteText").value=A;if(A==null||A==""){showDiv("market_locations_original_message");hideDiv("marketLocationsNoteDisplay");hideDiv("marketLocationsNoteInfo");}else{hideDiv("market_locations_original_message");showDiv("marketLocationsNoteDisplay");showDiv("marketLocationsNoteInfo");}hideDiv("editMarketLocationsNoteDiv");uncoverScreen();}else{processDefaultValidationError(C,"editMarketLocationsNoteErrors");}setCursorDefault();});}else{$("editMarketLocationsNoteErrors").innerHTML="Limit of 250 characters.";}}function showEditMarketLocationsNote(){$("marketLocationsNoteTextArea").value=$("currentMarketLocationsNoteText").value;coverScreen();showDivAtScreenCentre("editMarketLocationsNoteDiv");}function runOnLoad_add_new_business(){var B=$j("#verifiedSearch").val();if(B=="1"){$j("#addressDetails").show();$j("#addBusinessMainFormFieldset").show();if($("address.postcode").value!=""){pcaListAddresses($("address.postcode").value,"XBRID11111","AH85-AW89-FR91-EK94");$j("#chooseAddress").show();}}else{var A=$j("#name").val();var C=$("address.postcode").value;if(A!=""&&C!=""){add_new_business_verificationSearch();}}}function add_new_business_verificationSearch(){setCursorWait();$j("#addListingVerificationLoadingDiv").show();$j("#addListingVerificationResults").html("");$j("#addListingVerificationResultsContainer").hide("");$j("#verificationSearchErrors").html("");$j("#listingNameErrors").html("");$j("#postcodeErrors").html("");$j("#chooseAddress").hide();$j("#addressDetails").hide();$j("#addBusinessMainFormFieldset").hide();$j("#verifiedSearch").val("");$j("#verifyBusinessToAddLink").hide();$j("#id").val("");var listingName=$j("#name").val();var listingPostcode=$("address.postcode").value;var isBusinessOwner=$("businessOwner").checked;var setEmployer=$("setEmpl").value;AjaxService.listingAddListingVerificationSearch(listingName,listingPostcode,false,function(returnBean){processAuthenticationError(returnBean);if(!returnBean.validationError){if(returnBean.result!=null){var resultsList=$("addListingVerificationResults");var listings=eval("("+returnBean.result+")").listings;for(var i=0;i<listings.length;i++){var listingListEntry=document.createElement("li");var listingId=listings[i].id;var name=listings[i].name;var street1=listings[i].street1;var street2=listings[i].street2;var street3=listings[i].street3;var town=listings[i].town;var county=listings[i].county;var postcode=listings[i].postcode;var phone=listings[i].phone;var classification=listings[i].classification;var classificationDesc=listings[i].classificationDesc;var address="";if(street1!=""){address=street1+", ";}if(street2!=""){address=address+street2+", ";}if(street3!=""){address=address+street3+", ";}if(town!=""){address=address+town+", ";}if(county!=""){address=address+county+", ";}if(postcode!=""){address=address+postcode;}if(listings[i].isListed){eval("listingListEntry.onclick = function () {add_new_business_handleDirectoryListed('"+listings[i].id+"','"+listings[i].link+"','"+setEmployer+"');};");}else{eval("listingListEntry.onclick = function () {add_new_business_handleNonDirectoryListed('"+listingId+"', '"+escape(name)+"', '"+escape(street1)+"', '"+escape(street2)+"', '"+escape(street3)+"', '"+escape(town)+"', '"+escape(county)+"', '"+escape(postcode)+"', '"+escape(phone)+"', '"+escape(classification)+"', '"+escape(classificationDesc)+"');};");}listingListEntry.innerHTML="<strong>"+name+"</strong><br /><span>"+address+"</span>";resultsList.appendChild(listingListEntry);}$j("#addListingVerificationResultsContainer").show("");$j("#verifyBusinessToAddLink").show();}else{verifyBusinessToAdd();}}else{processDefaultValidationError(returnBean,"verificationSearchErrors");processValidationError(returnBean,"listingNameErrors","listingNameErrors");processValidationError(returnBean,"postcodeErrors","postcodeErrors");processValidationError(returnBean,"verificationSearchErrors","verificationSearchErrors");}$j("#addListingVerificationLoadingDiv").hide();setCursorDefault();});return false;}function add_new_business_handleDirectoryListed(D,E,B){var C="/app/frontend";var A=$("businessOwner").checked;if(B!=""){setCursorWait();AjaxService.userChangeEmployer(D,function(F){processAuthenticationError(F);if(A){document.location=C+"/VerifyControlListing?dlid="+D;}else{document.location=C+"/UserProfile";}setCursorDefault();});}else{if(A){document.location=C+"/VerifyControlListing?dlid="+D;}else{document.location=E;}}}function add_new_business_handleNonDirectoryListed(C,A,F,E,D,K,I,H,J,G,B){$j("#id").val(C);$j("#addListingVerificationResults").html("");$("name").value=unescape(A);$("address.street1").value=unescape(F);$("address.street2").value=unescape(E);$("address.street3").value=unescape(D);$("address.town").value=unescape(K);$("address.county").value=unescape(I);$("address.postcode").value=unescape(H);$("phoneNumber").value=unescape(J);$("classification").value=unescape(G);$("classificationSearchInput").value=unescape(B);verifyBusinessToAdd();}function verifyBusinessToAdd(){$j("#verifiedSearch").val("1");pcaListAddresses($("address.postcode").value,"XBRID11111","AH85-AW89-FR91-EK94");$j("#chooseAddress").show();$j("#addressDetails").show();$j("#addBusinessMainFormFieldset").show();$j("#verifyBusinessToAddLink").hide();$j("#addListingVerificationResults").html("");$j("#addListingVerificationResultsContainer").hide("");}function add_new_business_selectBusinessType(A){if(A=="limited_plc"){$j("#companiesHouseDiv").show();}else{$j("#companiesHouseDiv").hide();}}function add_new_business_selectBusinessOwner(C){if(C=="true"){$j("#addNewBusinessBONote").show();$j("#companyTypeDt").show();$j("#companyTypeDd").show();$j("#companyMobileDt").show();$j("#companyMobileDd").show();$j("#insuranceExpiryDiv").show();$("companyPhoneNumberTitle").innerHTML="Phone number";}else{$j("#addNewBusinessBONote").hide();$j("#companyTypeDt").hide();$j("#companyTypeDd").hide();$j("#companyMobileDt").hide();$j("#companyMobileDd").hide();$j("#insuranceExpiryDiv").hide();$("companyPhoneNumberTitle").innerHTML='<span class="notRequired">Phone number</span>';}var A=$j("#name").val();var B=$("address.postcode").value;if(A!=""&&B!=""){if($j("#verifiedSearch").val()!="1"){add_new_business_verificationSearch();}}}function createListingSubscription(A){setCursorWait();AjaxService.listingCreateSubscription(A,function(B){if(B.validationError){processValidationError(B,"","subscriptionError");}else{window.location.reload();}setCursorDefault();});}function endListingSubscription(A){setCursorWait();AjaxService.listingEndSubscription(A,function(B){if(B.validationError){processValidationError(B,"","subscriptionError");}else{window.location.reload();}setCursorDefault();});}function listing_actions_showLinkToThisPopup(A){coverScreen();$("linkToThisUrl").value=A;showDivAtScreenCentre("linkToThisPopup");}function listing_actions_hideLinkToThisPopup(){hideDiv("linkToThisPopup");uncoverScreen();}function showListingHelperArrow(A){hideDiv("arrow1");hideDiv("arrow2");hideDiv("arrow3");hideDiv("arrow4");$("arrow1Li").style.backgroundColor="#fff";$("arrow2Li").style.backgroundColor="#fff";$("arrow3Li").style.backgroundColor="#fff";$("arrow"+A+"Li").style.backgroundColor="#d7fdca";showDivAbsolute("arrow"+A);}function listingAddSentiment(E,C){var B=parseInt($("positiveSentimentCount").innerHTML);var D=parseInt($("neutralSentimentCount").innerHTML);var A=parseInt($("negativeSentimentCount").innerHTML);AjaxService.listingAddSentiment(E,C,function(F){if(F.result){if(C=="POSITIVE"){B++;}else{if(C=="NEUTRAL"){D++;}else{if(C=="NEGATIVE"){A++;}}}updateSentimentDisplay(B,D,A);businessVoteThanks(C);}});}function updateSentimentDisplay(E,F,C){var B=E+F+C;var G=Math.round((E/B)*100);var A=Math.round((F/B)*100);var D=Math.round((C/B)*100);$("positiveSentimentBar").style.backgroundPosition=-(100-G)+"px 0";$("neutralSentimentBar").style.backgroundPosition=-(100-A)+"px 0";$("negativeSentimentBar").style.backgroundPosition=-(100-D)+"px 0";$("positiveSentimentCount").innerHTML=E;$("neutralSentimentCount").innerHTML=F;$("negativeSentimentCount").innerHTML=C;hideDiv("voteRecommended");hideDiv("voteNeutral");hideDiv("voteNotRecommended");}function businessVoteThanks(A){if(A=="POSITIVE"){$("businessVoteThanksMessage").innerHTML="You have <strong>recommended</strong> this business.";}else{if(A=="NEUTRAL"){$("businessVoteThanksMessage").innerHTML="You are <strong>neutral</strong> about this business.";}else{if(A=="NEGATIVE"){$("businessVoteThanksMessage").innerHTML="You have <strong>not recommended</strong> this business.";}}}$("sentimentAdded").value=A;showDivAtScreenCentreWithIFrame("businessVoteThanks","iframeCover");}function saveMyScore(C,E){var F=$("quality").options[$("quality").selectedIndex].value;var B=$("reliability").options[$("reliability").selectedIndex].value;var D=$("value").options[$("value").selectedIndex].value;var A=$("sentimentAdded").value;document.location.href=C+"/Review?listing_id="+E+"&quality="+F+"&reliability="+B+"&value="+D;}function runOnLoad_profile_map(){loadSingleMarkerGMap("listingGMap","listingGMapMarker",15);}function runOnUnLoad_profile_map(){GUnload();}function viewLargeMap(C,B){var A="width=570,height=540,scrollbars=0,resizable=1,toolbar=0,location=0,menubar=1,status=0,directories=0";window.open(C+"/ViewListingMap?id="+B,"listingMapPopup",A);}if($("imageCount")!=undefined){var numberOfImages=parseInt($("imageCount").value);var imagesPerPage=15;var numPages=Math.ceil(numberOfImages/imagesPerPage);var currentPage=0;var numberOfPagesLoaded=2;}function liNextPage(){if(currentPage<numPages-1){if(numberOfPagesLoaded<=currentPage+1){liLoadExtraPages();}else{liSwapThumbs(currentPage+1,currentPage);currentPage++;}}}function liLoadExtraPages(){$("previousThumbsLink").className="previousThumbsDisabled";$("nextThumbsLink").className="nextThumbsDisabled";showDivAbsolute("loadingThumbsImage");$j.ajax({type:"get",url:"/app/frontend/MediaPagination",data:"listingId="+$("listingId").value+"&pageNumber="+numberOfPagesLoaded,async:true,success:function(A){hideDiv("loadingThumbsImage");$j("#thumbsContainer").append(A);numberOfPagesLoaded+=2;liSwapThumbs(currentPage+1,currentPage);currentPage++;}});}function liPreviousPage(){if(currentPage>0){liSwapThumbs(currentPage-1,currentPage);currentPage--;}}function liSwapThumbs(B,C){var D=B*imagesPerPage;var A=(B+1)*imagesPerPage;for(var E=D;E<A;E++){if($("thumb"+E)!=undefined){$("thumbImg"+E).src=$("thumb"+E+"Src").value;}}$j("#thumbsPage"+C).hide();$j("#thumbsPage"+B).show();if(B>0){$("previousThumbsLink").className="previousThumbs";}else{$("previousThumbsLink").className="previousThumbsDisabled";}if(B<numPages-1){$("nextThumbsLink").className="nextThumbs";}else{$("nextThumbsLink").className="nextThumbsDisabled";}}function subscribe_listing_upgrade_hideAdvertExampleImagePopup(){$j("#advertExampleImagePopup").hide();$j("#multiAdvertExampleImagePopup").hide();}function subscribe_listing_upgrade_showAdvertExampleImagePopup(A){subscribe_listing_upgrade_hideAdvertExampleImagePopup();$("popupAdvertExampleImage").src=A;showDivAtScreenCentre("advertExampleImagePopup");return false;}function subscribe_listing_upgrade_showMultiAdvertExampleImagePopup(B,A){subscribe_listing_upgrade_hideAdvertExampleImagePopup();$("popupMultiAdvertExampleImage1").src=B;$("popupMultiAdvertExampleImage2").src=A;showDivAtScreenCentre("multiAdvertExampleImagePopup");return false;}function deleteLogo(A){setCursorWait();AjaxService.listingDeleteLogo(A,function(B){processAuthenticationError(B);if(!B.validationError){$("edit_listings_logo").innerHTML="";$("listings_logo_image").innerHTML="";hideDiv("uploadImage");}setCursorDefault();});}function listing_details_deletePost(A){setCursorWait();AjaxService.postsDeletePost(A,function(B){window.location.reload();setCursorDefault();});}function showEditVanityUrl(){coverScreen();showDivAtScreenCentre("editVanityUrl");}function hideEditVanityUrl(){uncoverScreen();hideDiv("editVanityUrl");}function listing_details_changeMyEmployer(B,A){setCursorWait();AjaxService.userChangeEmployer(B,A,function(C){processAuthenticationError(C);if(C.validationError){processValidationError(C,"","findMyEmployerErrors");}else{if(!C.authenticationError){$j("#changeMyEmployerLink").hide();showDivAtScreenCentre("changeMyEmployerConfirmation");$j("#changeMyEmployerConfirmation").fadeOut(3500);}}setCursorDefault();});}function listing_details_hideChangeMyEmployerConfirmation(){hideDiv("changeMyEmployerConfirmation");uncoverScreen();}function reportDuplicateListing(C){var B=$("duplicateListingId").value;var A=$("duplicateListingMessage").value;AjaxService.reportDuplicateListing(B,A,function(D){if(D.validationError){processDefaultValidationError(D,"duplicateErrors");}else{document.location=C;}});}function reportNotTradingListing(C){var B=$("notTradingListingId").value;var A=$("notTradingListingMessage").value;AjaxService.reportNotTradingListing(B,A,function(D){if(D.validationError){processDefaultValidationError(D,"notTradingErrors");}else{document.location=C;}});}function toggleSlideListingAboutInfo(D,C,B,A){$j("#"+D).slideToggle("slow");if($(C)!=null){$j("#"+C).slideUp("slow");}if($(B)!=null){$j("#"+B).slideUp("slow");}if($(A)!=null){$j("#"+A).slideUp("slow");}}function about_us_videos_changeVideo(F){var A=$("videoURI"+F).value;var E=$("videoDescription"+F).value;$("mainVideoCTAs").innerHTML=$("videoCTAs"+F).innerHTML;$("mainVideo").innerHTML="<object width='380' height='285' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'><param name='movie' value='http://www.youtube.com/v/"+A+'&rel=0&color1=0x8fc9ff&color2=0xe9f4fc&border=1\'></param><param name="wmode" value="opaque" /><embed src=\'http://www.youtube.com/v/'+A+"&rel=0&color1=0x8fc9ff&color2=0xe9f4fc&border=1' type='application/x-shockwave-flash' width='380' height='285' wmode='opaque'></embed></object>";$("mainVideoDescription").innerHTML=E;$("mainVideoId").value=F;var B=$("isPrimaryVideo"+F).value;about_us_videos_showSetToPrimaryCTA(B);var D=$("businessOwnerRejected"+F).value;about_us_videos_showAboutTabCTAs(D);$("mainVideoReportAbuseLink").innerHTML=$("videoReportAbuseLink"+F).innerHTML;about_us_videos_updateCounter(F);var C=parseInt($("currentVideoOrder"+F).value);var G=document.getElementsByName("publicVideoId");about_us_videos_setNextPrevLinkVisibility(C,G);}function about_us_videos_showSetToPrimaryCTA(B){var A=$("userIsUpgradedBusinessOwner").value;if(A=="true"){if(B=="true"){$j("#setPrimaryVideo").hide();}else{$j("#setPrimaryVideo").show();}}}function about_us_videos_setToPrimary(B){$("setPrimaryVideoErrors").innerHTML="";var A=$("mainVideoId").value;setCursorWait();AjaxService.listingChangePrimaryVideo(B,A,function(D){processAuthenticationError(D);if(!D.validationError){$j("#setPrimaryVideo").hide();$("isPrimaryVideo"+A).value="true";var C=$("primaryVideoId").value;$("isPrimaryVideo"+C).value="false";$("primaryVideoId").value=A;}else{processDefaultValidationError(D,"setPrimaryVideoErrors");}setCursorDefault();});}function about_us_videos_showAboutTabCTAs(B){var A=$("userIsUpgradedBusinessOwner").value;if(A=="true"){if(B=="true"){$j("#mainVideoRemoveFromAbout").hide();$j("#mainVideoAddToAbout").show();}else{$j("#mainVideoRemoveFromAbout").show();$j("#mainVideoAddToAbout").hide();}}}function about_us_videos_setBusinessOwnerRejected(B,A){var C=$("mainVideoId").value;setCursorWait();AjaxService.listingSetBusinessOwnerRejected(C,B,A,function(D){processAuthenticationError(D);if(!D.validationError){$("businessOwnerRejected"+C).value=B;about_us_videos_showAboutTabCTAs(B);}setCursorDefault();});}function about_us_videos_updateCounter(C){var B=parseInt($("currentVideoOrder"+C).value);var D=document.getElementsByName("publicVideoId");var A=D.length;if(A>5){if(B<=1){about_us_videos_setCounterNumbers(0,4);}else{if(B==A-1){about_us_videos_setCounterNumbers(B-4,B);}else{if(B==A-2){about_us_videos_setCounterNumbers(B-3,B+1);}else{about_us_videos_setCounterNumbers(B-2,B+2);}}}about_us_videos_selectCounter(B,A);}else{about_us_videos_setCounterHighlight(B);}}function about_us_videos_selectCounter(B,A){if(B<2){about_us_videos_setCounterHighlight(B);}else{A=A-1;var C=A-B;if(C<2){about_us_videos_setCounterHighlight(4-C);}else{about_us_videos_setCounterHighlight(2);}}}function about_us_videos_setCounterHighlight(C){var A=document.getElementsByName("publicVideoId").length;if(A>5){A=5;}for(var B=0;B<A;B++){if(B==C){$j("#videoCounter"+B).addClass("mediaSelected");$j("#videoCounter"+B).removeClass("mediaUnselected");}else{$j("#videoCounter"+B).removeClass("mediaSelected");$j("#videoCounter"+B).addClass("mediaUnselected");}}}function about_us_videos_setCounterNumbers(D,C){var B=0;for(;D<=C;D++,B++){var A=$("videoCounter"+B);if(A!=undefined){A.href="javascript:about_us_videos_moveToVideoNumber("+D+");";A.innerHTML=D+1;}}}function about_us_videos_showPreviousVideo(){about_us_videos_moveToVideo(-1);}function about_us_videos_showNextVideo(){about_us_videos_moveToVideo(1);}function about_us_videos_moveToVideoNumber(B){var A=$("videoId"+B).value;about_us_videos_changeVideo(A);}function about_us_videos_moveToVideo(C){var B=$("mainVideoId").value;if(B!=undefined&&B!=""){var A=parseInt($("currentVideoOrder"+B).value);A+=C;var D=document.getElementsByName("publicVideoId");if((A>=0)&&(A<D.length)){var E=D[A].value;if(E!=undefined&&E!=""){about_us_videos_changeVideo(E);about_us_videos_setNextPrevLinkVisibility(A,D);}}}}function about_us_videos_setNextPrevLinkVisibility(A,B){if(A>0){$("previousVideo").style.visibility="";}else{$("previousVideo").style.visibility="hidden";}if(A<B.length-1){$("nextVideo").style.visibility="";}else{$("nextVideo").style.visibility="hidden";}}function about_us_videos_changeVideoDescription(){$("editVideoDescriptionErrors").innerHTML="";var B=$("videoIdContainer").value;var A=trim($("editVideoDescriptionValue").value);setCursorWait();AjaxService.listingChangeVideoDescription(B,A,function(C){processAuthenticationError(C);if(!C.validationError){window.location.reload();}else{processDefaultValidationError(C,"editVideoDescriptionErrors");}setCursorDefault();});}function about_us_videos_showChangeVideoDescription(A){coverScreen();$("editVideoDescriptionErrors").innerHTML="";$("videoIdContainer").value=A;$("editVideoDescriptionValue").value=trim($("videoDescription"+A).innerHTML);showDivAtScreenCentre("editVideoDescription");$("editVideoDescriptionValue").focus();}function about_us_videos_hideEditVideoDescription(){hideDiv("editVideoDescription");uncoverScreen();}function about_us_videos_deleteVideo(A){setCursorWait();AjaxService.listingDeleteVideo(A,function(B){processAuthenticationError(B);if(!B.validationError){window.location.reload();}else{processDefaultValidationError(B,"videoError"+A);}setCursorDefault();});}function runOnLoad_media(){var A=$("mainVideo");var B=$("mainVideoUrl");if(B!=undefined&&A!=undefined){A.innerHTML="<object width='380' height='285' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'><param name='movie' value='"+B.value+'\'></param><param name="wmode" value="opaque" /><embed src=\''+B.value+"' type='application/x-shockwave-flash' width='380' height='285' wmode='opaque'></embed></object>";}}function media_changeMainImageView(B){$("mainImage").onload="";var A=new Image();A.onload=function(){media_resizeImage(B);};A.src=$("imageFullUri"+B).value;$("mainImageDescription").innerHTML=$("imageDescription"+B).innerHTML;$("mainImageText").innerHTML=$("imageText"+B).innerHTML;$("mainImageCTAs").innerHTML=$("imageCTAs"+B).innerHTML;$("mainImageReportAbuseLink").innerHTML=$("imageReportAbuseLink"+B).innerHTML;$("mainImageAdded").innerHTML=$("imageAdded"+B).innerHTML;var D=$("businessOwnerRejected"+B).value;media_showImageAboutTabCTAs(D);var C=$("isPrimaryImage"+B).value;media_showImageSetToPrimaryCTA(C);$j("#mainVideoDiv").hide();$j("#mainPhotoDiv").show();hideDiv("addMediaAbout");}function media_resizeImage(C){var F=new Image();F.src=$("imageFullUri"+C).value;var I=285;var J=380;var K=F.height;var B=F.width;var G=I/K;var H=J/B;var D=G<H?G:H;var A=K*D;var E=B*D;$j("#mainImage").height(A);$j("#mainImage").width(E);$("mainImage").src=$("imageFullUri"+C).value;}function media_showImageAboutTabCTAs(B){var A=$("userIsUpgradedBusinessOwner").value;if(A=="true"){if(B=="true"){$j("#mainImageRemoveFromAbout").hide();$j("#mainImageAddToAbout").show();}else{$j("#mainImageRemoveFromAbout").show();$j("#mainImageAddToAbout").hide();}}}function media_enableImageUpload(B,A){A.disabled=(B.value=="");}function media_showImageUpload(){coverScreen();$("publicImageDescription").value="";$("publicFileEdit").value="";showDivAtScreenCentreWithIFrame("uploadPublicImage","iframeCover");}function media_showImageSetToPrimaryCTA(B){var A=$("userIsUpgradedBusinessOwner").value;if(A=="true"){if(B=="true"){$j("#mainImageSetToPrimary").hide();}else{$j("#mainImageSetToPrimary").show();}}}function media_changeImageDescription(){$("editDescriptionErrors").innerHTML="";var A=$("imageIdContainer").value;var B=trim($("editDescriptionValue").value);setCursorWait();AjaxService.listingChangeDescription(A,B,function(C){processAuthenticationError(C);if(!C.validationError){$("imageDescription"+A).innerHTML=B;$("mainImageDescription").innerHTML=B;$j("#editDescription").hide();}else{processDefaultValidationError(C,"editDescriptionErrors");}setCursorDefault();});}function media_showChangeImageDescription(A){coverScreen();$("editDescriptionErrors").innerHTML="";$("imageIdContainer").value=A;$("editDescriptionValue").value=trim($("imageDescription"+A).innerHTML);showDivAtScreenCentre("editDescription");$("editDescriptionValue").focus();}function media_deleteImage(A,B){$("imageError"+A).innerHTML="";if(B=="PUBLIC_LISTING_IMAGE"||B=="BO_LISTING_IMAGE"){setCursorWait();AjaxService.listingDeleteImage(A,function(C){media_processDeleteImageCmd(C,A);setCursorDefault();});}else{if(B=="PUBLIC_REVIEW_IMAGE"||B=="ANONYMOUS_REVIEW_IMAGE"){setCursorWait();AjaxService.remarksDeleteImage(A,function(C){media_processDeleteImageCmd(C,A);setCursorDefault();});}else{if(B=="PUBLIC_POST_IMAGE"){setCursorWait();AjaxService.postsDeleteImage(A,function(C){media_processDeleteImageCmd(C,A);setCursorDefault();});}}}}function media_processDeleteImageCmd(B,A){processAuthenticationError(B);if(!B.validationError){window.location.reload();}else{processDefaultValidationError(B,"imageError"+A);}}function media_reorderImages(){var D=$("photosTab").childNodes;var B=document.getElementsByName("mediaIndex");var A=0;for(var C=0;C<D.length;C++){if(D[C].id!=undefined){if(A%5!=4){D[C].className="thumbnail";}else{D[C].className="thumbnail";}B[A].value=A;A++;}}}function media_hideUploadPublicImage(){hideDiv("uploadPublicImage");hideDiv("iframeCover");uncoverScreen();}function media_hideEditImageDescription(){hideDiv("editDescription");uncoverScreen();}function media_setImageBusinessOwnerRejected(C,B){var A=$("mainMediaId").value;setCursorWait();AjaxService.listingSetBusinessOwnerRejected(A,C,B,function(D){processAuthenticationError(D);if(!D.validationError){$("businessOwnerRejected"+A).value=C;media_showImageAboutTabCTAs(C);}setCursorDefault();});}function media_setImageToPrimary(B){$("setImageToPrimaryErrors").innerHTML="";var A=$("mainMediaId").value;setCursorWait();AjaxService.listingChangePrimaryImage(B,A,function(D){processAuthenticationError(D);if(!D.validationError){$j("#mainImageSetToPrimary").hide();$("isPrimaryImage"+A).value="true";var C=$("primaryImageId").value;$("isPrimaryImage"+C).value="false";$("primaryImageId").value=A;}else{processDefaultValidationError(D,"setImageToPrimaryErrors");}setCursorDefault();});}function media_changeVideo(F,C){var A=$("videoURI"+F).value;var E=$("videoDescription"+F).value;$("mainVideoCTAs").innerHTML=$("videoCTAs"+F).innerHTML;$("mainVideo").innerHTML="<object width='380' height='285' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'><param name='movie' value='http://www.youtube.com/v/"+A+'&rel=0&color1=0x8fc9ff&color2=0xe9f4fc&border=1\'></param><param name="wmode" value="opaque" /><embed src=\'http://www.youtube.com/v/'+A+"&rel=0&color1=0x8fc9ff&color2=0xe9f4fc&border=1' type='application/x-shockwave-flash' width='380' height='285' wmode='opaque'></embed></object>";$("mainVideoAdded").innerHTML=$("videoAdded"+F).innerHTML;$("mainVideoDescription").innerHTML=E;$("mainVideoText").innerHTML=$("videoText"+F).innerHTML;var B=$("isPrimaryVideo"+F).value;media_showSetVideoToPrimaryCTA(B);var D=$("businessOwnerRejected"+F).value;media_showVideoAboutTabCTAs(D);$("mainVideoReportAbuseLink").innerHTML=$("videoReportAbuseLink"+F).innerHTML;$j("#mainPhotoDiv").hide();$j("#mainVideoDiv").show();if(C){window.location=String(window.location).replace(/\#.*$/,"")+"#mainVideoDiv";}}function media_showSetVideoToPrimaryCTA(B){var A=$("userIsUpgradedBusinessOwner").value;if(A=="true"){if(B=="true"){$j("#setPrimaryVideo").hide();}else{$j("#setPrimaryVideo").show();}}}function media_setVideoToPrimary(B){$("setPrimaryVideoErrors").innerHTML="";var A=$("mainMediaId").value;setCursorWait();AjaxService.listingChangePrimaryVideo(B,A,function(D){processAuthenticationError(D);if(!D.validationError){$j("#setPrimaryVideo").hide();$("isPrimaryVideo"+A).value="true";var C=$("primaryVideoId").value;$("isPrimaryVideo"+C).value="false";$("primaryVideoId").value=A;}else{processDefaultValidationError(D,"setPrimaryVideoErrors");}setCursorDefault();});}function media_showVideoAboutTabCTAs(B){var A=$("userIsUpgradedBusinessOwner").value;if(A=="true"){if(B=="true"){$j("#mainVideoRemoveFromAbout").hide();$j("#mainVideoAddToAbout").show();}else{$j("#mainVideoRemoveFromAbout").show();$j("#mainVideoAddToAbout").hide();}}}function media_setVideoBusinessOwnerRejected(B,A){var C=$("mainMediaId").value;setCursorWait();AjaxService.listingSetBusinessOwnerRejected(C,B,A,function(D){processAuthenticationError(D);if(!D.validationError){$("businessOwnerRejected"+C).value=B;media_showVideoAboutTabCTAs(B);}setCursorDefault();});}function media_changeVideoDescription(){$("editVideoDescriptionErrors").innerHTML="";var B=$("videoIdContainer").value;var A=trim($("editVideoDescriptionValue").value);setCursorWait();AjaxService.listingChangeVideoDescription(B,A,function(C){processAuthenticationError(C);if(!C.validationError){$("videoDescription"+B).value=A;$("mainVideoDescription").innerHTML=A;$j("#editVideoDescription").hide();}else{processDefaultValidationError(C,"editVideoDescriptionErrors");}setCursorDefault();});}function media_showChangeVideoDescription(A){coverScreen();$("editVideoDescriptionErrors").innerHTML="";$("videoIdContainer").value=A;$("editVideoDescriptionValue").value=$("videoDescription"+A).value;showDivAtScreenCentre("editVideoDescription");$("editVideoDescriptionValue").focus();}function media_hideEditVideoDescription(){hideDiv("editVideoDescription");uncoverScreen();}function media_deleteVideo(A){setCursorWait();AjaxService.listingDeleteVideo(A,function(B){processAuthenticationError(B);if(!B.validationError){window.location.reload();}else{processDefaultValidationError(B,"videoError"+A);}setCursorDefault();});}function media_showAddVideo(){coverScreen();$("addVideoErrors").innerHTML="";showDivAtScreenCentreWithIFrame("addVideo","iframeCover");$("addVideoURI").focus();}function media_hideAddVideo(){$j("#addVideo").hide();$j("#iframeCover").hide();}function media_addVideo(C){$("addVideoErrors").innerHTML="";var A=$("addVideoURI").value;var B=$("addVideoDescription").value;setCursorWait();AjaxService.listingAddVideo(C,A,B,function(D){processAuthenticationError(D);if(!D.result){$("addVideoErrors").innerHTML="Invalid Youtube URL";}else{if(!D.validationError){window.location.reload();}else{processDefaultValidationError(D,"addVideoErrors");}}setCursorDefault();});}function classification_classificationSearch(){var B=$j("#classificationSearchInput").val();var D=$("classificationSearchResults");hideDiv("classificationSearchResults");$("editClassificationSearchErrors").innerHTML="";$("editClassificationErrors").innerHTML="";var C=$j("#classificationSearchDisplayDivId").val();var A=$j("#"+C).html();$j("#currentClassificationSelectionDisplay").html(A);removeAllOptions(D);if(B!=""){setCursorWait();AjaxService.listingClassificationSearch(B,"editClassificationSearchErrors",function(G){processAuthenticationError(G);if(!G.validationError){var F=G.result;for(var E=0;E<F.length;E++){addOption(D,F[E].description,F[E].code);}if(F.length>0){showDiv("classificationSearchResults");}if(F.length==1){D.selectedIndex=0;if(D.onchange){D.onchange();}if(D.onclick){D.onclick();}}}else{processDefaultValidationError(G,"editClassificationSearchErrors");processValidationError(G,"editClassificationSearchErrors","editClassificationSearchErrors");}setCursorDefault();});}else{$("editClassificationSearchErrors").innerHTML="Please enter a classification for your search.";}}function runOnLoad_advert_edit(){addMaximumCharLimit($("editAdvertTextDescription"),75,$("advertCharsLeft"));}function changeAdvertText(C){var B=$j("#editAdvertText").val();var A=$j("#editAdvertTextDescription").val();setCursorWait();AjaxService.listingChangeAdvertText(C,B,A,"editAdvertTextErrors",function(D){processAuthenticationError(D);if(!D.validationError){$j("#displayAdvertText").html('<a href="#">'+B+"</a>");$j("#displayAdvertTextDescription").html(A);$j("#editAdvertTextErrors").html("");$j("#editAdvertTitleErrors").html("");$j("#editAdvertDescriptionErrors").html("");}else{processDefaultValidationError(D,"editAdvertTextErrors");processValidationError(D,"editAdvertTitleErrors","editAdvertTitleErrors");processValidationError(D,"editAdvertDescriptionErrors","editAdvertDescriptionErrors");}setCursorDefault();});}var keyPeopleSelect;function runOnLoad_key_people(){keyPeopleSelect=$("keyPeopleOrder");keyPeopleSelect.onchange=onSelectChange;keyPeopleSelect.selectedIndex=0;onSelectChange();}function onSelectChange(){if(keyPeopleSelect.selectedIndex==0){$("moveUp").disabled=true;}else{$("moveUp").disabled=false;}if(keyPeopleSelect.selectedIndex==keyPeopleSelect.options.length-1){$("moveDown").disabled=true;}else{$("moveDown").disabled=false;}}function moveUp(){var A=keyPeopleSelect.options[keyPeopleSelect.selectedIndex-1].value;var B=keyPeopleSelect.options[keyPeopleSelect.selectedIndex-1].text;keyPeopleSelect.options[keyPeopleSelect.selectedIndex-1].value=keyPeopleSelect.options[keyPeopleSelect.selectedIndex].value;keyPeopleSelect.options[keyPeopleSelect.selectedIndex-1].text=keyPeopleSelect.options[keyPeopleSelect.selectedIndex].text;keyPeopleSelect.options[keyPeopleSelect.selectedIndex].value=A;keyPeopleSelect.options[keyPeopleSelect.selectedIndex].text=B;keyPeopleSelect.selectedIndex=keyPeopleSelect.selectedIndex-1;onSelectChange();}function moveDown(){var A=keyPeopleSelect.options[keyPeopleSelect.selectedIndex+1].value;var B=keyPeopleSelect.options[keyPeopleSelect.selectedIndex+1].text;keyPeopleSelect.options[keyPeopleSelect.selectedIndex+1].value=keyPeopleSelect.options[keyPeopleSelect.selectedIndex].value;keyPeopleSelect.options[keyPeopleSelect.selectedIndex+1].text=keyPeopleSelect.options[keyPeopleSelect.selectedIndex].text;keyPeopleSelect.options[keyPeopleSelect.selectedIndex].value=A;keyPeopleSelect.options[keyPeopleSelect.selectedIndex].text=B;keyPeopleSelect.selectedIndex=keyPeopleSelect.selectedIndex+1;onSelectChange();}function changeKeyPeopleOrder(C){var A=new Array();for(var B=0;B<keyPeopleSelect.options.length;B++){A[B]=keyPeopleSelect.options[B].value-1;}setCursorWait();AjaxService.listingChangeKeyPeopleOrder(C,A,function(F){processAuthenticationError(F);if(!F.validationError){var D=new Array();for(var E=0;E<keyPeopleSelect.options.length;E++){D[E]=$("person"+keyPeopleSelect.options[E].value).innerHTML;}for(var E=0;E<keyPeopleSelect.options.length;E++){$("person"+(E+1)).innerHTML=D[E];keyPeopleSelect.options[E].value=E+1;}$j("#editKeyPeopleOrder").hide();uncoverScreen();}else{}setCursorDefault();});}function showContactKeyContact(C,B,A){$("contactKeyContactTo").innerHTML=C;$("contactKeyContactNumber").value=B;$("contactKeyContactListingId").value=A;showDivAtScreenCentre("contactKeyContactDiv");}function contactKeyContact(){setCursorWait();$("contactKeyContactSubjectError").innerHTML="";$("contactKeyContactMessageError").innerHTML="";AjaxService.listingContactKeyContact($("contactKeyContactListingId").value,$("contactKeyContactNumber").value,$("contactKeyContactSubject").value,$("contactKeyContactMessage").value,function(A){processAuthenticationError(A);if(!A.validationError){hideDiv("contactKeyContactDiv");uncoverScreen();$("contactKeyContactSubject").value="";$("contactKeyContactMessage").value="";}else{processValidationError(A,"subject","contactKeyContactSubjectError");processValidationError(A,"message","contactKeyContactMessageError");processValidationError(A,"contactKeyContactErrors","contactKeyContactErrors");}setCursorDefault();});}