var g_resxStrings={};g_resxStrings["RemoveProjectAreYouSure"]='Really? Are you sure you want to remove your project? You won\'t be able to change your mind after you click \"yes\".';g_resxStrings["RestoreSubmissionAreYouSure"]='Are you sure you want to restore this submission?  It will be included with your project if you select OK.';g_resxStrings["NoBlankFeedback"]='You cannot leave blank feedback';g_resxStrings["DeleteCommentAreYouSure"]='Are you sure you want to delete this comment??';g_resxStrings["UIDirection"]='LTR';g_resxStrings["CancelFeedbackAreYouSure"]='If you cancel now, none of the feedback elements that you worked on will be saved. Are you sure that you want to cancel?';g_resxStrings["NoSavedTips"]='You have not saved any tips yet.';g_resxStrings["EnterASubject"]='Please enter a subject.';g_resxStrings["EnterAMessage"]='Please enter a message.';g_resxStrings["Sending"]='sending...';g_resxStrings["SpecifyEmailAddress"]='You must specify the recipient\'s email address';g_resxStrings["Searching"]='Searching...';g_resxStrings["SelectAFriend"]='You must select at least one friend.';g_resxStrings["Adding"]='adding...';g_resxStrings["SearchBarTerms"]='Find project, member or group';g_resxStrings["SavingAndClosing"]='Saving and Closing';g_resxStrings["NoMoreThanXCharacters"]='Please enter no more than {0} characters';g_resxStrings["Chosen"]='Chosen';g_resxStrings["Rejected"]='Rejected';g_resxStrings["Spotlighted"]='Spotlighted';g_resxStrings["Underdogged"]='Underdogged';g_resxStrings["SpotlightUnderdogOff"]='off';g_resxStrings["RejectProjConfirmMsg"]='This will reject the project from publication and un-freeze it.  Continue?';g_resxStrings["PublicationProjConfirmMsg"]='You are selecting this project for publication.  Continue?';g_resxStrings["SpotlightProjConfirmMsg"]='You are putting this project in the spotlight.  Continue?';g_resxStrings["UnderdogProjConfirmMsg"]='You are setting this project as underdog.  Continue?';g_resxStrings["Poll_Suspend"]='Suspend';g_resxStrings["Poll_Reactivate"]='Reactivate';g_resxStrings["Poll_Qualify"]='Qualify';g_resxStrings["Poll_Disqualify"]='Disqualify';g_resxStrings["Not_Number_Alert"]='Please enter only numbers.';g_resxStrings["ApprovePageDelete"]='The deletion of a marketing page is irreversible and will cause links to this page to be broken. Are you sure?';g_resxStrings["ApprovePromoDelete"]='The deletion of a marketing promo is irreversible. Are you sure?';g_resxStrings["ApplyMarketingConfirmMsg"]='Apply this version?';g_resxStrings["Processing"]='Processing';g_resxStrings["OneWord"]='1 word';g_resxStrings["NWords"]='{0} words';g_resxStrings["Reviews_SubmitReviewConfirm"]='Are you sure you want to submit your final review?  You cannot edit your review after clicking OK.';g_resxStrings["ConfirmCloseWizardNewSubmission"]='Please note that your submission will not be saved if you cancel now. Are you sure you want to Cancel?';g_resxStrings["ConfirmCloseWizardExistingSubmission"]='Please note that if you cancel now, changes/updates to your submission will not be saved. Are you sure you want to cancel? ';g_resxStrings["ConfirmResubmitToQualityControl"]='Warning: your submission will be updated and given another \"flight check\" by WEbook before being forwarded to the agent(s) you selected. Are you sure you want to Submit Now?';g_resxStrings["ManuscriptSample"]='Manuscript Sample';g_resxStrings["BookProposal"]='Book Proposal';g_resxStrings["ManuscriptSampleInstruction"]='Add your Manuscript Sample below.';g_resxStrings["ManuscriptSampleTip_1"]='Want to submit to multiple agents with different sample length requirements?';g_resxStrings["ManuscriptSampleTip_2"]='';g_resxStrings["BookProposalSampleInstruction"]='Insert your Non-Fiction Proposal below.';g_resxStrings["BookProposalSampleTip_1"]='(Note: Most agents expect non-fiction proposals to follow a basic format. ';g_resxStrings["BookProposalSampleTip_2"]=')';g_resxStrings["noAgentSelectedWarning"]='You haven’t selected an agent yet. Click “Back” to select agents now. If you want to save your work and revise it later, click \'Save & Close.\'';g_resxStrings["selectAgents_explanation"]='Select agents to receive your submission. Note: Only agents who represent your category and genre appear below.';g_resxStrings["selectAgents_noAgentForGenre"]='No agents currently match the category/genre of your submission.';g_resxStrings["queryLetterWordsAlert"]='Your query letter must not have more than {0} characters. Please note that pasting from Microsoft Word can sometimes cause an incorrect character count. To solve this problem, click the ‘w’ icon above the text editor to get a special window for pasting from Word.';g_resxStrings["sampleProposalWordsAlert"]='Your sample/proposal must not have more than {0} characters. Please note that pasting from Microsoft Word can sometimes cause an incorrect character count. To solve this problem, click the ‘w’ icon above the text editor to get a special window for pasting from Word.';g_resxStrings["FullName"]='Full Name:';g_resxStrings["Email"]='Email:';g_resxStrings["Location"]='Location:';g_resxStrings["WebsiteBlog"]='Website/Blog:';g_resxStrings["Education"]='Education:';g_resxStrings["ProfessionalPersonalOverview"]='Professional/Personal Overview:';g_resxStrings["PublishedWork"]='Published Work:';g_resxStrings["WorkHistory"]='Work History/Expertise:';g_resxStrings["Awards"]='Awards/Honors/Associations:';g_resxStrings["Other"]='Other:';g_resxStrings["MarketingExpertisePlatform"]='Additional Marketing Expertise/Platform:';g_resxStrings["CreateProjectOverviewTooLong"]='We\'re sorry, the brief overview may be no more than 15000 characters in length.';g_resxStrings["CreateProjectConfirmationMessage"]='You are about to create a new WEbook project.  You can\'t edit your title or genre after your project is created, so please check your settings carefully.  Continue?';g_resxStrings["ExceededMaxCharsForFirstPage"]='{0} characters past the limit (of {1} characters)';g_resxStrings["InvalidTitleLength"]='Please pick a Title between 1 and 100 characters long';g_resxStrings["Project_MissingGenre"]='You must choose a genre';g_resxStrings["PollWizard_TeaserMaxChars"]='The teaser must have no more than {0} characters.';g_resxStrings["PollWizard_FirstPageMaxChars"]='Your submission must not have more than {0} characters. Please note that pasting from Microsoft Word can sometimes cause an incorrect character count. To solve this problem, click the ‘w’ icon above the text editor to get a special window for pasting from Word.';g_resxStrings["PollWizard_FirstPageMinChars"]='Your submission is empty.';g_resxStrings["PollWizard_AboutMeMaxChars"]='About Me must have no more than {0} characters.';g_resxStrings["Poll_DeleteAreYouSure"]='Your submission is currently being rated. Once deleted, it will be removed from PageToFame and will not receive further ratings. This action cannot be undone. Are you sure you want to delete it?';g_resxStrings["PollWizard_InvalidCoupon"]='The coupon code is no longer valid';g_resxStrings["YouMustCheckPreviewedCheckbox"]='Please confirm that you have reviewed your submission before proceeding.';function SetupTop()
{if(navigator.vendor=="Apple Computer, Inc."||navigator.vendor=="KDE"){(function(c){for(var i in c)
window["HTML"+i+"Element"]=document.createElement(c[i]).constructor;})({Html:"html",Head:"head",Link:"link",Title:"title",Meta:"meta",Base:"base",IsIndex:"isindex",Style:"style",Body:"body",Form:"form",Select:"select",OptGroup:"optgroup",Option:"option",Input:"input",TextArea:"textarea",Button:"button",Label:"label",FieldSet:"fieldset",Legend:"legend",UList:"ul",OList:"ol",DList:"dl",Directory:"dir",Menu:"menu",LI:"li",Div:"div",Paragraph:"p",Heading:"h1",Quote:"q",Pre:"pre",BR:"br",BaseFont:"basefont",Font:"font",HR:"hr",Mod:"ins",Anchor:"a",Image:"img",Object:"object",Param:"param",Applet:"applet",Map:"map",Area:"area",Script:"script",Table:"table",TableCaption:"caption",TableCol:"col",TableSection:"tbody",TableRow:"tr",TableCell:"td",FrameSet:"frameset",Frame:"frame",IFrame:"iframe"});function HTMLElement(){}
HTMLElement.prototype=HTMLHtmlElement.__proto__.__proto__;var HTMLDocument=document.constructor;var HTMLCollection=document.links.constructor;var HTMLOptionsCollection=document.createElement("select").options.constructor;var Text=document.createTextNode("").constructor;var Node=Text;}
if(window.HTMLElement&&!IsContainsSupported())
{HTMLElement.prototype.contains=function(child)
{if(typeof(child)=='string'){child=document.getElementById(child);}
if(!child){return false;}
if(child.parentNode===this){return true;}
if(child===document.body){return false;}
return this.contains(child.parentNode);}}}
function IsContainsSupported()
{var oTopInit1=document.getElementById("TopInit1");var oTopInit2=document.getElementById("TopInit2");try
{return oTopInit1.contains(oTopInit2);}
catch(e)
{return false;}}
String.prototype.trim=function()
{var str=this;var str=str.replace(/^\s\s*/,''),ws=/\s/,i=str.length;while(ws.test(str.charAt(--i)));return str.slice(0,i+1);};String.prototype.endsWith=function(s)
{var reg=new RegExp(s+"$");return reg.test(this);}
String.prototype.startsWith=function(s)
{var reg=new RegExp("^"+s);return reg.test(this);}
Array.prototype.contains=function(obj)
{var i=this.length;while(i--)
{if(this[i]===obj)
{return true;}}
return false;}
function GetEvent(e)
{if(!e)
{e=window.event;}
return e;}
function GetEventSrcElement(e)
{e=GetEvent(e);var srcElement=e.srcElement;if(!srcElement)
{srcElement=e.target;}
return srcElement;}
function GetDocumentSize()
{var docSize={};var htmlHeight=(document.body.scrollHeight>document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;var htmlWidth=(document.body.scrollWidth>document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;var visibleHeight=GetVisibleArea().height;if(htmlHeight>=visibleHeight)
{docSize.height=htmlHeight;docSize.width=htmlWidth;docSize.visibleHeight=visibleHeight;}
else
{docSize.height=visibleHeight;docSize.width=htmlWidth;docSize.visibleHeight=visibleHeight;}
return docSize;}
function GetVisibleArea()
{var visibleArea={};var intH=0,intW=0;if(self.innerHeight)
{intH=window.innerHeight;intW=window.innerWidth;}
else
{if(document.documentElement&&document.documentElement.clientHeight)
{intH=document.documentElement.clientHeight;intW=document.documentElement.clientWidth;}
else
{if(document.body)
{intH=document.body.clientHeight;intW=document.body.clientWidth;}}}
visibleArea.height=parseInt(intH,10);visibleArea.width=parseInt(intW,10);return visibleArea;}
function GetVerticalScrollOffset()
{var bodyScrollTop=document.body.scrollTop;var documentElementScrollTop=document.documentElement.scrollTop;var windowPageYOffset=window.pageYOffset;if(bodyScrollTop===undefined){bodyScrollTop=-1;}
if(documentElementScrollTop===undefined){documentElementScrollTop=-1;}
if(windowPageYOffset===undefined){windowPageYOffset=-1;}
return Math.max(Math.max(bodyScrollTop,documentElementScrollTop),windowPageYOffset);}
function ajaxCall(strUrl,callbackFunction,postArray)
{strUrl=AddUrlParam(strUrl,"rand",Math.random());var req;var processReqChange=function()
{if(req.readyState==4)
{var status;try
{status=req.status;}
catch(e)
{return;}
if(status==200)
{var strResponseText=req.responseText.trim();if(strResponseText.indexOf('<reporterror>')==0)
{alert(ExtractContents(strResponseText,'<reporterror>','</reporterror>'));return;}
else if(strResponseText.indexOf('<js>')==0)
{var js=ExtractContents(strResponseText,'<js>','</js>');eval(js);}
else if(strResponseText.indexOf('<json>')==0)
{var strJson=ExtractContents(strResponseText,'<json>','</json>');callbackFunction(ConvertStringToJson(strJson));}
else if(strResponseText.indexOf('<htmlandjson-29529387298>')==0)
{var html=strResponseText.substring(strResponseText.indexOf('<html-29529387298>')+18,strResponseText.indexOf('</html-29529387298>'));var strJson=strResponseText.substring(strResponseText.indexOf('<json-29529387298>')+18,strResponseText.indexOf('</json-29529387298>'));callbackFunction(html,ConvertStringToJson(strJson));}
else
{callbackFunction(strResponseText);}}
else
{if(g_bDebugMode)
{var strReason;if(req.responseText.indexOf('Compilation Error')>=0)
{strReason="Compilation Error";}
else if(req.statusText.toLowerCase()=="unknown")
{strReason="Unknown.  Check your network connection.";}
else
{strReason=req.statusText;alert(req.responseText);}
alert("There was a problem retrieving the response:\n"+strReason);}}}}
if(window.XMLHttpRequest)
{req=new XMLHttpRequest();}
else if(window.ActiveXObject)
{req=new ActiveXObject("Microsoft.XMLHTTP");}
if(req)
{req.onreadystatechange=processReqChange;if(postArray!==undefined)
{req.open("POST",strUrl,true);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');req.send(FormatQueryNameValuePairs(postArray));}
else
{req.open("GET",strUrl,true);if(window.XMLHttpRequest)
{req.send(null);}
else if(window.ActiveXObject)
{req.send();}}}}
function ConvertStringToJson(strJson)
{strJson=strJson.replace(/\t/g,'');strJson=strJson.replace(/\r/g,'');strJson=strJson.replace(/\n/g,'');return eval('x='+(strJson||'null'));}
function ExtractContents(strVal,strStartTag,strEndTag)
{var strContents=strVal.substr(strStartTag.length);strContents=strContents.substr(0,strContents.length-strEndTag.length);return strContents;}
function Link(strPath,queryArray)
{return BuildLink("http",strPath,queryArray);}
function LinkSecure(strPath,queryArray)
{if(g_bUseHttps)
{return BuildLink("https",strPath,queryArray);}
else
{return BuildLink("http",strPath,queryArray);}}
function LinkSmart(strPath,queryArray)
{if(g_bUseHttps&&window.location.protocol=="https:")
{return LinkSecure(strPath,queryArray);}
else
{return Link(strPath,queryArray);}}
function BuildLink(strPrefix,strPath,queryArray)
{strLink=strPrefix+"://"+g_strHostName;if(strPath!="")
{strLink+="/"+strPath;}
if(queryArray&&queryArray.length>0)
{strLink+="?"+FormatQueryNameValuePairs(queryArray);}
return strLink;}
function FormatQueryNameValuePairs(queryArray)
{if(queryArray&&queryArray.length%2!=0)
{throw"error!";}
var strQuery="";if(queryArray&&queryArray.length>0)
{for(var i=0;i<queryArray.length;i+=2)
{strQuery+=FormatQueryNameValuePair(queryArray[i],queryArray[i+1]);if(i<queryArray.length-2)
{strQuery+="&";}}}
return strQuery;}
function FormatQueryNameValuePair(strName,strValue)
{return encodeURIComponent(strName)+"="+encodeURIComponent(strValue);}
function AddDestinationUrlParam(strUrl,strName,strValue)
{if(strValue!=null&&strValue!="")
{strUrl=AddUrlParam(strUrl,strName,strValue);}
return strUrl;}
function AddUrlParam(strUrl,strName,strValue)
{if(strUrl.indexOf("?")>0)
{return strUrl+"&"+FormatQueryNameValuePair(strName,strValue);}
else
{return strUrl+"?"+FormatQueryNameValuePair(strName,strValue);}}
function SetCookie(sName,sValue)
{date=new Date();document.cookie=sName+"="+escape(sValue)+"; expires=Fri, 31 Dec 2099 23:59:59 GMT;";}
function GetCookie(sName)
{var aCookie=document.cookie.split("; ");for(var i=0;i<aCookie.length;i++)
{var aCrumb=aCookie[i].split("=");if(sName==aCrumb[0])
return unescape(aCrumb[1]);}
return null;}
function DelCookie(sName)
{document.cookie=sName+"=; expires=Fri, 21 Dec 1976 04:31:24 GMT;";}
function RequestStr(strName)
{var query=window.location.search.substring(1);var vars=query.split("&");for(var i=0;i<vars.length;i++)
{var pair=vars[i].split("=");if(pair[0]==strName)
{return decodeURIComponent(pair[1]);}}
return null;}
function AttachEvent(oElement,strEventName,strFunction)
{if(oElement.addEventListener)
{oElement.addEventListener(strEventName,strFunction,false);}
else if(oElement.attachEvent)
{oElement.attachEvent("on"+strEventName,strFunction);}}
var g_bIsIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var g_bIsIE6=(navigator.appVersion.indexOf("MSIE 6.0")!=-1)?true:false;function ConvertHTMLStringToDomNode(strHTML)
{var oParentDiv=document.createElement("div");oParentDiv.innerHTML=strHTML;return oParentDiv.firstChild;}
function IsRealMouseOut(e,oItem)
{if(e.type!='mouseout')
{return false;}
var oTarget;if(e.relatedTarget)
{oTarget=e.relatedTarget;}
else
{oTarget=e.toElement;}
return(!oItem.contains(oTarget));}
function StringFormat(strString)
{for(var i=1;i<arguments.length;i++)
{strString=strString.replace("{"+(i-1)+"}",arguments[i]);}
return strString;}
function SelectTab(strTabRowId,oTabToSelect)
{var strSelectedTabId='selectedTab_'+strTabRowId;var selectedTab=document.getElementById(strSelectedTabId);if(selectedTab!=null)
{selectedTab.className='tabRowLi unSelectedTab';selectedTab.id='';}
oTabToSelect.className='tabRowLi selectedTab';oTabToSelect.id=strSelectedTabId;}
function ShowTabMenu(strMenuId)
{var oMenu=document.getElementById(strMenuId);oMenu.style.display="";}
function HideTabMenu(e,oMenu)
{if(IsRealMouseOut(e,oMenu))
{oMenu.style.display="none";}}
var g_splashScreen=null;function SplashScreen(strLink,strWidth,successCallbackFn,failureCallbackFn,onLoadCallbackFn,strHtml)
{var _this=this;g_splashScreen=_this;_this.m_successCallbackFn=successCallbackFn;_this.m_failureCallbackFn=failureCallbackFn;_this.splash=document.createElement("div");_this.splash.className="splashScreen";var docSize=GetDocumentSize();_this.splash.style.height=docSize.height+"px";document.body.appendChild(_this.splash);var iMinPxFromTopOfScreen=70;var iMaxPopupHeightForScreen=docSize.visibleHeight-iMinPxFromTopOfScreen;var fnLoadPopup=function(strHtml,json)
{_this.popupWrapper=document.createElement("div");_this.popupWrapper.className="splashScreenPopupWrapper";var popup=document.createElement("div");popup.className="splashScreenPopup";popup.style.width=strWidth;_this.popupWrapper.appendChild(popup);var popupLCorner=document.createElement("div");popupLCorner.className="splashScreenLCorner";popup.appendChild(popupLCorner);var popupRCorner=document.createElement("div");popupRCorner.className="splashScreenRCorner";popupLCorner.appendChild(popupRCorner);var popupBorder=document.createElement("div");popupBorder.className="splashScreenBorder";popupRCorner.appendChild(popupBorder);var popupBG=document.createElement("div");popupBG.innerHTML=strHtml;popupBG.className="splashScreenBackground";popupBorder.appendChild(popupBG);document.body.appendChild(_this.popupWrapper);var iPopupHeight=popup.clientHeight;var iCenterScreen=GetVerticalScrollOffset()+(docSize.visibleHeight/2);var iPopupTop=iCenterScreen-(iPopupHeight/2);if(iPopupTop<iMinPxFromTopOfScreen)
{iPopupTop=iMinPxFromTopOfScreen;}
_this.popupWrapper.style.top=iPopupTop+"px";if(onLoadCallbackFn)
{onLoadCallbackFn(json);}}
if(strLink!=null)
{ajaxCall(strLink,fnLoadPopup,["max_popup_height_for_screen",iMaxPopupHeightForScreen,"popup_width",strWidth]);}
else
{fnLoadPopup(strHtml,null);}}
SplashScreen.prototype.Close=function()
{var _this=this;document.body.removeChild(_this.splash);document.body.removeChild(_this.popupWrapper);g_splashScreen=null;}
SplashScreen.prototype.OnSuccess=function()
{var _this=this;if(_this.m_successCallbackFn)
{_this.m_successCallbackFn();}
_this.Close();}
SplashScreen.prototype.OnFailure=function()
{var _this=this;if(_this.m_failureCallbackFn)
{_this.m_failureCallbackFn();}
_this.Close();}
function LoadHTMLContent(strId,strHTML)
{document.getElementById(strId).innerHTML=strHTML;}
function PopupConfirm(strCallbackFn,strActionFn,strTitle,strText,strId,strDivId)
{new SplashScreen(LinkSmart("ajax.aspx",["fn","popup_confirm_display","actionFn",strActionFn,"title",strTitle,"text",strText,"id",strId,"divId",strDivId]),"300px",strCallbackFn,strCallbackFn);}
function PopupConfirmAction(strActionFn,strId,strDivId)
{if(strActionFn=="none")
{return;}
var fn=function(strResult){LoadHTMLContent(strDivId,strResult);}
var strLink=Link("ajax.aspx",["fn",strActionFn,"id",strId]);ajaxCall(strLink,fn);}
function WEbookConfirm(strConfirmText,strCallbackSuccess,strCallbackCancel)
{new SplashScreen(LinkSmart("ajax.aspx",["fn","popup_confirm_display","actionFn","none","title","","text",strConfirmText,"id",null,"divId",null]),"400px",strCallbackSuccess,strCallbackCancel);}
var g_bIsSendingMessage=false;function ComposeMessage_Send(strId,strToMemberId,strFrom,bPopup,bIsAgent,strProjectId)
{if(!g_bIsSendingMessage)
{var strMsgSubjectText=document.getElementById('msgSubjectText'+strId).value;var strMessageText=document.getElementById('messageText'+strId).value;if(strMsgSubjectText==""){alert(g_resxStrings.EnterASubject);return;}
else if(strMessageText==""){alert(g_resxStrings.EnterAMessage);return;}
g_bIsSendingMessage=true;document.getElementById("sendButton_"+strId).innerHTML=g_resxStrings.Sending;var fnComposeMessageResult=function(strResult)
{document.getElementById("compose_message_control").innerHTML=strResult;g_bIsSendingMessage=false;}
var strLink=Link("ajax.aspx",["fn","compose_message_send"]);var postInputArray=['to',strToMemberId,'subject',strMsgSubjectText,'message',strMessageText,'from',strFrom,'popup',bPopup,'isAgent',bIsAgent,'p',strProjectId];ajaxCall(strLink,fnComposeMessageResult,postInputArray);}}
function ShowComposeMessageSplashScreen(strToMemberId,callbackFn)
{new SplashScreen(Link("ajax.aspx",["fn","compose_message_display","popup","true","to",strToMemberId]),"550px",callbackFn,callbackFn);}
function AgentComposeMessageSplash(strToMemberId,strProjectId){new SplashScreen(Link("ajax.aspx",["fn","agent_compose_message_display","popup","true","to",strToMemberId,"isAgent",true,"p",strProjectId]),"550px",null,null);}
function ConfirmMsgDelete(strMsgId,iStart)
{new SplashScreen(Link("ajax.aspx",["fn","message_panel_delete_splash","popup","true","message_id",strMsgId,"start",iStart]),"250px",null,null);}
var g_inviteAFriend=null;var g_bIsSendingInvite=false;var g_strFirstLoginRefLink=null;function InitOverrideDestinationUrl()
{g_inviteAFriend=new OverrideDestinationUrl();}
function OverrideDestinationUrl()
{;}
OverrideDestinationUrl.prototype.GetDestinationUrl=function()
{return Link("");}
function LoadJs(filename)
{var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src",filename)
if(typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref)}
function LoadPlaxoJs()
{LoadJs('http://www.plaxo.com/css/m/js/util.js');LoadJs('http://www.plaxo.com/css/m/js/basic.js');LoadJs('http://www.plaxo.com/css/m/js/abc_launcher.js');}
function ShowInviteAFriendSplashScreen(callbackFn)
{LoadPlaxoJs();new SplashScreen(Link("ajax.aspx",["fn","invite_a_friend_display","popup","true"]),"400px",callbackFn,callbackFn);}
function ShowInviteAFriendSplashScreenForWinAKindle()
{LoadPlaxoJs();new SplashScreen(Link("ajax.aspx",["fn","invite_a_friend_display","popup","true","bWinAKindle","true"]),"400px",null,null);}
function ShowInviteAFriendSplashScreenForProject(strProjectId)
{LoadPlaxoJs();new SplashScreen(Link("ajax.aspx",["fn","invite_a_friend_display","popup","true","bProject","true","strId",strProjectId]),"400px",null,null);}
function ShowInviteNewFriendsSplashScreen(to,callbackFn)
{LoadPlaxoJs();new SplashScreen(Link("ajax.aspx",["fn","invite_new_friends_display","popup","true","to",to]),"400px",InviteAFriend_Redirect,callbackFn);}
function ShowFindFriendsSplashScreen(callbackFn)
{LoadPlaxoJs();new SplashScreen(Link("ajax.aspx",["fn","invite_a_friend_display","popup","true","bConnectFriends","true"]),"435px",callbackFn,callbackFn);}
function ShowFoundFriendsSplashScreen(strTo,callbackFn)
{LoadPlaxoJs();new SplashScreen(Link("ajax.aspx",["fn","invite_a_friend_found_friends_display","popup","true","to",strTo]),"400px",InviteAFriend_Redirect,callbackFn);}
function ShowAddFriendsSuccessSplashScreen(bInviteMore,callbackFn)
{LoadPlaxoJs();new SplashScreen(Link("ajax.aspx",["fn","invite_a_friend_add_friends_success_display","popup","true","bInviteMore",bInviteMore]),"400px",InviteAFriend_Redirect,callbackFn);}
function InviteAFriend_Redirect()
{if(g_strFirstLoginRefLink!=null)
window.location=g_strFirstLoginRefLink;}
function InviteAFriend_FindFriends(strId)
{var strTo=document.getElementById("inviteTo"+strId).value;if(strTo=="")
{alert(g_resxStrings.SpecifyEmailAddress);return;}
document.getElementById("resultMsg"+strId).innerHTML=g_resxStrings.Searching;var fnInviteAFriendResult=function(jsonResult)
{document.getElementById("resultMsg"+strId).innerHTML=jsonResult.resultHtml;if(jsonResult.bSuccess)
{g_splashScreen.OnSuccess();ShowFoundFriendsSplashScreen(strTo,null);}}
var strLink=Link("ajax.aspx",["fn","invite_a_friend_find_friends"]);var postInputArray=['to',strTo];ajaxCall(strLink,fnInviteAFriendResult,postInputArray);}
function InviteAFriend_SendMail(strUniqueId,strProjectId,bPopup,bForwardAuthorQuery)
{if(!g_bIsSendingInvite)
{var strTo=document.getElementById("inviteTo"+strUniqueId).value;if(strTo=="")
{alert(g_resxStrings.SpecifyEmailAddress);return;}
g_bIsSendingInvite=true;document.getElementById("resultMsg"+strUniqueId).innerHTML=g_resxStrings.Sending;var strFrom=document.getElementById("inviteFrom"+strUniqueId).value;var strMessage=document.getElementById("inviteMessage"+strUniqueId).value;var fnInviteAFriendResult=function(jsonResult){document.getElementById("resultMsg"+strUniqueId).innerHTML=jsonResult.resultHtml;g_bIsSendingInvite=false;if((bPopup||bForwardAuthorQuery)&&jsonResult.bSuccess){g_splashScreen.OnSuccess();}}
if(bForwardAuthorQuery){var strLink=Link("ajax.aspx",["fn","forward_author_query_send"]);var postInputArray=['to',strTo,'from',strFrom,'message',strMessage,'location',window.location,'strId',strUniqueId,'strProjectId',strProjectId];}else{var strLink=Link("ajax.aspx",["fn","invite_a_friend_send"]);var postInputArray=['to',strTo,'from',strFrom,'message',strMessage,'location',window.location,'strId',strUniqueId];}
postInputArray.push("destination_url");if(g_inviteAFriend!=null)
{postInputArray.push(g_inviteAFriend.GetDestinationUrl());}
else
{postInputArray.push(window.location);}
ajaxCall(strLink,fnInviteAFriendResult,postInputArray);}}
function InviteAFriend_Clear(strId)
{document.getElementById("inviteTo"+strId).value="";document.getElementById("inviteFrom"+strId).value="";document.getElementById("inviteMessage"+strId).value="";document.getElementById("resultMsg"+strId).innerHTML="";}
function InviteAFriend_CheckAll()
{var e=document.getElementsByName("friendsToInvite");for(i=0;i<e.length;i++)
{e[i].checked=true;}}
function InviteAFriend_UnCheckAll()
{var e=document.getElementsByName("friendsToInvite");for(i=0;i<e.length;i++)
{e[i].checked=false;}}
function InviteAFriend_AddFriends(strId)
{var e=document.getElementsByName("friendsToInvite");var selected=new Array();for(i=0;i<e.length;i++)
{if(e[i].checked)
{selected.push(e[i].value);}}
if(selected.length==0)
{alert(g_resxStrings.SelectAFriend);return;}
document.getElementById("resultMsg"+strId).innerHTML=g_resxStrings.Adding;var fnInviteAFriendResult=function(jsonResult)
{document.getElementById("resultMsg"+strId).innerHTML=jsonResult.resultHtml;if(jsonResult.bSuccess)
{g_splashScreen.OnSuccess();if(g_strFirstLoginRefLink)
{ShowAddFriendsSuccessSplashScreen("true",null);}
else
{ShowAddFriendsSuccessSplashScreen("false",null);}}}
var strLink=Link("ajax.aspx",["fn","invite_a_friend_add_friends"]);var postInputArray=['selected',selected];ajaxCall(strLink,fnInviteAFriendResult,postInputArray);}
function Show(section)
{ReplaceAllButOne("show","hidden",section,"show");}
function ReplaceAllButOne(classId,normalClass,elementId,specialClass){var elementList=getElementsByClass(classId);for(var i=0;i<elementList.length;i++){elementList[i].className=normalClass;}
var uniqueElement=document.getElementById(elementId);if(uniqueElement){uniqueElement.className=specialClass;}}
function getElementsByClass(searchClass)
{var classElements=new Array();var node=document;var tag='*';var els=node.getElementsByTagName(tag);var elsLen=els.length;var pattern=new RegExp('(^|\\s)'+searchClass+'(\\s|$)');for(i=0,j=0;i<elsLen;i++)
{if(pattern.test(els[i].className))
{classElements[j]=els[i];j++;}}
return classElements;}
function toggleDisplay(elementId)
{if(document.getElementById(elementId).style.display=="block")
{document.getElementById(elementId).style.display="none";}
else
{document.getElementById(elementId).style.display="block";}}
var g_clickedPromoElement;function editPromoInWindow(promoElement,promoId)
{g_clickedPromoElement=promoElement;var editPromoUrl=Link("controlPanel/marketingPromo.aspx",["promo",promoId,"popup","true"]);var win=window.open(editPromoUrl,"EditPromo","resizable=yes,scrollbars=yes,width=1000,height=700,status=yes");if(win!=null)
win.focus();}
function OnHoverGenreCategory(categoryIndex,numOfCategories)
{document.getElementById('genreSelectorBG').className='genreSelectorBG'+categoryIndex.toString();for(var i=0;i<numOfCategories;i++)
{var theDiv=document.getElementById("genreCategoryDiv_"+i.toString());if(categoryIndex==i)
{theDiv.style.display='block';}
else
{theDiv.style.display='none';}}}
function Paginate(formName,paginationStart)
{document.getElementById("paginationStart").value=paginationStart;document.getElementById(formName).submit();}
function searchInput(submit){var searchValue=document.getElementById('searchInput');if(searchValue.value==g_resxStrings.SearchBarTerms){searchValue.value="";}else if(!submit&&searchValue.value==""){searchValue.value=g_resxStrings.SearchBarTerms;}
if(submit==true){document.getElementById('searchForm').submit();return false;}}
function HtmlEncode(strString)
{var div=document.createElement('div');var text=document.createTextNode(strString);div.appendChild(text);return div.innerHTML;}
function EnsureGuestTracking()
{var fnAjaxCallback=function(){}
var strLink=Link("ajax.aspx",["fn","ensure_guest_tracking"]);ajaxCall(strLink,fnAjaxCallback);}
function ViewPollProject(strProjectId)
{new SplashScreen(LinkSmart("ajax.aspx",["fn","view_poll_project","project_id",strProjectId]),"500px",null,null);}
function GetValueFromCheckedRadio(strRadioGroupName)
{var aRadios=document.getElementsByName(strRadioGroupName);for(var i=0;i<aRadios.length;i++)
{if(aRadios[i].checked)
{return aRadios[i].value;}}
return"";}
var g_scroller;function Scroller(){}
Scroller.prototype.GetScrolledRegionClientSize=function(){}
Scroller.prototype.GetScrolledRegionOffsetStart=function(){}
Scroller.prototype.GetItemSize=function(oItem){}
Scroller.prototype.GetItemOffsetStart=function(oItem){}
Scroller.prototype.InitScroller=function(bHideArrowsWhenNoScroll)
{var _this=this;_this.m_bHideArrowsWhenNoScroll=bHideArrowsWhenNoScroll;_this.m_scrolledRegion=document.getElementById('scrolledRegion');_this.m_scrolledContent=document.getElementById('scrolledContent');_this.m_scrollerNext=document.getElementById('scroller-next');_this.m_scrollerPrev=document.getElementById('scroller-previous');_this.m_jumpNext=document.getElementById('jump-next');_this.m_jumpPrev=document.getElementById('jump-previous');_this.m_endTop=document.getElementById('end-top');_this.m_endBottom=document.getElementById('end-bottom');var StartScrollPrevious=function(){_this.m_timer=window.setInterval("g_scroller.ScrollPreviousStep();",10);}
var StartScrollNext=function(){_this.m_timer=window.setInterval("g_scroller.ScrollNextStep();",10);}
var EndScroll=function(){window.clearInterval(_this.m_timer);}
var OnMouseOutPrevious=function(){EndScroll();_this.EnableDisableNextPrev(true);}
var OnMouseOutNext=function(){EndScroll();_this.EnableDisableNextPrev(true);}
var OnMouseOverPrevious=function(){if(_this.m_scrollerPrev.className=="enabled")_this.m_scrollerPrev.className="hover";}
var OnMouseOverNext=function(){if(_this.m_scrollerNext.className=="enabled")_this.m_scrollerNext.className="hover";}
var CancelBubble=function(e){e=GetEvent(e);e.cancelBubble=true;}
AttachEvent(_this.m_scrollerPrev,"mousedown",StartScrollPrevious);AttachEvent(_this.m_scrollerPrev,"mouseup",EndScroll);AttachEvent(_this.m_scrollerPrev,"mouseout",OnMouseOutPrevious);AttachEvent(_this.m_scrollerPrev,"mouseover",OnMouseOverPrevious);if(_this.m_jumpPrev)
{var JumpPrevious=function(){_this.DoScrollStep(-300);}
AttachEvent(_this.m_jumpPrev,"click",JumpPrevious);AttachEvent(_this.m_jumpPrev,"mousedown",CancelBubble);}
AttachEvent(_this.m_scrollerNext,"mousedown",StartScrollNext);AttachEvent(_this.m_scrollerNext,"mouseup",EndScroll);AttachEvent(_this.m_scrollerNext,"mouseout",OnMouseOutNext);AttachEvent(_this.m_scrollerNext,"mouseover",OnMouseOverNext);if(_this.m_jumpNext)
{var JumpNext=function(){_this.DoScrollStep(300);}
AttachEvent(_this.m_jumpNext,"click",JumpNext);AttachEvent(_this.m_jumpNext,"mousedown",CancelBubble);}
if(_this.m_endTop)
{var GoToTop=function(){_this.SetScrollStart(0);_this.EnableDisableNextPrev(false);}
AttachEvent(_this.m_endTop,"click",GoToTop);AttachEvent(_this.m_endTop,"mousedown",CancelBubble);}
if(_this.m_endBottom)
{var GoToBottom=function(){_this.SetScrollStart(9999999);_this.EnableDisableNextPrev(false);}
AttachEvent(_this.m_endBottom,"click",GoToBottom);AttachEvent(_this.m_endBottom,"mousedown",CancelBubble);}
_this.SetScrollStart(0);_this.EnableDisableNextPrev(false);}
Scroller.prototype.ScrollNextStep=function()
{var _this=this;_this.DoScrollStep(15);}
Scroller.prototype.ScrollPreviousStep=function()
{var _this=this;_this.DoScrollStep(-15);}
Scroller.prototype.EnableDisableNextPrev=function(bClearHover)
{var _this=this;var bCanScrollNext=_this.CanScrollNext();var bCanScrollPrev=_this.CanScrollPrevious();if(_this.m_bHideArrowsWhenNoScroll&&!bCanScrollNext&&!bCanScrollPrev)
{_this.m_scrollerNext.className="hidden";_this.m_scrollerPrev.className="hidden";}
else
{var scrollerNextClassName=_this.m_scrollerNext.className;if(bCanScrollNext)
{if(scrollerNextClassName!="hover"||(scrollerNextClassName=="hover"&&bClearHover))
{if(scrollerNextClassName!="enabled")_this.m_scrollerNext.className="enabled";}}
else
{if(scrollerNextClassName!="disabled")_this.m_scrollerNext.className="disabled";}
var scrollerPrevClassName=_this.m_scrollerPrev.className;if(bCanScrollPrev)
{if(scrollerPrevClassName!="hover"||(scrollerPrevClassName=="hover"&&bClearHover))
{if(scrollerPrevClassName!="enabled")_this.m_scrollerPrev.className="enabled";}}
else
{if(scrollerPrevClassName!="disabled")_this.m_scrollerPrev.className="disabled";}}}
Scroller.prototype.CanScrollNext=function()
{var _this=this;return(_this.GetScrollStart()+_this.GetScrolledRegionClientSize()<_this.GetScrollSize());}
Scroller.prototype.CanScrollPrevious=function()
{var _this=this;return(_this.GetScrollStart()>0);}
Scroller.prototype.DoScrollStep=function(iDiff)
{var _this=this;_this.SetScrollStart(_this.GetScrollStart()+iDiff);_this.EnableDisableNextPrev(false);}
Scroller.prototype.GetOffsetStartBase=function()
{var _this=this;if(g_bIsIE)
{return 0;}
else
{return _this.GetScrolledRegionOffsetStart();}}
Scroller.prototype.ItemIsInFullView=function(oItem)
{var _this=this;var iItemStart=_this.GetItemOffsetStart(oItem)-_this.GetOffsetStartBase();var iItemEnd=iItemStart+_this.GetItemSize(oItem);return(iItemStart-_this.GetScrollStart()>0&&iItemEnd-_this.GetScrollStart()<_this.GetScrolledRegionClientSize());}
Scroller.prototype.ScrollToItem=function(oItem)
{var _this=this;if(oItem)
{if(typeof oItem=="string")
{oItem=document.getElementById(oItem);}
if(oItem&&!_this.ItemIsInFullView(oItem))
{_this.SetScrollStart(_this.GetItemOffsetStart(oItem)-_this.GetOffsetStartBase());_this.EnableDisableNextPrev(false);}}}
VScroller.prototype=new Scroller();function VScroller(bHideArrowsWhenNoScroll)
{var _this=this;_this.InitScroller(bHideArrowsWhenNoScroll);}
VScroller.prototype.GetScrolledRegionClientSize=function()
{var _this=this;return _this.m_scrolledRegion.clientHeight;}
VScroller.prototype.GetScrolledRegionOffsetStart=function()
{var _this=this;return _this.m_scrolledRegion.offsetTop;}
VScroller.prototype.GetItemSize=function(oItem)
{var _this=this;return oItem.offsetHeight;}
VScroller.prototype.GetItemOffsetStart=function(oItem)
{var _this=this;return oItem.offsetTop;}
VScroller.prototype.GetScrollStart=function()
{var _this=this;return _this.m_scrolledRegion.scrollTop;}
VScroller.prototype.SetScrollStart=function(iVal)
{var _this=this;_this.m_scrolledRegion.scrollTop=iVal;}
VScroller.prototype.GetScrollSize=function()
{var _this=this;return _this.m_scrolledRegion.scrollHeight;}
var g_writingUI;var g_timers=[];function WritingUI(){}
WritingUI.prototype.InitWritingUI=function()
{var _this=this;g_inviteAFriend=_this;InitViewTracker();if(!_this.currentlySelectedBaseId)
{_this.SetCurrentlySelectedBaseId("");}
if(!_this.currentlySelectedTextId)
{_this.SetCurrentlySelectedTextId("");}
_this.InitStructuredFeedback();}
WritingUI.prototype.GetMainState=function()
{var _this=this;var mainState=document.getElementById('main_state');if(mainState)
{return mainState.innerHTML;}
else return null;}
WritingUI.prototype.LoadHTMLContent_WritingUI=function(strId,strHTML,fnAfterLoadHTMLContent)
{var _this=this;var bCalledTheCallbackFn=_this.BeforeLoadHTMLContent(strId,strHTML,fnAfterLoadHTMLContent);LoadHTMLContent(strId,strHTML);if(!bCalledTheCallbackFn&&fnAfterLoadHTMLContent!=null)
{fnAfterLoadHTMLContent();}}
WritingUI.prototype.IsLeavingPage=function(strReloadId,strLeavingState)
{var _this=this;var oReloadElement=document.getElementById(strReloadId);var oMainStateElement=document.getElementById('main_state');if(oReloadElement&&oMainStateElement&&_this.GetMainState()==strLeavingState&&oReloadElement.contains(oMainStateElement))
{return true;}
return false;}
WritingUI.prototype.BeforeLoadHTMLContent=function(strId,strHTML,fnAfterLoadHTMLContent)
{var _this=this;if(_this.IsLeavingPage(strId,"edit"))
{_this.PostEdits('fn_save',fnAfterLoadHTMLContent,true,false);_this.m_bCanAutoSave=false;var fnAfterLoadHTMLContent2=function(){}
_this.LoadHTMLContent_WritingUI('details',"",fnAfterLoadHTMLContent2);window.onbeforeunload="";if(tinyMCE.get("cycleText_display"))
{tinyMCE.execCommand("mceRemoveControl",true,"cycleText_display");}
return true;}
if(_this.IsLeavingPage(strId,"feedback"))
{document.getElementById('details').innerHTML="";}
if(_this.IsLeavingPage(strId,"book_central"))
{_this.UnLoadBookCentral();}
return false;}
WritingUI.prototype.OnClickGeneralChatForum=function()
{var _this=this;if(document.getElementById("forumsContent"))
{var fnLoadForums=function(strResult)
{var fnAfterLoadHTMLContent=function(){}
_this.LoadHTMLContent_WritingUI('forumsContent',strResult,fnAfterLoadHTMLContent);}
ajaxCall(Link("ajax.aspx",["fn","get_chat_forum","id",_this.m_strProjectId]),fnLoadForums);}}
WritingUI.prototype.OnClickBackgroundForum=function()
{var _this=this;if(document.getElementById("forumsContent"))
{var fnLoadForums=function(strResult)
{var fnAfterLoadHTMLContent=function(){}
_this.LoadHTMLContent_WritingUI('forumsContent',strResult,fnAfterLoadHTMLContent);}
ajaxCall(Link("ajax.aspx",["fn","get_background_forum","id",_this.m_strProjectId]),fnLoadForums);}}
WritingUI.prototype.OnClickShowWordCount=function()
{var _this=this;_this.m_bIsShowingWordCount=true;ShowWordCount(GetTextareaContent_PlainText(_this.GetMainTextareaId()),document.getElementById("wordCount"));document.getElementById("showWordCountLink").style.display="none";document.getElementById("showWordCountDisplay").style.display="";}
WritingUI.prototype.InitTinyMCE=function(onInitCallback,strHandleEventCallbackFn)
{var strDefaultDirection="ltr";var strCurrentLanguage="en";if(g_resxStrings.UIDirection=="RTL")
{strDefaultDirection="rtl";strCurrentLanguage="he";}
tinyMCE.init({language:strCurrentLanguage,mode:"none",theme:"advanced",plugins:"print,spellchecker,paste,directionality",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,|,ltr,rtl,|,fontselect,fontsizeselect",theme_advanced_buttons2:"cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,pastetext,pasteword,|,image,|,spellchecker,print",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",handle_event_callback:strHandleEventCallbackFn,spellchecker_languages:"+English=en,French=fr,German=de,Spanish=es",init_instance_callback:onInitCallback,paste_remove_styles:false,directionality:strDefaultDirection});}
WritingUI.prototype.UpdateTinyMCEWordCount=function(e)
{var _this=this;if(_this.m_bIsShowingWordCount)
{_this.m_bIsShowingWordCount=false;document.getElementById("showWordCountDisplay").style.display="none";document.getElementById("showWordCountLink").style.display="";}}
WritingUI.prototype.Edit=function(strBaseId,strTextId)
{var _this=this;_this.m_bCanAutoSave=true;var fnLoadEditPage=function(strResult)
{var fnAfterLoadHTMLContent1=function()
{_this.SetCurrentlySelectedBaseId(strBaseId);_this.RetrieveTextIdIfExists();_this.InitTinyMCE(function(){_this.OnInitTinyMCE()},"g_writingUI.UpdateTinyMCEWordCount");tinyMCE.execCommand("mceAddControl",true,"cycleText_display");g_timers.push(window.setInterval("g_writingUI.AutoSave("+g_timers.length+");",60000));window.onbeforeunload=function()
{_this.PostEdits("fn_save",null,false,false);}
if(_this.currentlySelectedTextId!="")
{_this.LoadFeedbackUI();}}
_this.LoadHTMLContent_WritingUI('project-main-display',strResult,fnAfterLoadHTMLContent1);}
var inputArray=["fn","fn_edit","p",_this.m_strProjectId,"submissionBaseId",strBaseId,"submissionTextId",strTextId];var strLink=Link("ajax.aspx",inputArray);ajaxCall(strLink,fnLoadEditPage);}
WritingUI.prototype.AutoSave=function(iTimerIndex)
{var _this=this;var textArea=document.getElementById('cycleText_display');if(!textArea||!_this.m_bCanAutoSave)
{window.clearTimeout(g_timers[iTimerIndex]);}
else
{_this.PostEdits("fn_save",null,false,false);}}
WritingUI.prototype.PostEdits=function(strFn,callbackFunction,bSkipUpdatingSelectedTextId,bManualSaveOrSubmit)
{var _this=this;if(!_this.m_bIsPostingEdits)
{_this.m_bIsPostingEdits=true;var strBaseId=_this.currentlySelectedBaseId;var strTextId=_this.currentlySelectedTextId;var fnPostEditsReturn=function(oResult)
{var oLastSave=document.getElementById('lastSave');if(oLastSave)
{if(bManualSaveOrSubmit)
{var oHiddenSaveIndicator=document.getElementById('hiddenSaveIndicator');if(oHiddenSaveIndicator)
{oHiddenSaveIndicator.innerHTML=oResult.lastSaved;oHiddenSaveIndicator.style.display="";}}
oLastSave.innerHTML=oResult.lastSaved;oLastSave.className="lastSaveNotification";window.setTimeout("g_writingUI.EndSaveNotification();",3000);}
if(oResult.baseId)
{_this.SetCurrentlySelectedBaseId(oResult.baseId);}
if(bSkipUpdatingSelectedTextId!==true&&oResult.textId)
{_this.SetCurrentlySelectedTextId(oResult.textId);}
if(strFn=="fn_submit")
{_this.LoadFeedbackItem(_this.currentlySelectedTextId);}
_this.m_bIsPostingEdits=false;if(callbackFunction!=undefined&&callbackFunction!=null)
{callbackFunction();}}
var inputArray=["fn",strFn,"p",_this.m_strProjectId,"submissionBaseId",strBaseId,"submissionTextId",strTextId];var strLink=Link("ajax.aspx",inputArray);var strTextareaText=_this.GetTextareaContent('cycleText_display');if(_this.IsValidInput(strTextareaText))
{var postInputArray=['cycleText',strTextareaText];postInputArray=postInputArray.concat(_this.GetPostEditInputs());ajaxCall(strLink,fnPostEditsReturn,postInputArray);}
else
{_this.m_bIsPostingEdits=false;if(callbackFunction!=undefined&&callbackFunction!=null)
{callbackFunction();}}}
else
{if(callbackFunction!=undefined&&callbackFunction!=null)
{callbackFunction();}}}
WritingUI.prototype.GetTextareaContent=function(strTextareaId)
{var _this=this;try
{return tinyMCE.get(strTextareaId).getContent();}
catch(e)
{return null;}}
WritingUI.prototype.EndSaveNotification=function()
{var _this=this;var oLastSave=document.getElementById('lastSave');if(oLastSave)
{oLastSave.className="";}
var oHiddenSaveIndicator=document.getElementById('hiddenSaveIndicator');if(oHiddenSaveIndicator)
{oHiddenSaveIndicator.style.display="none";}}
WritingUI.prototype.IsValidInput=function(strInput)
{var _this=this;return(strInput&&typeof(strInput)=="string"&&strInput!=null&&strInput.trim().toLowerCase()!="undefined");}
WritingUI.prototype.GetPostEditInputs=function()
{var _this=this;return[];}
WritingUI.prototype.LoadFeedbackItem=function(strTextId,fnAfterLoadFeedbackItem)
{var _this=this;var fnLoadFeedbackPage=function(strResult)
{var fnAfterLoadHTMLContent1=function()
{_this.SetCurrentlySelectedTextId(strTextId);_this.RetrieveBaseIdIfExists();if(strTextId!="")
{_this.LoadFeedbackUI();g_ViewTracker.TrackView(_this.m_strProjectId,"submission",strTextId,true,false,3);}
if(fnAfterLoadFeedbackItem)
{fnAfterLoadFeedbackItem();}}
_this.LoadHTMLContent_WritingUI('project-main-display',strResult,fnAfterLoadHTMLContent1);}
var inputArray=["fn","load_feedback_item","p",_this.m_strProjectId,"submissionTextId",strTextId];var strLink=Link("ajax.aspx",inputArray);ajaxCall(strLink,fnLoadFeedbackPage);}
WritingUI.prototype.LoadFeedbackUI=function()
{var _this=this;var fnLoadFeedback=function(strHtml)
{var fnAfterLoadHTMLContent2=function()
{_this.InitStructuredFeedback();}
_this.LoadHTMLContent_WritingUI('details',strHtml,fnAfterLoadHTMLContent2);}
var inputArray=["fn","load_feedback_ui","p",_this.m_strProjectId,"feedbackedType",_this.GetFeedbackedType(),"feedbackedId",_this.GetFeedbackedId()];var strLink=Link("ajax.aspx",inputArray);ajaxCall(strLink,fnLoadFeedback);}
WritingUI.prototype.InitStructuredFeedback=function()
{var _this=this;if(g_structuredFeedbackFields)
{InitWordCounterForMultipleTextareas(_this.GetStructuredFeedbackTextareaIds());if(!_this.checkmarkTimer!=null)
{window.clearInterval(_this.checkmarkTimer);_this.checkmarkTimer=null;}
var fnUpdate=function()
{for(var i=0;i<g_structuredFeedbackFields.length;i++)
{var oTextarea=document.getElementById("feedbackText_"+g_structuredFeedbackFields[i]);if(oTextarea)
{var oCheckmark=document.getElementById("feedbackCheckmark_"+g_structuredFeedbackFields[i]);if(oTextarea.value!="")
{oCheckmark.style.visibility="";}
else
{oCheckmark.style.visibility="hidden";}}}}
fnUpdate();_this.checkmarkTimer=window.setInterval(fnUpdate,1000);}}
WritingUI.prototype.GetStructuredFeedbackTextareaIds=function()
{var _this=this;var aTextareaIds=[];for(var i=0;i<g_structuredFeedbackFields.length;i++)
{aTextareaIds.push("feedbackText_"+g_structuredFeedbackFields[i]);}
return aTextareaIds;}
WritingUI.prototype.SubmitFeedback=function(strFeedbackedType,strFeedbackedId)
{var _this=this;var postInputArray=[];var bFoundAtLeastOne=false;for(var i=0;i<g_structuredFeedbackFields.length;i++)
{var oTextarea=document.getElementById("feedbackText_"+g_structuredFeedbackFields[i]);var strText=oTextarea.value;if(strText.trim()!="")
{bFoundAtLeastOne=true;postInputArray.push("feedbackField");postInputArray.push(g_structuredFeedbackFields[i]);postInputArray.push(g_structuredFeedbackFields[i]);postInputArray.push(strText);}}
if(!bFoundAtLeastOne)
{alert(g_resxStrings.NoBlankFeedback);return;}
else if(!_this.m_bIsSubmittingFeedback)
{_this.m_bIsSubmittingFeedback=true;var fnLoadFeedback=function(strResult)
{for(var i=0;i<g_structuredFeedbackFields.length;i++)
{_this.ClearArea("feedbackText_"+g_structuredFeedbackFields[i]);}
_this.LoadDiscussionContent('feedback');_this.m_bIsSubmittingFeedback=false;}
var strLink=Link("ajax.aspx",["fn","submit_feedback","p",_this.m_strProjectId,"feedbackedType",strFeedbackedType,"feedbackedId",strFeedbackedId]);ajaxCall(strLink,fnLoadFeedback,postInputArray);}}
WritingUI.prototype.CancelFeedback=function()
{var _this=this;var onSuccess=function()
{for(var i=0;i<g_structuredFeedbackFields.length;i++)
{document.getElementById("feedbackText_"+g_structuredFeedbackFields[i]).value="";}}
WEbookConfirm(g_resxStrings.CancelFeedbackAreYouSure,onSuccess,null);}
WritingUI.prototype.RemoveFeedbackPost=function(strFeedbackedType,strCommentId)
{var _this=this;var onSuccess=function()
{var fnLoadRemoveFeedback=function()
{var removed=document.getElementById("Comment_"+strCommentId);removed.parentNode.removeChild(removed);}
var strLink=Link("ajax.aspx",["fn","remove_feedback","feedbackedType",strFeedbackedType,"commentId",strCommentId]);ajaxCall(strLink,fnLoadRemoveFeedback);}
WEbookConfirm(g_resxStrings.DeleteCommentAreYouSure,onSuccess,null);}
WritingUI.prototype.OnClickFeedbackField=function(strFieldId)
{var _this=this;for(var i=0;i<g_structuredFeedbackFields.length;i++)
{document.getElementById("feedbackField_"+g_structuredFeedbackFields[i]).className="";document.getElementById("feedbackText_"+g_structuredFeedbackFields[i]).style.display="none";}
document.getElementById("feedbackField_"+strFieldId).className="selectedFeedbackField";document.getElementById("feedbackText_"+strFieldId).style.display="";}
WritingUI.prototype.ShowComplimentUI=function(strComplimentedCommentId)
{document.getElementById("leaveComplimentText_"+strComplimentedCommentId).style.display="none";document.getElementById("leaveComplimentUI_"+strComplimentedCommentId).style.display="";}
WritingUI.prototype.SubmitCompliment=function(strFeedbackedType,strComplimentedCommentId,strComplimentType)
{var _this=this;if(!_this["m_bIsSubmittingCompliment"+strComplimentedCommentId])
{_this["m_bIsSubmittingCompliment"+strComplimentedCommentId]=true;var fnLoad=function(strResult)
{var fnAfterLoadHTMLContent=function(){}
_this.LoadHTMLContent_WritingUI('complimentDisplay-'+strComplimentedCommentId,strResult,fnAfterLoadHTMLContent);}
var strLink=Link("ajax.aspx",["fn","submit_compliment","p",_this.m_strProjectId,"feedbackedType",strFeedbackedType,"complimentedCommentId",strComplimentedCommentId,"complimentType",strComplimentType]);ajaxCall(strLink,fnLoad);}}
WritingUI.prototype.MouseOverCompliment=function(oCompliment)
{oCompliment.style.border="2px solid #336699";}
WritingUI.prototype.MouseOutCompliment=function(oCompliment)
{oCompliment.style.border="2px solid #f1f5f9";}
WritingUI.prototype.ClearArea=function(strAreaId)
{var _this=this;document.getElementById(strAreaId).value="";UpdateWordCountBar(strAreaId,"");}
WritingUI.prototype.MouseOverStar=function(iStarNum)
{var _this=this;var strFullStar="star_full";if(_this.m_bProjectIsInVotingOrPending)
{strFullStar="star_full_green";}
for(var i=1;i<=iStarNum;i++)
{document.getElementById("interactiveStar"+i).className="ratingStar "+strFullStar;}
for(var i=iStarNum+1;i<=5;i++)
{document.getElementById("interactiveStar"+i).className="ratingStar star_empty";}}
WritingUI.prototype.MouseOutStars=function(aInitState)
{var _this=this;var strFullStar="star_full";if(_this.m_bProjectIsInVotingOrPending)
{strFullStar="star_full_green";}
var iPreviousRating=new Number(document.getElementById("previousRating").innerHTML);for(var i=1;i<=5;i++)
{var strInitState;if(i<=iPreviousRating)
{strInitState=strFullStar;}
else
{strInitState="star_empty";}
document.getElementById("interactiveStar"+i).className="ratingStar "+strInitState;}}
WritingUI.prototype.SubmitRating=function(strFeedbackedType,strFeedbackedId,ratingNumber)
{var _this=this;if(!_this.m_bIsSubmittingRating)
{_this.m_bIsSubmittingRating=true;document.getElementById("previousRating").innerHTML=ratingNumber;var strRatingId=document.getElementById('ratingId').innerHTML;var fnLoadRating=function(resultJson)
{document.getElementById('ratingId').innerHTML=resultJson.ratingId;if(document.getElementById('avgRating1-container'))
{document.getElementById('avgRating1').innerHTML=resultJson.averageRating;document.getElementById('avgRating1-container').style.display="";}
_this.ToggleSubmitRatingUI();_this.m_bIsSubmittingRating=false;}
var strLink=Link("ajax.aspx",["fn","submit_rating","p",_this.m_strProjectId,"feedbackedType",strFeedbackedType,"feedbackedId",strFeedbackedId,"ratingNumber",ratingNumber,"ratingId",strRatingId]);ajaxCall(strLink,fnLoadRating);}}
WritingUI.prototype.ToggleSubmitRatingUI=function()
{var _this=this;var submitRatingUI=document.getElementById("submitRatingUI");var ratingSubmitted=document.getElementById("ratingSubmitted");if(submitRatingUI.className=="hidden"){submitRatingUI.className="";}else{submitRatingUI.className="hidden";}
if(ratingSubmitted.className=="hidden"){ratingSubmitted.className="";}else{ratingSubmitted.className="hidden";}}
WritingUI.prototype.SubmitVote=function(strElemId,iVote)
{var _this=this;if(!_this.m_bIsSubmittingVote)
{_this.m_bIsSubmittingVote=true;document.getElementById(strElemId).style.border="2px solid #336699";var fnLoadVote=function(resultJson)
{if(document.getElementById('voteSummary1-container'))
{document.getElementById('voteSummary1').innerHTML=resultJson.votingDisplay;document.getElementById('voteSummary1-container').style.display="";}
if(document.getElementById('voteSummary2-container'))
{document.getElementById('voteSummary2').innerHTML=resultJson.votingDisplay;document.getElementById('voteSummary2-container').style.display="";}
document.getElementById('submitVoteUI').className="hidden";document.getElementById('voteSubmitted').className="";_this.m_bIsSubmittingVote=false;}
var strLink=Link("ajax.aspx",["fn","submit_vote","p",_this.m_strProjectId,"vote",iVote]);ajaxCall(strLink,fnLoadVote);}}
WritingUI.prototype.OnInitTinyMCE=function()
{var _this=this;_this.UpdateTinyMCEWordCount({type:"keypress"});}
WritingUI.prototype.RetrieveTextIdIfExists=function()
{var _this=this;var textIdDiv=document.getElementById('cycle_text_id');if(textIdDiv)
{_this.SetCurrentlySelectedTextId(textIdDiv.innerHTML);}
else
{_this.SetCurrentlySelectedTextId("");}}
WritingUI.prototype.RetrieveBaseIdIfExists=function()
{var _this=this;var baseIdDiv=document.getElementById('cycle_base_id');if(baseIdDiv)
{_this.SetCurrentlySelectedBaseId(baseIdDiv.innerHTML);}
else
{_this.SetCurrentlySelectedBaseId("");}}
WritingUI.prototype.GetFeedbackedType=function()
{var _this=this;if(_this.currentlySelectedTextId==""||_this.currentlySelectedTextId==null||_this.m_bProjectIsInVotingOrPending)
{return"feedback_type_project";}
else
{return"feedback_type_submission";}}
WritingUI.prototype.GetFeedbackedId=function()
{var _this=this;if(_this.currentlySelectedTextId==""||_this.currentlySelectedTextId==null||_this.m_bProjectIsInVotingOrPending)
{return _this.m_strProjectId;}
else
{return _this.currentlySelectedTextId;}}
WritingUI.prototype.LoadDiscussionContent=function(strSelectedContent)
{var _this=this;var fnLoadDiscussionContent=function(strResult)
{var fnAfterLoadHTMLContent=function(){}
_this.LoadHTMLContent_WritingUI('discussionContent',strResult,fnAfterLoadHTMLContent);}
var strLink=Link("ajax.aspx",["fn","load_discussion_content","p",_this.m_strProjectId,"feedbackedType",_this.GetFeedbackedType(),"feedbackedId",_this.GetFeedbackedId(),"submissionBaseId",_this.currentlySelectedBaseId,"selectedContent",strSelectedContent]);ajaxCall(strLink,fnLoadDiscussionContent);}
WritingUI.prototype.GetDestinationUrl=function()
{var _this=this;return'';}
WritingUI.prototype.GetMainTextareaId=function()
{var _this=this;return"cycleText_display";}
WritingUI.prototype.StartingNotOnBookCentral=function()
{var _this=this;_this.UnLoadBookCentral();}
WritingUI.prototype.UnLoadBookCentral=function()
{var _this=this;document.getElementById("project-overview-small").style.display="";document.getElementById("bookInfoDisplay").style.display="none";document.getElementById("backToBookHomeLink").style.display="";document.getElementById("bookSpecificLeftNav").style.display="";var oWriteAndReviseRightColumn=document.getElementById("writeAndReviseRightColumn");if(oWriteAndReviseRightColumn)
{oWriteAndReviseRightColumn.style.display="";}
var fnAfterLoadHTMLContent2=function(){}
_this.LoadHTMLContent_WritingUI('details',"",fnAfterLoadHTMLContent2);}
WritingUI.prototype.LoadBookCentral=function(fnAfterLoadBookCentral)
{var _this=this;var fnLoadBookCentral=function(strResult)
{var fnAfterLoadHTMLContent=function()
{_this.SetCurrentlySelectedTextId("");_this.SetCurrentlySelectedBaseId("");document.getElementById("project-overview-small").style.display="none";document.getElementById("bookInfoDisplay").style.display="";document.getElementById("backToBookHomeLink").style.display="none";document.getElementById("bookSpecificLeftNav").style.display="none";var oWriteAndReviseRightColumn=document.getElementById("writeAndReviseRightColumn");if(oWriteAndReviseRightColumn)
{oWriteAndReviseRightColumn.style.display="none";}
_this.LoadFeedbackUI();if(fnAfterLoadBookCentral)
{fnAfterLoadBookCentral();}}
_this.LoadHTMLContent_WritingUI('project-main-display',strResult,fnAfterLoadHTMLContent);}
var inputArray=["fn","load_project_overview","p",_this.m_strProjectId,"mode","full"];var strLink=Link("ajax.aspx",inputArray);ajaxCall(strLink,fnLoadBookCentral);}
WritingUI.prototype.LoadBookOverviewPod=function()
{var _this=this;var fnLoadBookCentral=function(strResult)
{var fnAfterLoadHTMLContent=function(){}
_this.LoadHTMLContent_WritingUI('project-overview-small',strResult,fnAfterLoadHTMLContent);}
var inputArray=["fn","load_project_overview","p",_this.m_strProjectId,"mode","small"];var strLink=Link("ajax.aspx",inputArray);ajaxCall(strLink,fnLoadBookCentral);}
WritingUI.prototype.OnMouseOverItem=function(oItem){}
WritingUI.prototype.OnMouseOutItem=function(oItem){}
WritingUI.prototype.HighlightListItem=function(oListItem)
{var _this=this;if(oListItem)
{oListItem.className='listItemDisplayOn';}}
WritingUI.prototype.UnHighlightListItem=function(oListItem)
{var _this=this;if(oListItem)
{oListItem.className='listItemDisplay';}}
WritingUI.prototype.OnSelectTextId=function(strTextId){}
WritingUI.prototype.OnUnSelectTextId=function(strTextId){}
WritingUI.prototype.SetCurrentlySelectedTextId=function(strTextId)
{var _this=this;if(_this.currentlySelectedTextId!=strTextId)
{if(_this.currentlySelectedTextId)
{_this.OnUnSelectTextId(_this.currentlySelectedTextId);}
_this.currentlySelectedTextId=strTextId;if(_this.currentlySelectedTextId)
{_this.OnSelectTextId(_this.currentlySelectedTextId);}}}
WritingUI.prototype.OnSelectBaseId=function(strBaseId){}
WritingUI.prototype.OnUnSelectBaseId=function(strBaseId){}
WritingUI.prototype.SetCurrentlySelectedBaseId=function(strBaseId)
{var _this=this;if(_this.currentlySelectedBaseId!=strBaseId)
{if(_this.currentlySelectedBaseId)
{_this.OnUnSelectBaseId(_this.currentlySelectedBaseId);}
_this.currentlySelectedBaseId=strBaseId;if(_this.currentlySelectedBaseId)
{_this.OnSelectBaseId(_this.currentlySelectedBaseId);}}}
WritingUI.prototype.SendToLogin=function()
{var _this=this;window.location=LinkSecure("login.aspx",["ref",_this.GetDestinationUrl()]);}
WritingUI.prototype.SendToRegister=function()
{var _this=this;window.location=LinkSecure("register.aspx",["ref",_this.GetDestinationUrl()]);}
WritingUI.prototype.RemoveSubmission=function(){}
var g_wizard=null;function Wizard(){}
Wizard.prototype.Back=function()
{var _this=this;_this.Navigate(_this.m_iCurrentPaneIndex-1);}
Wizard.prototype.Next=function()
{var _this=this;_this.Navigate(_this.m_iCurrentPaneIndex+1);}
Wizard.prototype.Close=function(param)
{var _this=this;var fnSuccessCallback=function()
{g_splashScreen.Close();g_wizard=null;}
_this.OnBeforeClose(param,fnSuccessCallback);}
Wizard.prototype.OnBeforeClose=function(param,fnSuccessCallback)
{var _this=this;fnSuccessCallback();}
Wizard.prototype.ShowPaneByPaneId=function(strPaneId)
{var _this=this;for(var i=0;i<_this.m_paneInfo.length;i++)
{if(_this.m_paneInfo[i].paneId==strPaneId)
{_this.Navigate(i);return;}}}
Wizard.prototype.UpdateButtonState=function(newPane)
{var _this=this;if(_this.m_iCurrentPaneIndex>0)
{document.getElementById("backButton").style.visibility="";}
else
{document.getElementById("backButton").style.visibility="hidden";}
if(_this.m_iCurrentPaneIndex<(_this.m_paneInfo.length-1))
{document.getElementById("nextButton").style.visibility="";}
else
{document.getElementById("nextButton").style.visibility="hidden";}
_this.UpdateWizardSpecificButtonState();_this.UpdateBreadcrumbs();}
Wizard.prototype.UpdateBreadcrumbs=function()
{var _this=this;if(_this.m_paneInfo[_this.m_iCurrentPaneIndex].breadcrumbId)
{var nextPane=_this.m_iCurrentPaneIndex+1;for(var i=0;i<_this.m_paneInfo.length;i++)
{if(_this.m_paneInfo[i].breadcrumbId)
{if(i==_this.m_iCurrentPaneIndex)
{document.getElementById(_this.m_paneInfo[i].breadcrumbId).className="selected";if(i==_this.m_paneInfo.length-1)
{document.getElementById("close").className="unSelected_future";}}
else if(i==nextPane)
{document.getElementById(_this.m_paneInfo[i].breadcrumbId).className="unSelected_future";if(i==_this.m_paneInfo.length-1)
{document.getElementById("close").className=" ";}}
else
{document.getElementById(_this.m_paneInfo[i].breadcrumbId).className="unSelected";}}}}}
Wizard.prototype.IsNavigatingForwardFrom=function(strPaneId,iOldPaneIndex,iNewPaneIndex)
{var _this=this;return(_this.m_paneInfo[iOldPaneIndex].paneId==strPaneId&&iOldPaneIndex<iNewPaneIndex);}
Wizard.prototype.IsNavigatingForwardTo=function(strPaneId,iOldPaneIndex,iNewPaneIndex)
{var _this=this;return(_this.m_paneInfo[iNewPaneIndex].paneId==strPaneId&&iOldPaneIndex<iNewPaneIndex);}
Wizard.prototype.IsNavigatingTo=function(strPaneId,iNewPaneIndex)
{var _this=this;return(_this.m_paneInfo[iNewPaneIndex].paneId==strPaneId);}
Wizard.prototype.IsNavigatingBackFrom=function(strPaneId,iOldPaneIndex,iNewPaneIndex)
{var _this=this;return(_this.m_paneInfo[iOldPaneIndex].paneId==strPaneId&&iOldPaneIndex>iNewPaneIndex);}
Wizard.prototype.IsNavigatingBackTo=function(strPaneId,iOldPaneIndex,iNewPaneIndex)
{var _this=this;return(_this.m_paneInfo[iNewPaneIndex].paneId==strPaneId&&iOldPaneIndex>iNewPaneIndex);}
Wizard.prototype.IsNavigatingFrom=function(strPaneId,iOldPaneIndex)
{var _this=this;return(_this.m_paneInfo[iOldPaneIndex].paneId==strPaneId);}
Wizard.prototype.IsOnPane=function(strPaneId)
{var _this=this;return(_this.m_paneInfo[_this.m_iCurrentPaneIndex].paneId==strPaneId);}
Wizard.prototype.InitTinyMCE=function()
{var _this=this;var strDefaultDirection="ltr";var strCurrentLanguage="en";if(g_resxStrings.UIDirection=="RTL")
{strDefaultDirection="rtl";strCurrentLanguage="he";}
tinyMCE.init({language:strCurrentLanguage,mode:"none",theme:"advanced",plugins:"print,spellchecker,paste,directionality",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,|,ltr,rtl,|,fontselect,fontsizeselect",theme_advanced_buttons2:"cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,pastetext,pasteword,|,image,|,spellchecker,print",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",spellchecker_languages:"+English=en,French=fr,German=de,Spanish=es",use_native_selects:true,paste_remove_styles:false,directionality:strDefaultDirection});}
var g_wizard=null;function OpenProjectReader(strProjectId,bShowOnlyDraftQueryLetters,strStartAtId)
{g_wizard=new ProjectReader(strProjectId,bShowOnlyDraftQueryLetters,strStartAtId);g_wizard.Init();}
ProjectReader.prototype=new Wizard();function ProjectReader(strProjectId,bShowOnlyDraftQueryLetters,strStartAtId)
{var _this=this;_this.m_strProjectId=strProjectId;_this.m_bShowOnlyDraftQueryLetters=bShowOnlyDraftQueryLetters;_this.m_strStartAtId=strStartAtId;}
ProjectReader.prototype.Init=function()
{var _this=this;InitViewTracker();var onLoadReader=function(json)
{_this.m_paneInfo=json;_this.m_iCurrentPaneIndex=0;_this.m_paneInfoHash={};for(var i=0;i<_this.m_paneInfo.length;i++)
{var oPane=_this.m_paneInfo[i];oPane.paneIndex=i;if(_this.IsSubmissionPane(oPane))
{if(oPane.bHtmlLoaded)
{oPane.htmlDomNode=document.getElementById(oPane.htmlContentId).firstChild;_this.RemoveHtmlContentDomNodeFromDoc(oPane);}
_this.m_paneInfoHash[_this.m_paneInfo[i].textId]=_this.m_paneInfo[i];}}
if(_this.m_strStartAtId!=null&&_this.m_strStartAtId!="")
{if(_this.m_strStartAtId=="overviewPane"||_this.m_strStartAtId=="queryLetterPane"||_this.m_strStartAtId=="projectSamplePane"||_this.m_strStartAtId=="authorBioPane")
{_this.ShowPaneByPaneId(_this.m_strStartAtId);}
else if(_this.m_paneInfoHash[_this.m_strStartAtId])
{_this.ShowSubmissionPaneByTextId(_this.m_strStartAtId);}}
else
{_this.Navigate(0);}
_this.ShowQueryLetter();_this.UpdateButtonState();}
new SplashScreen(Link("ajax.aspx",["fn","open_project_reader","project_id",_this.m_strProjectId,"bShowOnlyDraftQueryLetters",_this.m_bShowOnlyDraftQueryLetters,"height","600px"]),"746px",null,null,onLoadReader);}
ProjectReader.prototype.ShowSubmissionPaneByTextId=function(strSubmissionTextId)
{var _this=this;_this.Navigate(_this.m_paneInfoHash[strSubmissionTextId].paneIndex);}
ProjectReader.prototype.IsSubmissionPane=function(oPane)
{var _this=this;return(oPane.paneId.indexOf("submissionPane")==0);}
ProjectReader.prototype.RemoveHtmlContentDomNodeFromDoc=function(oPane)
{var _this=this;oPane.htmlDomNode.parentNode.removeChild(oPane.htmlDomNode);}
ProjectReader.prototype.AddHtmlContentDomNodeToDoc=function(oPane)
{var _this=this;document.getElementById(oPane.htmlContentId).innerHTML="";document.getElementById(oPane.htmlContentId).appendChild(oPane.htmlDomNode);}
ProjectReader.prototype.Navigate=function(iPaneIndex)
{var _this=this;if(!_this.m_bNavigating)
{_this.m_bNavigating=true;var curPane=_this.m_paneInfo[_this.m_iCurrentPaneIndex];if(_this.IsSubmissionPane(curPane)&&curPane.bHtmlLoaded)
{_this.RemoveHtmlContentDomNodeFromDoc(curPane);}
_this.m_iCurrentPaneIndex=iPaneIndex;curPane=_this.m_paneInfo[_this.m_iCurrentPaneIndex];for(var i=0;i<_this.m_paneInfo.length;i++)
{document.getElementById(_this.m_paneInfo[i].paneId).style.display="none";}
document.getElementById(curPane.paneId).style.display="";var oSpecialPaneTitle=document.getElementById("specialPaneTitle");if(curPane.specialPaneTitle)
{oSpecialPaneTitle.innerHTML=curPane.specialPaneTitle+": ";}
else
{oSpecialPaneTitle.innerHTML="";}
_this.UpdateButtonState();if(_this.IsSubmissionPane(curPane))
{if(!curPane.bHtmlLoaded)
{var fnDisplayContent=function(strHtml,json)
{document.getElementById("getSubmissionsResults").innerHTML=strHtml;for(var i=0;i<json.length;i++)
{var oPane=_this.m_paneInfoHash[json[i].textId];if(!oPane.bHtmlLoaded)
{oPane.htmlDomNode=document.getElementById("readerContent_"+json[i].textId);_this.RemoveHtmlContentDomNodeFromDoc(oPane);oPane.bHtmlLoaded=true;}}
document.getElementById("getSubmissionsResults").innerHTML="";_this.AddHtmlContentDomNodeToDoc(curPane);_this.m_bNavigating=false;g_ViewTracker.TrackView(_this.m_strProjectId,"submission",curPane.textId,false,true,1);}
ajaxCall(Link("ajax.aspx",["fn","project_reader_get_submissions","project_id",_this.m_strProjectId,"row_number",curPane.rowNumber]),fnDisplayContent);}
else
{_this.AddHtmlContentDomNodeToDoc(curPane);_this.m_bNavigating=false;g_ViewTracker.TrackView(_this.m_strProjectId,"submission",curPane.textId,false,true,2);}}
else
{if(curPane.trackType)
{g_ViewTracker.TrackView(_this.m_strProjectId,curPane.trackType,curPane.trackType,false,true,4);}
_this.m_bNavigating=false;}}}
ProjectReader.prototype.UpdateWizardSpecificButtonState=function()
{var _this=this;if(document.getElementById("TableOfContentsButton"))
{if(_this.m_paneInfo[_this.m_iCurrentPaneIndex].paneId=="tableOfContentsPane")
{document.getElementById("TableOfContentsButton").className="zyox-button button-navyblue";}
else
{document.getElementById("TableOfContentsButton").className="zyox-button button-navyblue";}}}
ProjectReader.prototype.UpdateBreadcrumbs=function()
{var _this=this;var oBreadcrumbsDisplay=document.getElementById("readerBreadcrumbs");var strCurrentBreadcrumbId=_this.m_paneInfo[_this.m_iCurrentPaneIndex].breadcrumbId;if(strCurrentBreadcrumbId)
{for(var i=0;i<_this.m_paneInfo.length;i++)
{if(_this.m_paneInfo[i].breadcrumbId)
{document.getElementById(_this.m_paneInfo[i].breadcrumbId).className="unSelected";}}
document.getElementById(strCurrentBreadcrumbId).className="selected";oBreadcrumbsDisplay.style.visibility="";}
else
{oBreadcrumbsDisplay.style.visibility="hidden";}}
ProjectReader.prototype.ShowQueryLetter=function()
{var _this=this;var oAgentsSelect=document.getElementById("selectedAgents");if(oAgentsSelect)
{for(var i=0;i<oAgentsSelect.options.length;i++)
{var oQueryLetter=document.getElementById("queryLetter_"+oAgentsSelect.options[i].value);if(oQueryLetter)
{oQueryLetter.style.display="none";}}
var strAgentId=oAgentsSelect.value;var oQueryLetter=document.getElementById("queryLetter_"+strAgentId);if(oQueryLetter)
{oQueryLetter.style.display="";}}}
var g_RequestReviewWizard=null;function OpenRequestReviewWizard(strProjectId,strSubmissionTextId)
{if(g_RequestReviewWizard==null)
{g_RequestReviewWizard=new RequestReviewWizard(strProjectId,strSubmissionTextId,null);}}
function EditReviewRequest(strReviewId)
{if(g_RequestReviewWizard==null)
{g_RequestReviewWizard=new RequestReviewWizard(null,null,strReviewId);}}
function RequestReviewWizard(strProjectId,strSubmissionTextId,strReviewId)
{var _this=this;var onLoadWizard=function()
{if(strSubmissionTextId!=null&&strSubmissionTextId!="")
{var submission=document.getElementById("wizardSubmission_"+strSubmissionTextId);if(submission)
{submission.checked="checked";}}}
if(strProjectId!=null)
{new SplashScreen(Link("ajax.aspx",["fn","request_review_wizard_create","project_id",strProjectId]),"746px",null,null,onLoadWizard);}
else if(strReviewId!=null)
{new SplashScreen(Link("ajax.aspx",["fn","request_review_wizard_edit","review_id",strReviewId]),"746px",null,null,onLoadWizard);}}
RequestReviewWizard.prototype.SelectAll=function(strDivId)
{var _this=this;document.getElementById(strDivId+"_All").style.display="none";document.getElementById(strDivId+"_None").style.display="";_this.SetCheckboxes(strDivId,"checked");}
RequestReviewWizard.prototype.SelectNone=function(strDivId)
{var _this=this;document.getElementById(strDivId+"_All").style.display="";document.getElementById(strDivId+"_None").style.display="none";_this.SetCheckboxes(strDivId,"");}
RequestReviewWizard.prototype.SetCheckboxes=function(strParentDivId,strCheckedValue)
{var _this=this;var oCheckboxes=document.getElementById(strParentDivId).getElementsByTagName("input");for(i=0;i<oCheckboxes.length;i++)
{oCheckboxes[i].checked=strCheckedValue;}}
RequestReviewWizard.prototype.Submit=function()
{var _this=this;document.getElementById("wizardForm").submit();_this.Close();}
RequestReviewWizard.prototype.Close=function()
{var _this=this;g_splashScreen.Close();g_RequestReviewWizard=null;}
RequestReviewWizard.prototype.OnClickNextFromSelectSubmissionsStep=function()
{var _this=this;var bAtLeastOneSubmissionSelected=false;var oCheckboxes=document.getElementById("ReviewRequestSubmissionsList").getElementsByTagName("input");for(i=0;i<oCheckboxes.length;i++)
{if(oCheckboxes[i].checked)
{bAtLeastOneSubmissionSelected=true;break;}}
if(!bAtLeastOneSubmissionSelected)
{document.getElementById("errorDisplay_SelectSubmission").style.display="";}
else
{document.getElementById("errorDisplay_SelectSubmission").style.display="none";Show('step_reviewTypeCompletionDate');}}
var g_ViewTracker=null;function InitViewTracker()
{if(g_ViewTracker==null)
{g_ViewTracker=new ViewTracker();}}
function ViewTracker()
{var _this=this;_this.m_itemsViewed={};}
ViewTracker.prototype.TrackView=function(strProjectId,strViewedType,strViewedId,bWorkarea,bReader,iDebugFrom)
{var _this=this;var strTrackBy=(bWorkarea?"workarea_":"reader_")+strProjectId+"_"+strViewedId;if(!_this.m_itemsViewed[strTrackBy])
{_this.m_itemsViewed[strTrackBy]=true;var fnCallback=function(strResult){}
ajaxCall(Link("ajax.aspx",["fn","track_view","viewedType",strViewedType,"viewedId",strViewedId,"bWorkarea",bWorkarea,"bReader",bReader,"project_id",strProjectId,"debugFrom",iDebugFrom]),fnCallback);}}
function HookUpWordCount(textDisplay,wordCountDisplay)
{var bIsTextArea=(textDisplay.tagName.toLowerCase()=="textarea");var bIsDiv=(textDisplay.tagName.toLowerCase()=="div");var UpdateCounts=function()
{var val;if(bIsTextArea){val=textDisplay.value;}else if(bIsDiv){if(textDisplay.innerText!=undefined){val=textDisplay.innerText;}else{val=textDisplay.textContent;}}
ShowWordCount(val,wordCountDisplay);}
if(bIsTextArea){textDisplay.onkeyup=UpdateCounts;}
UpdateCounts();}
function ShowWordCount(strText,wordCountDisplay)
{wordCountDisplay.innerHTML=GetWordCount(strText);}
function GetWordCount(strPlainText)
{if(!strPlainText||strPlainText.length==0)
{return 0;}
else
{var strPlainText=strPlainText.trim();if(strPlainText=="")
{return 0;}
else
{return strPlainText.split(/\s+/).length;}}}
var g_wordCountTexts={};function UpdateWordCountBar(strWordCounterId,strTextToCount)
{if(g_wordCountTexts[strWordCounterId]!=strTextToCount)
{g_wordCountTexts[strWordCounterId]=strTextToCount;var iWordCount=GetWordCount(strTextToCount);if(iWordCount==0)
{document.getElementById("wordCountContainer").style.visibility="hidden";}
else
{document.getElementById("wordCountContainer").style.visibility="";}
var strWordString;if(iWordCount==0)
{strWordString="";}
else if(iWordCount==1)
{strWordString=g_resxStrings.OneWord;}
else
{strWordString=StringFormat(g_resxStrings.NWords,iWordCount);}
var oText=document.getElementById("wordCountText");oText.innerHTML=strWordString;var iBarWidth=Math.floor((350/300)*iWordCount);if(oText.clientWidth+iBarWidth>348)
{oText.style.position="absolute";if(g_resxStrings["UIDirection"]=="LTR")
{oText.style.right="0px";}
else
{oText.style.left="0px";}}
else
{oText.style.position="static";}
var oBar=document.getElementById("wordCountBar");if(iBarWidth<348)
{oBar.style.width=iBarWidth+"px";}
else
{oBar.style.width="348px";}
if(iWordCount<150)
{oBar.style.backgroundColor="#ff7300";}
else
{oBar.style.backgroundColor="#669900";}}}
var g_wordCountTimer=null;function InitWordCounterForSingleTextarea(strTextareaId)
{var fnUpdate=function()
{if(document.getElementById(strTextareaId))
{UpdateWordCountBar(strTextareaId,document.getElementById(strTextareaId).value);}}
fnUpdate();g_wordCountTimer=window.setInterval(fnUpdate,2000);}
function InitWordCounterForMultipleTextareas(aTextareaIds)
{if(g_wordCountTimer!=null)
{window.clearInterval(g_wordCountTimer);g_wordCountTimer=null;}
var strWordCounterId=Math.random();var fnUpdate=function()
{var bFoundAtLeastOne=false;var strText="";for(var i=0;i<aTextareaIds.length;i++)
{var oTextarea=document.getElementById(aTextareaIds[i]);if(oTextarea)
{bFoundAtLeastOne=true;strText+=" "+oTextarea.value;}}
if(bFoundAtLeastOne)
{UpdateWordCountBar(strWordCounterId,strText);}}
fnUpdate();g_wordCountTimer=window.setInterval(fnUpdate,2000);}
function GetTextareaContent_PlainText(strTextareaId)
{var oTextEditor=tinyMCE.get(strTextareaId);if(oTextEditor)
{var textEditorBody=oTextEditor.getBody();if(textEditorBody.innerText)
{return textEditorBody.innerText;}
else if(textEditorBody.textContent)
{return textEditorBody.textContent;}}
return"";}
function ConfirmIgnoreSplash(strMessageId,strIgnoreMemberId)
{new SplashScreen(Link("ajax.aspx",["fn","confirm_ignore_splash","popup","true","msgId",strMessageId,"ignoreMemberId",strIgnoreMemberId]),"250px",null,null);}
function ConfirmSuperIgnoreSplash(strMessageId,strIgnoreMemberId)
{new SplashScreen(Link("ajax.aspx",["fn","confirm_super_ignore_splash","popup","true","msgId",strMessageId,"ignoreMemberId",strIgnoreMemberId]),"250px",null,null);}
function Ignore(strMessageId,strIgnoreMemberId)
{var _this=this;var fnResult=function(jsonResult)
{document.getElementById(strMessageId+"_ignore_"+strIgnoreMemberId).innerHTML=jsonResult.resultHtml;}
var arg_array=["fn","ignore"];var strLink=Link("ajax.aspx",arg_array);var postInputArray=['ignoreMemberId',strIgnoreMemberId];ajaxCall(strLink,fnResult,postInputArray);}
function SuperIgnore(strMessageId,strIgnoreMemberId)
{var _this=this;var fnResult=function(jsonResult)
{document.getElementById(strMessageId+"_super_ignore_"+strIgnoreMemberId).innerHTML=jsonResult.resultHtml;}
var arg_array=["fn","super_ignore"];var strLink=Link("ajax.aspx",arg_array);var postInputArray=['ignoreMemberId',strIgnoreMemberId];ajaxCall(strLink,fnResult,postInputArray);}
var g_wizard=null;function OpenLiteraryAgentWizard(strProjectId)
{g_wizard=new LiteraryAgentWizard(strProjectId);g_wizard.Init();}
LiteraryAgentWizard.prototype=new Wizard();function LiteraryAgentWizard(strProjectId)
{var _this=this;_this.m_strProjectId=strProjectId;}
LiteraryAgentWizard.prototype.Init=function()
{var _this=this;var onLoadWizard=function(json)
{_this.m_paneInfo=json.paneInfo;_this.m_bIsRejectedByQualityControlForSpelling=json.bIsRejectedByQualityControlForSpelling;_this.m_iContentHeight=json.iContentHeight;_this.m_bCanEditSubmission=json.bCanEditSubmission;_this.m_strPreviouslySelectedGenreId=json.previouslySelectedGenreId;_this.m_strPreviouslySelectedGenre2Id=json.previouslySelectedGenre2Id;_this.m_iCurrentPaneIndex=0;_this.m_iHighestPaneReached=0;_this.m_bIsNavigating=false;_this.m_bIsSubmitting=false;_this.m_bIsSaving=false;UpdateGenres();if(!_this.m_bCanEditSubmission)
{for(var i=0;i<_this.m_paneInfo.length;i++)
{if(_this.m_paneInfo[i].paneId=="queryLetter")
{_this.Navigate(i);}}}
else
{_this.Navigate(0);}
_this.InitTinyMCE();}
var queryArray=["fn","open_literary_agent_wizard","height","600px"];if(_this.m_strProjectId!=null)
{queryArray.push("project_id");queryArray.push(_this.m_strProjectId);}
new SplashScreen(Link("ajax.aspx",queryArray),"746px",null,null,onLoadWizard);}
LiteraryAgentWizard.prototype.OnClickPayPal=function()
{var _this=this;document.getElementById("wizardForm").submit();}
LiteraryAgentWizard.prototype.SubmitNow=function(bIsRejectedByQualityControl)
{var _this=this;if(_this.m_bIsSubmitting)
{return;}
_this.m_bIsSubmitting=true;if(bIsRejectedByQualityControl)
{if(!confirm(g_resxStrings["ConfirmResubmitToQualityControl"]))
{return;}}
document.getElementById("submitNow").value="true";document.getElementById("wizardForm").submit();}
LiteraryAgentWizard.prototype.SaveForLater=function()
{var _this=this;if(_this.m_bIsSaving)
{return;}
if(!ValidateCreateProject())
{return;}
_this.m_bIsSaving=true;document.getElementById("saveForLater").value="true";document.getElementById("wizardForm").submit();}
LiteraryAgentWizard.prototype.SubmitPayPalForm=function(strProjectId)
{var _this=this;document.getElementById("projectIdForPayPal").value=strProjectId;document.getElementById("paypalForm").submit();}
LiteraryAgentWizard.prototype.ValidateCreateProject=function(fnCallBack,returnToStep)
{var _this=this;var projectTitle=document.getElementById("titleText").value;var urlTitle=document.getElementById("urlTitle").value;var strLink=Link("ajax.aspx",["fn","validate_new_project_info"]);var postInputArray=['projectTitle',projectTitle,'urlTitle',urlTitle,'returnToStep',returnToStep,'projectGenre',GetSelectedGenreId(),'projectGenre2',GetSelectedGenre2Id()];var oRadios=document.getElementsByName("radioProjectCategoryId");for(var i=0;i<oRadios.length;i++)
{if(oRadios[i].checked)
{postInputArray.push('projectCategoryId');postInputArray.push(oRadios[i].value);break;}}
var arrCheckBoxes=document.getElementsByName("selectedAgentId");for(var i=0;i<arrCheckBoxes.length;i++)
{if(arrCheckBoxes[i].checked==true)
{var strAgentId=arrCheckBoxes[i].value;postInputArray.push('selectedAgentId');postInputArray.push(strAgentId);}}
if(_this.m_strProjectId!=null)
{postInputArray.push('projectId');postInputArray.push(_this.m_strProjectId);}
var fnValidateCallback=function(html,json)
{if(!json.validateResult)
{if(json.sourceStep=="createProject")
{document.getElementById("projectCreateError").innerHTML=json.errorMessage;document.getElementById("createProjectContainer").scrollTop=0;fnCallBack(false);}}
else
{if(json.sourceStep=="createProject")
{document.getElementById("projectCreateError").innerHTML="";document.getElementById("agentListsDiv").innerHTML=html;fnCallBack(true);}}}
ajaxCall(strLink,fnValidateCallback,postInputArray);}
LiteraryAgentWizard.prototype.Navigate=function(iNewPaneIndex)
{var _this=this;if(_this.m_bIsNavigating)
{return;}
_this.m_bIsNavigating=true;var iOldPaneIndex=_this.m_iCurrentPaneIndex;var oldPane=_this.m_paneInfo[iOldPaneIndex];var newPane=_this.m_paneInfo[iNewPaneIndex];if(_this.IsNavigatingForwardFrom("authorBio",iOldPaneIndex,iNewPaneIndex))
{if(!_this.ValidateAuthorBioFields())
{_this.m_bIsNavigating=false;return;}}
if(_this.IsNavigatingForwardFrom("projectSample",iOldPaneIndex,iNewPaneIndex))
{if(!_this.ValidateProjectSampleFields())
{_this.m_bIsNavigating=false;return;}}
if(!_this.m_bCanEditSubmission)
{_this.DisableUnavailableSteps(iNewPaneIndex);}
if(_this.IsNavigatingTo("projectSample",iNewPaneIndex))
{_this.UpdateProjectSampleStepForSelectedCategory();}
if(_this.IsNavigatingTo("finishStep",iNewPaneIndex))
{_this.CheckAgentSelection();}
if(_this.IsNavigatingForwardFrom("createProject",iOldPaneIndex,iNewPaneIndex))
{if(!_this.ValidateProjectFields())
{_this.m_bIsNavigating=false;return;}
if(_this.IsAtLeastOneAgentSelected()&&(GetSelectedGenreId()!=_this.m_strPreviouslySelectedGenreId||GetSelectedGenre2Id()!=_this.m_strPreviouslySelectedGenre2Id))
{if(!confirm("Warning: changing the genre after you have selected agents will cause you to lose your query letters to agents that don't accept the new genre.  Are you sure you'd like to continue?"))
{_this.m_bIsNavigating=false;return;}}
var fnCallback=function(bSuccess)
{if(bSuccess)
{var currentAgents=document.getElementsByName("selectedAgentId");if(currentAgents==null||currentAgents.length<=0)
{document.getElementById("selectAgentText").innerHTML=g_resxStrings["selectAgents_noAgentForGenre"];}
else
{document.getElementById("selectAgentText").innerHTML=g_resxStrings["selectAgents_explanation"];}
_this.m_strPreviouslySelectedGenreId=GetSelectedGenreId();_this.m_strPreviouslySelectedGenre2Id=GetSelectedGenre2Id();_this.NavigateStepTwo(iNewPaneIndex,oldPane,newPane);}
else
{_this.m_bIsNavigating=false;}}
_this.ValidateCreateProject(fnCallback,"createProject");}
else
{_this.NavigateStepTwo(iNewPaneIndex,oldPane,newPane);}}
LiteraryAgentWizard.prototype.DisableUnavailableSteps=function(iNewPaneIndex)
{var _this=this;if(_this.IsNavigatingTo("queryLetter",iNewPaneIndex)||_this.IsNavigatingTo("finishStep",iNewPaneIndex))
{document.getElementById("grayOutStep").style.display="none";}
else
{document.getElementById("grayOutStep").style.display="";if(g_bIsIE6)
{if(_this.IsNavigatingTo("createProject",iNewPaneIndex))
{document.getElementById("chooseGenreSection").style.display="none";}}}}
LiteraryAgentWizard.prototype.UpdateProjectSampleStepForSelectedCategory=function(){var sampleLabel="";var sampleInstruction="",sampleTip1="",sampleTip2="";var displayStyle="";var bFiction=document.getElementById("radioProjectCategory_00a8332a3ccc44e0a96e528a0c1af4c5").checked;if(bFiction){sampleLabel=g_resxStrings["ManuscriptSample"];sampleInstruction=g_resxStrings["ManuscriptSampleInstruction"];sampleTip1=g_resxStrings["ManuscriptSampleTip_1"];sampleTip2=g_resxStrings["ManuscriptSampleTip_2"];tutorialLinkToShow="projectSample_ReadFictionTutorial";tutorialLinkToHide="projectSample_ReadNonfictionTutorial";displayStyle="";}
else{sampleLabel=g_resxStrings["BookProposal"];sampleInstruction=g_resxStrings["BookProposalSampleInstruction"];sampleTip1=g_resxStrings["BookProposalSampleTip_1"];sampleTip2=g_resxStrings["BookProposalSampleTip_2"];tutorialLinkToShow="projectSample_ReadNonfictionTutorial";tutorialLinkToHide="projectSample_ReadFictionTutorial";displayStyle="none";}
document.getElementById("projectSampleTextareaLabel").innerHTML=sampleLabel;document.getElementById("projectSample_Instruction").innerHTML=sampleInstruction;document.getElementById("projectSampleTip_1").innerHTML=sampleTip1;document.getElementById("projectSampleTip_2").innerHTML=sampleTip2;document.getElementById(tutorialLinkToShow).style.display="";document.getElementById(tutorialLinkToHide).style.display="none";document.getElementById("projectSample_Fiction_MultiAgentTip").style.display=displayStyle;document.getElementById("wordCountSpan").style.display=displayStyle;document.getElementById("sampleTitleSpan").style.display=displayStyle;}
LiteraryAgentWizard.prototype.ValidateProjectSampleFields=function()
{var _this=this;var maxSample=210000;var msg=g_resxStrings["sampleProposalWordsAlert"];if(tinyMCE.get("projectSampleTextarea").getContent().length>maxSample)
{alert(StringFormat(msg,maxSample));return false;}
return true;}
LiteraryAgentWizard.prototype.ValidateProjectFields=function()
{var _this=this;var maxBlurb=400;var msg="{0} field must have no more than {1} characters";if(document.getElementById("blurb").value.length>maxBlurb)
{alert(StringFormat(msg,"Synopsis",maxBlurb));return false;}
return true;}
LiteraryAgentWizard.prototype.ValidateAuthorBioFields=function()
{var _this=this;var maxEducation=8000;var maxAuthor=15000;var msg="{0} field must have no more than {1} characters";if(document.getElementById("school").value.length>maxEducation)
{alert(StringFormat(msg,"Education",maxEducation));return false;}
else if(document.getElementById("authorOverview").value.length>maxAuthor)
{alert(StringFormat(msg,"Professional Overview",maxAuthor));return false;}
else if(document.getElementById("authorPublications").value.length>maxAuthor)
{alert(StringFormat(msg,"Publications",maxAuthor));return false;}
else if(document.getElementById("authorWorkExperience").value.length>maxAuthor)
{alert(StringFormat(msg,"Work Experience",maxAuthor));return false;}
else if(document.getElementById("authorHonors").value.length>maxAuthor)
{alert(StringFormat(msg,"Honors",maxAuthor));return false;}
else if(document.getElementById("authorOther").value.length>maxAuthor)
{alert(StringFormat(msg,"Other",maxAuthor));return false;}
else if(document.getElementById("authorMarketingExpertise").value.length>maxAuthor)
{alert(StringFormat(msg,"Marketing Expertise",maxAuthor));return false;}
return true;}
LiteraryAgentWizard.prototype.NavigateStepTwo=function(iNewPaneIndex,oldPane,newPane)
{var _this=this;var iOldPaneIndex=_this.m_iCurrentPaneIndex;if(_this.IsNavigatingFrom("queryLetter",iOldPaneIndex))
{var oTinyMCE=tinyMCE.get("queryLetterTextarea");if(oTinyMCE)
{tinyMCE.execCommand("mceRemoveControl",true,"queryLetterTextarea");}}
else if(_this.IsNavigatingFrom("projectSample",iOldPaneIndex))
{tinyMCE.execCommand("mceRemoveControl",true,"projectSampleTextarea");}
document.getElementById(oldPane.paneId).style.display="none";_this.m_iCurrentPaneIndex=iNewPaneIndex;if(iNewPaneIndex>_this.m_iHighestPaneReached)
{_this.m_iHighestPaneReached=iNewPaneIndex;}
document.getElementById(newPane.paneId).style.display="";_this.UpdateButtonState(newPane);if(_this.IsNavigatingTo("queryLetter",iNewPaneIndex))
{_this.AdjustSelectedAgentsDivHeight();}
else if(_this.IsNavigatingTo("projectSample",iNewPaneIndex))
{tinyMCE.execCommand("mceAddControl",true,"projectSampleTextarea");}
_this.m_bIsNavigating=false;}
LiteraryAgentWizard.prototype.IsAtLeastOneAgentSelected=function()
{var _this=this;var agents=document.getElementsByName("selectedAgentId");for(var i=0;i<agents.length;i++)
{if(agents[i].checked)
{return true;}}
return false;}
LiteraryAgentWizard.prototype.CheckAgentSelection=function(){var _this=this;var queryLetters,description,email,projectSampleTextarea,realName,location,authorWebsite,school,authorOverview,authorPublications,authorWorkExperience,authorHonors,authorOther,authorMarketingExpertise;if(_this.IsAtLeastOneAgentSelected()){document.getElementById("noAgentSelectedWarning").className="hidden";document.getElementById("sumbitNowText").className="";document.getElementById("finishPreview").className="";if(document.getElementById("submitNowButtonSpan")){document.getElementById("submitNowButtonSpan").className="";}
document.getElementById("nextButton").style.display="none";document.getElementById("submitButton").style.display="";finishStepSelectedAgentsDiv=document.getElementById("finishStepSelectedAgents");finishStepSelectedAgentsDiv.innerHTML=document.getElementById("selectedAgentsDiv").innerHTML;description=document.getElementById("projDescription");description.innerHTML=document.getElementById("blurb").value;bio=document.getElementById("bioInfo");realName=document.createElement("p");realName.innerHTML="<strong>"+g_resxStrings["FullName"]+"</strong><br /> "+document.getElementById("realName").value;bio.appendChild(realName);email=document.createElement("p");email.innerHTML="<strong>"+g_resxStrings["Email"]+"</strong><br /> "+document.getElementById("email").innerHTML;bio.appendChild(email);location=document.createElement("p");location.innerHTML="<strong>"+g_resxStrings["Location"]+"</strong><br /> "+document.getElementById("location").value;bio.appendChild(location);authorWebsite=document.createElement("p");authorWebsite.innerHTML="<strong>"+g_resxStrings["WebsiteBlog"]+"</strong><br /> "+document.getElementById("authorWebsite").value;bio.appendChild(authorWebsite);school=document.createElement("p");school.innerHTML="<strong>"+g_resxStrings["Education"]+"</strong><br /> "+document.getElementById("school").value;bio.appendChild(school);authorOverview=document.createElement("p");authorOverview.innerHTML="<strong>"+g_resxStrings["ProfessionalPersonalOverview"]+"</strong><br /> "+document.getElementById("authorOverview").value;bio.appendChild(authorOverview);authorPublications=document.createElement("p");authorPublications.innerHTML="<strong>"+g_resxStrings["PublishedWork"]+"</strong><br /> "+document.getElementById("authorPublications").value;bio.appendChild(authorPublications);authorWorkExperience=document.createElement("p");authorWorkExperience.innerHTML="<strong>"+g_resxStrings["WorkHistory"]+"</strong><br /> "+document.getElementById("authorWorkExperience").value;bio.appendChild(authorWorkExperience);authorHonors=document.createElement("p");authorHonors.innerHTML="<strong>"+g_resxStrings["Awards"]+"</strong><br /> "+document.getElementById("authorHonors").value;bio.appendChild(authorHonors);authorOther=document.createElement("p");authorOther.innerHTML="<strong>"+g_resxStrings["Other"]+"</strong><br /> "+document.getElementById("authorOther").value;bio.appendChild(authorOther);authorMarketingExpertise=document.createElement("p");authorMarketingExpertise.innerHTML="<strong>"+g_resxStrings["MarketingExpertisePlatform"]+"</strong><br /> "+document.getElementById("authorMarketingExpertise").value;bio.appendChild(authorMarketingExpertise);tempValue=tinyMCE.get("projectSampleTextarea").getContent();projectSampleTextarea=document.getElementById("projSample");projectSampleTextarea.innerHTML=tempValue;allQueryLettersDiv=document.getElementById("queries");allQueryLettersDiv.innerHTML=" ";queryLetters=document.getElementById("allQueryLetters").childNodes;for(i=0;i<queryLetters.length;i++){if(typeof(queryLetters[i].value)!="undefined"){temp=document.createElement("div");tempAgentName="agentName_"+queryLetters[i].name;tempAgentName=document.getElementById(tempAgentName).innerHTML;temp.innerHTML=tempAgentName+queryLetters[i].value;temp.id="pre_"+queryLetters[i].name;if(queryLetters.length-1==i){temp.style.borderBottom='1px solid #d4d4d4';}
allQueryLettersDiv.appendChild(temp);}}}
else{document.getElementById("noAgentSelectedWarning").className="error";document.getElementById("sumbitNowText").className="hidden";document.getElementById("finishPreview").className="hidden";if(document.getElementById("submitNowButtonSpan")){document.getElementById("submitNowButtonSpan").className="hidden";}
document.getElementById("finishStepSelectedAgents").innerHTML="";}}
LiteraryAgentWizard.prototype.UpdateWizardSpecificButtonState=function(){var _this=this;if(_this.m_iCurrentPaneIndex<(_this.m_paneInfo.length-1)){document.getElementById("nextButton").style.display="";document.getElementById("submitButton").style.display="none";}}
LiteraryAgentWizard.prototype.OnBeforeClose=function(bShowWarning,fnSuccessCallback)
{var _this=this;if(bShowWarning==null)
{bShowWarning=true;}
if(bShowWarning)
{var strWarning="";if(_this.m_strProjectId==null)
{strWarning=g_resxStrings["ConfirmCloseWizardNewSubmission"];}
else
{strWarning=g_resxStrings["ConfirmCloseWizardExistingSubmission"];}
if(!confirm(strWarning))
{return;}}
var oTinyMCE=tinyMCE.get("queryLetterTextarea");if(oTinyMCE)
{tinyMCE.execCommand("mceRemoveControl",true,"queryLetterTextarea");}
var oTinyMCE=tinyMCE.get("projectSampleTextarea");if(oTinyMCE)
{tinyMCE.execCommand("mceRemoveControl",true,"projectSampleTextarea");}
fnSuccessCallback();}
LiteraryAgentWizard.prototype.EditAgentQueryLetter=function(strAgentId,bFromAddAgent)
{var _this=this;_this.m_strCurrentlyEditingQueryForAgentId=strAgentId;var strContent;var oQueryLetterForAgent=document.getElementById("queryLetter_"+_this.m_strCurrentlyEditingQueryForAgentId);if(oQueryLetterForAgent)
{strContent=oQueryLetterForAgent.value;}
else
{strContent=document.getElementById("agentSalutation_"+_this.m_strCurrentlyEditingQueryForAgentId).innerHTML;}
_this.ShowQueryLetterEditor(bFromAddAgent);document.getElementById("queryLetterAgentInfo").innerHTML=document.getElementById("agentInfo_"+strAgentId).innerHTML;var fnAfter=function()
{tinyMCE.get("queryLetterTextarea").setContent(strContent);if(!bFromAddAgent&&_this.m_bIsRejectedByQualityControlForSpelling)
{tinyMCE.execInstanceCommand("queryLetterTextarea","mceSpellCheck");}}
var oTinyMCE=tinyMCE.get("queryLetterTextarea");if(!oTinyMCE)
{tinyMCE.execCommand("mceAddControl",true,"queryLetterTextarea");window.setTimeout(fnAfter,500);}
else
{fnAfter();}}
LiteraryAgentWizard.prototype.SaveQueryLetter=function()
{var _this=this;var strQueryLetterContent=tinyMCE.get("queryLetterTextarea").getContent();var maxQuery=7000;var msg=g_resxStrings["queryLetterWordsAlert"];if(strQueryLetterContent.length>maxQuery)
{alert(StringFormat(msg,maxQuery));return false;}
var oQueryLetter=document.getElementById("queryLetter_"+_this.m_strCurrentlyEditingQueryForAgentId);if(oQueryLetter==null)
{oQueryLetter=document.createElement("input");oQueryLetter.type="hidden";oQueryLetter.id="queryLetter_"+_this.m_strCurrentlyEditingQueryForAgentId;oQueryLetter.name="queryLetter_"+_this.m_strCurrentlyEditingQueryForAgentId;document.getElementById("allQueryLetters").appendChild(oQueryLetter);}
oQueryLetter.value=strQueryLetterContent;_this.CloseQueryLetterEditor();}
LiteraryAgentWizard.prototype.ShowQueryLetterEditor=function(bShowCancelAddAgentButton)
{var _this=this;document.getElementById("queryLetterEditor").style.display="";document.getElementById("grayOutButtons").style.display="";document.getElementById("agentListsDiv").style.display="none";document.getElementById("cancelAddAgentButton").style.display=(bShowCancelAddAgentButton?"":"none");}
LiteraryAgentWizard.prototype.CloseQueryLetterEditor=function()
{var _this=this;document.getElementById("queryLetterEditor").style.display="none";document.getElementById("grayOutButtons").style.display="none";document.getElementById("agentListsDiv").style.display="";_this.m_strCurrentlyEditingQueryForAgentId="";}
LiteraryAgentWizard.prototype.AddAgent=function(strAgentId)
{var _this=this;_this.EditAgentQueryLetter(strAgentId,true);document.getElementById("selectedAgentRow_"+strAgentId).style.display="";document.getElementById("unselectedAgentRow_"+strAgentId).style.display="none";document.getElementById("agentCheckbox_"+strAgentId).checked="checked";document.getElementById("selectedAgentsDiv").style.display="";document.getElementById("selectedAgentsLabel").style.display="";_this.AdjustSelectedAgentsDivHeight();}
LiteraryAgentWizard.prototype.RemoveAgent=function(strAgentId)
{var _this=this;document.getElementById("selectedAgentRow_"+strAgentId).style.display="none";document.getElementById("unselectedAgentRow_"+strAgentId).style.display="";document.getElementById("agentCheckbox_"+strAgentId).checked="";_this.AdjustSelectedAgentsDivHeight();}
LiteraryAgentWizard.prototype.AdjustSelectedAgentsDivHeight=function()
{var _this=this;}
LiteraryAgentWizard.prototype.CancelAddAgent=function()
{var _this=this;_this.RemoveAgent(_this.m_strCurrentlyEditingQueryForAgentId);_this.CloseQueryLetterEditor();}
function ProjectOpt(strOpt,strProjectId)
{var buttonOptIn=document.getElementById("opt_in_"+strProjectId);var buttonOptOut=document.getElementById("opt_out_"+strProjectId);buttonOptIn.style.display="none";buttonOptOut.style.display="none";var fnLoad=function(strResult)
{if(strOpt=="in")
{buttonOptIn.style.display="none";buttonOptOut.style.display="";}
else
{buttonOptOut.style.display="none";buttonOptIn.style.display="";}}
var strLink=Link("ajax.aspx",["fn","project_opt","opt",strOpt,"p",strProjectId]);ajaxCall(strLink,fnLoad);}
function UpdateUrl()
{var strProjectName=document.getElementById("titleText").value;var urlTitle=document.getElementById("urlTitle");var strUrlSuggestion=strProjectName;strUrlSuggestion=strUrlSuggestion.replace(/\s/g,"-");strUrlSuggestion=strUrlSuggestion.replace(/[^א-תa-zA-Z_0-9_-]/g,"");strUrlSuggestion=strUrlSuggestion.replace(/-+/g,"-");strUrlSuggestion=strUrlSuggestion.replace(/-+$/,"");strUrlSuggestion=strUrlSuggestion.replace(/^-+/,"");urlTitle.value=strUrlSuggestion;}
function CheckFields()
{if(document.getElementById("brief").value.length>15000)
{alert(g_resxStrings["CreateProjectOverviewTooLong"]);return false;}
return true;}
function SubmitForm()
{if(CheckFields())
{var onSuccess=function()
{document.getElementById("createProjectForm").submit();}
WEbookConfirm(g_resxStrings["CreateProjectConfirmationMessage"],onSuccess,null);}}
function IsValidTitle()
{var strTitle=document.getElementById("titleText").value;if(strTitle.length<1||strTitle.length>100)
{return false}
else return true;}
function UpdateGenres()
{var strSelectedCategoryId=GetValueFromCheckedRadio("radioProjectCategoryId");var aAllCategoryRadios=document.getElementsByName("radioProjectCategoryId");for(var i=0;i<aAllCategoryRadios.length;i++)
{var strCurCategoryId=aAllCategoryRadios[i].value;var oGenreSelect=document.getElementById("genreSelect_"+strCurCategoryId);var oGenre2Select=document.getElementById("genre2Select_"+strCurCategoryId);if(strCurCategoryId==strSelectedCategoryId)
{oGenreSelect.style.display="";oGenreSelect.name="projectGenre";if(oGenre2Select)
{oGenre2Select.style.display="";oGenre2Select.name="projectGenre2";}}
else
{oGenreSelect.style.display="none";oGenreSelect.name="";if(oGenre2Select)
{oGenre2Select.style.display="none";oGenre2Select.name="";}}}}
function ValidateCreateProject()
{if(!IsValidTitle())
{document.getElementById("projectCreateError").innerHTML=g_resxStrings.InvalidTitleLength;return false;}
if(!IsValidGenreSelection())
{document.getElementById("projectCreateError").innerHTML=g_resxStrings.Project_MissingGenre;return false;}
document.getElementById("projectCreateError").innerHTML="";return true;}
function IsValidGenreSelection()
{var strSelectedCategoryId=GetValueFromCheckedRadio("radioProjectCategoryId");if(strSelectedCategoryId!="")
{return(document.getElementById("genreSelect_"+strSelectedCategoryId).value!="");}
else
{return false;}}
function GetSelectedGenres_Displayable()
{var strSelectedCategoryId=GetValueFromCheckedRadio("radioProjectCategoryId");var oGenreSelect=document.getElementById("genreSelect_"+strSelectedCategoryId);var oGenre2Select=document.getElementById("genre2Select_"+strSelectedCategoryId);var strGenre=document.getElementById("projectCategoryDisplayName_"+strSelectedCategoryId).innerHTML+": "+
oGenreSelect.options[oGenreSelect.selectedIndex].innerHTML;if(oGenre2Select&&oGenre2Select.value!="")
{strGenre+=", "+oGenre2Select.options[oGenre2Select.selectedIndex].innerHTML;}
return strGenre;}
function GetSelectedGenreId()
{var strSelectedCategoryId=GetValueFromCheckedRadio("radioProjectCategoryId");var oGenreSelect=document.getElementById("genreSelect_"+strSelectedCategoryId);return oGenreSelect.value;}
function GetSelectedGenre2Id()
{var strSelectedCategoryId=GetValueFromCheckedRadio("radioProjectCategoryId");var oGenre2Select=document.getElementById("genre2Select_"+strSelectedCategoryId);return oGenre2Select.value;}
function IsPoetryCategorySelected()
{return(GetValueFromCheckedRadio("radioProjectCategoryId")=="94e887f82e224f169670ccf2f9f5872f");}
function InitChapterUI(strProjectId,strInitState,bProjectIsInVotingOrPending)
{g_writingUI=new ChapterUI(strProjectId,strInitState,bProjectIsInVotingOrPending);g_writingUI.Init();}
ChapterUI.prototype=new WritingUI();function ChapterUI(strProjectId,strInitState,bProjectIsInVotingOrPending)
{var _this=this;_this.m_strProjectId=strProjectId;_this.m_strInitState=strInitState;_this.m_bProjectIsInVotingOrPending=bProjectIsInVotingOrPending;}
ChapterUI.prototype.Init=function()
{var _this=this;_this.InitWritingUI();_this.OnClickGeneralChatForum();var strSubmissionBaseId=RequestStr("pb");if(strSubmissionBaseId!=null)
{g_scroller.ScrollToItem(document.getElementById(strSubmissionBaseId));_this.StartingNotOnBookCentral();var fnLoadPt=function()
{var strSubmissionTextId=RequestStr("pt");if(strSubmissionTextId!=null)
{_this.LoadFeedbackItem(strSubmissionTextId);}}
_this.SelectChapter(strSubmissionBaseId,fnLoadPt);}}
ChapterUI.prototype.SelectChapter=function(strSubmissionBaseId,callbackFn)
{var _this=this;_this.SetCurrentlySelectedTextId("");var fnLoadChapter=function(strResult)
{var fnAfterLoadHTMLContent=function()
{_this.RetrieveBaseIdIfExists();_this.LoadChapterSynopsis();if(callbackFn)
{callbackFn();}}
_this.LoadHTMLContent_WritingUI('project-main-display',strResult,fnAfterLoadHTMLContent);}
var strLink=Link("ajax.aspx",["fn","get_chapter","p",_this.m_strProjectId,"sb",strSubmissionBaseId]);ajaxCall(strLink,fnLoadChapter);}
ChapterUI.prototype.LoadChapterSynopsis=function()
{var _this=this;var fnLoadChapterSynopsis=function(strResult)
{var fnAfterLoadHTMLContent=function(){}
_this.LoadHTMLContent_WritingUI('referencesContent',strResult,fnAfterLoadHTMLContent);}
var strLink=Link("ajax.aspx",["fn","get_chapter_synopsis","p",_this.m_strProjectId,"sb",_this.currentlySelectedBaseId]);ajaxCall(strLink,fnLoadChapterSynopsis);}
ChapterUI.prototype.LoadWCIDN=function()
{var _this=this;_this.SelectChapter(_this.currentlySelectedBaseId);}
ChapterUI.prototype.GetDestinationUrl=function()
{var _this=this;var destinationUrl=Link("chapter.aspx");destinationUrl=AddDestinationUrlParam(destinationUrl,"p",_this.m_strProjectId);destinationUrl=AddDestinationUrlParam(destinationUrl,"pb",_this.currentlySelectedBaseId);destinationUrl=AddDestinationUrlParam(destinationUrl,"pt",_this.currentlySelectedTextId);return destinationUrl;}
ChapterUI.prototype.OnMouseOverItem=function(oItem)
{var _this=this;if(_this.currentlySelectedBaseId!=oItem.id)
{_this.HighlightListItem(oItem);}}
ChapterUI.prototype.OnMouseOutItem=function(oItem)
{var _this=this;if(_this.currentlySelectedBaseId!=oItem.id)
{_this.UnHighlightListItem(oItem);}}
ChapterUI.prototype.OnSelectBaseId=function(strSubmissionBaseId)
{var _this=this;_this.HighlightListItem(document.getElementById(strSubmissionBaseId));}
ChapterUI.prototype.OnUnSelectBaseId=function(strSubmissionBaseId)
{var _this=this;_this.UnHighlightListItem(document.getElementById(strSubmissionBaseId));}
ChapterUI.prototype.OnClickMyChapterInFeedback=function(strSubmissionTextId,strSubmissionBaseId)
{var _this=this;var fnAfterLoadFeedbackItem=function()
{_this.SetCurrentlySelectedBaseId(strSubmissionBaseId);g_scroller.ScrollToItem(strSubmissionBaseId);_this.LoadChapterSynopsis();}
_this.LoadFeedbackItem(strSubmissionTextId,fnAfterLoadFeedbackItem);}
ChapterUI.prototype.OnClickSingleAuthorChapterInFeedback=function(strSubmissionBaseId,strSubmissionTextId)
{var _this=this;var fnAfterLoadFeedbackItem=function()
{_this.SetCurrentlySelectedBaseId(strSubmissionBaseId);_this.LoadChapterSynopsis();}
_this.LoadFeedbackItem(strSubmissionTextId,fnAfterLoadFeedbackItem);}
ChapterUI.prototype.AddChapterDisplay=function()
{var _this=this;new SplashScreen(Link("ajax.aspx",["fn","add_chapter_display","p",_this.m_strProjectId]),"400px",null,null);}
ChapterUI.prototype.AddChapter=function()
{var _this=this;if(_this.m_bIsAddingChapter)return;_this.m_bIsAddingChapter=true;var strRand=Math.random();var fnLoad=function(result)
{if(typeof result=="string")
{var oResult=ConvertHTMLStringToDomNode(result);document.getElementById("chaptersList").appendChild(oResult);var strSubmissionBaseId=document.getElementById("chapterId_"+strRand).innerHTML;_this.SelectChapter(strSubmissionBaseId);g_splashScreen.OnSuccess();}
else
{var oError=document.getElementById("errorDisplay");oError.innerHTML=result.error;oError.style.display="";}
_this.m_bIsAddingChapter=false;}
var strTitle=document.getElementById("newChapterTitle").value;var strChapterSynopsis=document.getElementById("newChapterSynopsis").value;var strLink=Link("ajax.aspx",["fn","add_chapter","p",_this.m_strProjectId,"randomChapterIdentifier",strRand]);var postArray=["title",strTitle,"chapterSynopsis",strChapterSynopsis];ajaxCall(strLink,fnLoad,postArray);}
ChapterUI.prototype.RemoveSubmission=function()
{var _this=this;var doRemoval=function()
{var fnLoad=function(strResult)
{var fnCloseSplash=function(){g_splashScreen.Close();}
_this.LoadBookCentral(fnCloseSplash);}
var strLink=Link("ajax.aspx",["fn","remove_page_text","p",_this.m_strProjectId,"submissionBaseId",_this.currentlySelectedBaseId,"submissionTextId",_this.currentlySelectedTextId]);var postInputArray=[];var oExplanation=document.getElementById("removalExplanation");if(oExplanation)
{postInputArray=["explanation",oExplanation.value];}
ajaxCall(strLink,fnLoad,postInputArray);}
new SplashScreen(Link("ajax.aspx",["fn","remove_submission_display","p",_this.m_strProjectId,"submissionTextId",_this.currentlySelectedTextId]),"400px",doRemoval,null);}