
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["January"]='January';g_resxStrings["February"]='February';g_resxStrings["March"]='March';g_resxStrings["April"]='April';g_resxStrings["May"]='May';g_resxStrings["June"]='June';g_resxStrings["July"]='July';g_resxStrings["August"]='August';g_resxStrings["September"]='September';g_resxStrings["October"]='October';g_resxStrings["November"]='November';g_resxStrings["December"]='December';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["LastModifiedLabel"]='Last modified: {0}';g_resxStrings["MustPopulateAllSampleTypes"]='You have not yet added all the samples required by the agents of your choice. Please add all required samples before proceeding to the next step.';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["IntroSubmissionLimitedToOneAgent"]='Your introductory submission can only be submitted to one agent. Start a new submission if you wish to submit your work to other agents.';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["ExceededMaxCharsForText"]='{0} characters past the limit ({1})';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["PollWizard_CuteInititlizationError"]='Error initializing text editor. Try closing the submission wizard and reopening it.\n\nIf the problem persist, please report to WEbook Support at support@webook.com.';g_resxStrings["Poll_DeleteAreYouSure"]='This action cannot be undone. Are you sure you want to delete this submission?';g_resxStrings["PollWizard_InvalidCoupon"]='The coupon code is no longer valid';g_resxStrings["YouMustCheckPreviewedCheckbox"]='Please confirm that you have reviewed your submission BY CHECKING THE BOX AT THE BOTTOM OF THE SCREEN before proceeding';g_resxStrings["ExtendedSampleMaxCharsExceeded"]='The extended sample 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["FirstChapterMinChars"]='To make sure our raters have plenty to consider, your submission must be at least {0} characters  long (about {1} words).';g_resxStrings["PercentOff"]='-{0}% off';g_resxStrings["CantSkipDownloaded"]='You cannot skip this submission without providing a review of around 50-600 words. If you don’t want to read the entire 50-page sample, please write a short review that explains how far you got and why you chose not to read to the end.';g_resxStrings["CantSkipBeyondMax"]='You have already skipped {0} submissions before giving a review. Please download and review this submission before moving on. If you don’t want to read the entire 50-page sample, please write a short review that explains how far you got and why you chose not to read to the end.';g_resxStrings["SkipAreYouSure"]='If you decide not to download and rate this sample, you won’t be able to return to it later.';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;strReason="Status: "+status+" "+req.responseText+" "+strReason;}
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";}}
function Hide(strMenuId){var oMenu=document.getElementById(strMenuId);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()
{if(g_bUseHttps&&window.location.protocol=="https:")
{LoadJs('https://www.plaxo.com/css/m/js/util.js');LoadJs('https://www.plaxo.com/css/m/js/basic.js');LoadJs('https://www.plaxo.com/css/m/js/abc_launcher.js');}
else
{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"]),"440px",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,bSharePageToFameGeneral,bSharePageToFamePromotedWork,bSharePageToFameNonPromotedWork,bVisitorShare)
{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 if(bSharePageToFameGeneral)
{var strLink=LinkSmart("ajax.aspx",["fn","invite_a_friend_send"]);var postInputArray=['to',strTo,'from',strFrom,'message',strMessage,'location',window.location,'bSharePageToFameGeneral','true'];}
else if(bSharePageToFamePromotedWork)
{var strLink=LinkSmart("ajax.aspx",["fn","invite_a_friend_send"]);var postInputArray=['to',strTo,'from',strFrom,'message',strMessage,'location',window.location,'bSharePageToFamePromotedWork','true'];}
else if(bSharePageToFameNonPromotedWork)
{var strLink=LinkSmart("ajax.aspx",["fn","invite_a_friend_send"]);var postInputArray=['to',strTo,'from',strFrom,'message',strMessage,'location',window.location,'bSharePageToFameNonPromotedWork','true'];}
else if(bVisitorShare)
{var strLink=LinkSmart("ajax.aspx",["fn","invite_a_friend_send"]);var postInputArray=['to',strTo,'from',strFrom,'message',strMessage,'location',window.location,'bVisitorSharing','true'];}
else
{var strLink=LinkSmart("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 ToggleElementDisplay(eId)
{var e=document.getElementById(eId)
if(e)
{if(e.style.display=="block")
{e.style.display="none";}
else
{e.style.display="block";}}}
function SwitchMultipleElementsDisplay(eId,eName)
{var listE=getElementsByClass(eName);if(listE)
{for(i=0;i<listE.length;i++)
{listE[i].style.display="none";}}
var e=document.getElementById(eId)
if(e)
{e.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,strRoundId)
{if(strRoundId==null)
{strRoundId="";}
new SplashScreen(LinkSmart("ajax.aspx",["fn","view_poll_project","project_id",strProjectId,"round_id",strRoundId]),"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"";}
function TrackMemberActivity(strActivity,strExtraInfo,strShareFrom,strWorkDestination,bSharePromotedWork,bShareNonPromotedWork,bVisitorSharing)
{var fnAjaxCallback=function(strId)
{if(strExtraInfo.startsWith("email"))
{if(strId!=null&&strId!=""&&strShareFrom=="book"){strWorkDestination+=("&shareid="+strId);}
email_click_post(bSharePromotedWork,bShareNonPromotedWork,bVisitorSharing,strWorkDestination);}
else if(strExtraInfo.startsWith("facebook"))
{if(strId!=null&&strId!=""&&strShareFrom=="book"){strWorkDestination+=("%26shareid="+strId);}
fbs_click_post(strWorkDestination);}
else if(strExtraInfo.startsWith("twitter"))
{if(strId!=null&&strId!=""&&strShareFrom=="book"){strWorkDestination+=("%26shareid="+strId);}
twitter_click_post(strWorkDestination);}}
var strLink=LinkSmart("ajax.aspx",["fn","track_member_activity"]);var postInputArray=["activity",strActivity,"extra_info",strExtraInfo];ajaxCall(strLink,fnAjaxCallback,postInputArray);}
function FormatDate(dt)
{var aMonths=[g_resxStrings.January,g_resxStrings.February,g_resxStrings.March,g_resxStrings.April,g_resxStrings.May,g_resxStrings.June,g_resxStrings.July,g_resxStrings.August,g_resxStrings.September,g_resxStrings.October,g_resxStrings.November,g_resxStrings.December];var day=dt.getDate();var month=dt.getMonth();var year=dt.getFullYear();return(aMonths[month]+" "+day+", "+year);}
var g_strClickErrorMessage=null;function DisplayNoClickMessage()
{if(g_strClickErrorMessage)
alert(g_strClickErrorMessage);}
function clickIE()
{if(event.button==2)
{DisplayNoClickMessage();return false;}}
function clickNS(e)
{if(document.layers||document.getElementById&&!document.all)
{if(e.which==2||e.which==3)
{DisplayNoClickMessage();return false;}}}
function DisableClicks(strErrorMessage)
{if(strErrorMessage)
g_strClickErrorMessage=strErrorMessage;if(document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else if(document.all&&!document.getElementById)
{document.onmousedown=clickIE;}
document.oncontextmenu=function(){return false;};document.body.ondragstart=function(){return false;};document.body.onselectstart=function(){return false;};}
function fbs_click(strShareFrom,strDefaultDestination,strShareType)
{if(strShareType==null||strShareType==""){strShareType="";}
else{strShareType=" "+strShareType;}
TrackMemberActivity(strShareFrom+' share','facebook'+strShareType,strShareFrom,strDefaultDestination);pageTracker._trackPageview('/share/'+strShareFrom+'/facebook');}
function fbs_click_post(strDefaultDestination){var fnCallback=function(strShortUrl)
{if(strShortUrl!="")
{u=strShortUrl;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');}}
var strLink=LinkSmart("ajax.aspx",["fn","get_short_url","original_url",strDefaultDestination]);ajaxCall(strLink,fnCallback);}
function twitter_click(strShareFrom,strDefaultDestination,strShareType)
{if(strShareType==null||strShareType==""){strShareType="";}
else{strShareType=" "+strShareType;}
TrackMemberActivity(strShareFrom+' share','twitter'+strShareType,strShareFrom,strDefaultDestination);pageTracker._trackPageview('/share/'+strShareFrom+'/twitter');return false;}
function twitter_click_post(strDefaultDestination)
{var fnCallback=function(strShortUrl)
{if(strShortUrl!="")
{window.open('http://twitter.com/home?status=WEbook tweet: '+strShortUrl);}}
var strLink=LinkSmart("ajax.aspx",["fn","get_short_url","original_url",strDefaultDestination]);ajaxCall(strLink,fnCallback);}
function myspace_click(strShareFrom)
{if(document.getElementById('convertedToShort').value=="false")
{var fnCallback=function(strShortUrl)
{if(strShortUrl!="")
{TrackMemberActivity(strShareFrom+' share','myspace');pageTracker._trackPageview('/share/'+strShareFrom+'/myspace');document.getElementById('u').value=strShortUrl;document.getElementById('convertedToShort').value="true"
document.getElementById('myspacepostto').submit();return false;}}
var strLink=LinkSmart("ajax.aspx",["fn","get_short_url","original_url",document.getElementById('u').value]);ajaxCall(strLink,fnCallback);}
else
{TrackMemberActivity(strShareFrom+' share','myspace');pageTracker._trackPageview('/share/'+strShareFrom+'/myspace');document.getElementById('myspacepostto').submit();}
return false;}
function email_click(strShareFrom,bSharePromotedWork,bShareNonPromotedWork,bVisitorSharing,strWorkDestination,strShareType)
{if(strShareType==null||strShareType=="")
{strShareType="";}
else
{strShareType=" "+strShareType;}
pageTracker._trackPageview('/share/'+strShareFrom+'/email');if(strShareFrom.length>=4)
{strShareFrom=strShareFrom.substring(0,4);}
TrackMemberActivity(strShareFrom+' share','email'+strShareType,strShareFrom,strWorkDestination,bSharePromotedWork,bShareNonPromotedWork,bVisitorSharing);}
function email_click_post(bSharePromotedWork,bShareNonPromotedWork,bVisitorSharing,strWorkDestination)
{var fnCallback=function(strShortUrl)
{if(strShortUrl!="")
{LoadPlaxoJs();if(bSharePromotedWork)
{new SplashScreen(LinkSmart("ajax.aspx",["fn","invite_a_friend_display","popup","true","bSharePageToFamePromotedWork","true","strWorkDestination",strShortUrl]),"400px",null,null);}
else if(bShareNonPromotedWork)
{new SplashScreen(LinkSmart("ajax.aspx",["fn","invite_a_friend_display","popup","true","bSharePageToFameNonPromotedWork","true","strWorkDestination",strShortUrl]),"400px",null,null);}
else if(bVisitorSharing)
{new SplashScreen(LinkSmart("ajax.aspx",["fn","invite_a_friend_display","popup","true","bVisitorSharing","true","strWorkDestination",strShortUrl]),"400px",null,null);}
else
{new SplashScreen(LinkSmart("ajax.aspx",["fn","invite_a_friend_display","popup","true","bSharePageToFameGeneral","true","strWorkDestination",strShortUrl]),"400px",null,null);}}}
var strLink=LinkSmart("ajax.aspx",["fn","get_short_url","original_url",strWorkDestination]);ajaxCall(strLink,fnCallback);}
function SetShare(strShareId,strRoundId,strClusterId,strProjectId)
{var fnCallback=function(){}
var strLink=LinkSmart("ajax.aspx",["fn","poll_set_share","s",strShareId,"r",strRoundId,"c",strClusterId,"p",strProjectId]);ajaxCall(strLink,fnCallback);}
function GenericPopup(callbackFn,strPopupId,strTitle,strText,strWidth,bShortLink)
{new SplashScreen(LinkSmart("ajax.aspx",["fn","popup_display","popupId",strPopupId,"title",strTitle,"text",strText,"short_link",bShortLink]),strWidth,callbackFn,callbackFn);}
function ClosePopup()
{g_splashScreen.Close();}
function ScrollToTop()
{scroll(0,0);}
function ComicPopup(strText,strTop,strLeft,strConfirmCallback)
{var comicPopupText=document.getElementById("comicPopupText");comicPopupText.innerHTML=strText;if(strConfirmCallback!=null&&strConfirmCallback!="")
{document.getElementById("alertStyle").style.display="none";document.getElementById("confirmStyle").style.display="";strConfirmJs="document.getElementById('popupComicArea').style.display='none';"+strConfirmCallback+";return false;";document.getElementById("ButtonOK").onclick=new Function(strConfirmJs);}
else
{document.getElementById("confirmStyle").style.display="none";document.getElementById("alertStyle").style.display="";}
var popupComicArea=document.getElementById("popupComicArea");popupComicArea.style.top=strTop+"px";popupComicArea.style.left=strLeft+"px";popupComicArea.style.display="";}
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;if(_this.m_strReturnToLink!=null&&_this.m_strReturnToLink!="")
{window.location=_this.m_strReturnToLink;}}
_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)
{if(document.getElementById("backButton")!=null)
document.getElementById("backButton").style.visibility="";}
else
{if(document.getElementById("backButton")!=null)
document.getElementById("backButton").style.visibility="hidden";}
if(_this.m_iCurrentPaneIndex<(_this.m_paneInfo.length-1))
{if(document.getElementById("nextButton")!=null)
document.getElementById("nextButton").style.visibility="";}
else
{if(document.getElementById("nextButton")!=null)
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;var g_strNonFictionSampleTypeId="7276aaa0041a43f681dd1253c3358907";var g_strNoSampleTypeId="c009663fbecf41528c77d29960e28e04";function OpenLiteraryAgentWizard(strProjectId,strReturnToLink)
{g_wizard=new LiteraryAgentWizard(strProjectId,strReturnToLink);g_wizard.Init();}
LiteraryAgentWizard.prototype=new Wizard();function LiteraryAgentWizard(strProjectId,strReturnToLink)
{var _this=this;_this.m_strProjectId=strProjectId;_this.m_strReturnToLink=strReturnToLink;}
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_strPreviouslySelectedGenreId=json.previouslySelectedGenreId;_this.m_strPreviouslySelectedGenre2Id=json.previouslySelectedGenre2Id;_this.m_allSampleTypeNames=json.allSampleTypeNames;_this.m_iCurrentPaneIndex=0;_this.m_iHighestPaneReached=0;_this.m_bIsNavigating=false;_this.m_bIsSubmitting=false;_this.m_bIsSaving=false;UpdateGenres();_this.OnChangeCategory();_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(LinkSecure("ajax.aspx",queryArray),"746px",null,null,onLoadWizard);}
LiteraryAgentWizard.prototype.SubmitNow=function(bIsRejectedByQualityControl)
{var _this=this;if(_this.m_bIsSubmitting)
{return;}
_this.m_bIsSubmitting=true;if(!_this.ValidateSubmit())
{_this.m_bIsSubmitting=false;return;}
if(bIsRejectedByQualityControl)
{if(!confirm(g_resxStrings["ConfirmResubmitToQualityControl"]))
{_this.m_bIsSubmitting=false;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;if(_this.IsOnPane("projectSample")&&!_this.IsFictionSelected())
{_this.AddOrUpdatePopulatedSampleType(g_strNonFictionSampleTypeId,tinyMCE.get("nonfictionSampleTextarea").getContent());}
document.getElementById("saveForLater").value="true";document.getElementById("wizardForm").submit();}
LiteraryAgentWizard.prototype.ValidateCreateProject=function(fnCallBack,returnToStep)
{var _this=this;var projectTitle=document.getElementById("titleText").value;var urlTitle=document.getElementById("urlTitle").value;var strLink=LinkSecure("ajax.aspx",["fn","validate_new_project_info"]);var postInputArray=['projectTitle',projectTitle,'urlTitle',urlTitle,'returnToStep',returnToStep,'projectGenre',GetSelectedGenreId(),'projectGenre2',GetSelectedGenre2Id(),'bIsFiction',_this.IsFictionSelected()];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.IsNavigatingForwardTo("projectSample",iOldPaneIndex,iNewPaneIndex))
{_this.UpdateProjectSampleStepForSelectedCategory();}
if(_this.IsNavigatingFrom("projectSample",iOldPaneIndex))
{if(!_this.IsFictionSelected())
{_this.AddOrUpdatePopulatedSampleType(g_strNonFictionSampleTypeId,tinyMCE.get("nonfictionSampleTextarea").getContent());}}
if(_this.IsNavigatingTo("finishStep",iNewPaneIndex))
{_this.CheckAgentSelection();}
if(_this.IsNavigatingForwardFrom("createProject",iOldPaneIndex,iNewPaneIndex))
{if(_this.m_strProjectId==null)
{UpdateUrl();}
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 if(_this.IsNavigatingForwardFrom("queryLetter",iOldPaneIndex,iNewPaneIndex)&&_this.IsFictionSelected())
{var strLink=LinkSecure("ajax.aspx",["fn","populate_sample_step_for_selected_agents"]);var postInputArray=[];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);}}
var populatedSampleTypeIds=document.getElementById("allPopulatedSampleTypeIds").childNodes;for(i=0;i<populatedSampleTypeIds.length;i++)
{if(typeof(populatedSampleTypeIds[i].value)!="undefined")
{var strPopulatedSampleTypeId=populatedSampleTypeIds[i].value;postInputArray.push('populatedSampleTypeId');postInputArray.push(strPopulatedSampleTypeId);}}
if(_this.m_strProjectId!=null)
{postInputArray.push('projectId');postInputArray.push(_this.m_strProjectId);}
var fnCallback=function(html,json)
{_this.selectedSampleTypeIds=json.selectedSampleTypeIds;document.getElementById("fictionSampleStep").innerHTML=html;var updatedSampleTypeIds=document.getElementById("updated_allPopulatedSampleTypeIds").childNodes;for(i=0;i<updatedSampleTypeIds.length;i++)
{if(typeof(updatedSampleTypeIds[i].value)!="undefined")
{var strPopulatedSampleTypeId=updatedSampleTypeIds[i].value;var strSampleText=document.getElementById("updated_sampleText_"+strPopulatedSampleTypeId).value;_this.AddPopulatedSampleTypeIfDoesntExist(strPopulatedSampleTypeId,strSampleText);}}
_this.NavigateStepTwo(iNewPaneIndex,oldPane,newPane);}
ajaxCall(strLink,fnCallback,postInputArray);}
else
{_this.NavigateStepTwo(iNewPaneIndex,oldPane,newPane);}}
LiteraryAgentWizard.prototype.AddOrUpdatePopulatedSampleType=function(strSampleTypeId,strSampleText)
{var _this=this;_this.AddPopulatedSampleTypeIfDoesntExist(strSampleTypeId,strSampleText);var oSample=document.getElementById("sampleText_"+strSampleTypeId);oSample.value=strSampleText;}
LiteraryAgentWizard.prototype.AddPopulatedSampleTypeIfDoesntExist=function(strSampleTypeId,strSampleText)
{var _this=this;var oSampleTypeId=document.getElementById(strSampleTypeId);if(oSampleTypeId==null)
{oSampleTypeId=document.createElement("input");oSampleTypeId.type="hidden";oSampleTypeId.name="populatedSampleTypeId";oSampleTypeId.id=strSampleTypeId;oSampleTypeId.value=strSampleTypeId;document.getElementById("allPopulatedSampleTypeIds").appendChild(oSampleTypeId);}
var oSample=document.getElementById("sampleText_"+strSampleTypeId);if(oSample==null)
{oSample=document.createElement("input");oSample.type="hidden";oSample.id="sampleText_"+strSampleTypeId;oSample.name="sampleText_"+strSampleTypeId;oSample.value=strSampleText;document.getElementById("allSampleTexts").appendChild(oSample);}}
LiteraryAgentWizard.prototype.UpdateProjectSampleStepForSelectedCategory=function()
{var _this=this;if(_this.IsFictionSelected())
{document.getElementById("fictionSampleStep").style.display="";document.getElementById("nonFictionSampleStep").style.display="none";var oNonFiction=document.getElementById(g_strNonFictionSampleTypeId);if(oNonFiction)
{oNonFiction.parentNode.removeChild(oNonFiction);oNonFiction=document.getElementById("sampleText_"+g_strNonFictionSampleTypeId);oNonFiction.parentNode.removeChild(oNonFiction);}}
else
{document.getElementById("fictionSampleStep").style.display="none";document.getElementById("nonFictionSampleStep").style.display="";var populatedSampleTypeIds=document.getElementById("allPopulatedSampleTypeIds").childNodes;for(i=0;i<populatedSampleTypeIds.length;i++)
{var strSampleTypeId=populatedSampleTypeIds[i].value;if(typeof(strSampleTypeId)!="undefined"&&strSampleTypeId!=g_strNonFictionSampleTypeId)
{populatedSampleTypeIds[i].parentNode.removeChild(populatedSampleTypeIds[i]);var oSampleText=document.getElementById("sampleText_"+strSampleTypeId);oSampleText.parentNode.removeChild(oSampleText);}}}}
LiteraryAgentWizard.prototype.ValidateProjectSampleFields=function()
{var _this=this;if(_this.IsFictionSelected())
{for(var i=0;i<_this.selectedSampleTypeIds.length;i++)
{var strTypeId=_this.selectedSampleTypeIds[i];if(strTypeId!=g_strNoSampleTypeId)
{var oPopulatedSampleType=document.getElementById(strTypeId);if(oPopulatedSampleType==null||oPopulatedSampleType==undefined||document.getElementById("sampleText_"+strTypeId).value.length==0)
{alert(g_resxStrings.MustPopulateAllSampleTypes);return false;}}}}
else
{}
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))
{var oTinyMCE=tinyMCE.get("sampleTextarea");if(oTinyMCE)
{tinyMCE.execCommand("mceRemoveControl",true,"sampleTextarea");}
oTinyMCE=tinyMCE.get("nonfictionSampleTextarea");if(oTinyMCE)
{tinyMCE.execCommand("mceRemoveControl",true,"nonfictionSampleTextarea");}}
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))
{if(!_this.IsFictionSelected())
{tinyMCE.execCommand("mceAddControl",true,"nonfictionSampleTextarea");}}
if(_this.IsNavigatingForwardFrom("queryLetter",iOldPaneIndex,iNewPaneIndex)||_this.IsNavigatingForwardFrom("projectSample",iOldPaneIndex,iNewPaneIndex))
{var oNextButton=document.getElementById("nextButton");var oNewNextButton=oNextButton.cloneNode(true);oNextButton.parentNode.replaceChild(oNewNextButton,oNextButton);}
_this.m_bIsNavigating=false;}
LiteraryAgentWizard.prototype.IsFictionSelected=function()
{var _this=this;var bFiction=document.getElementById("radioProjectCategory_00a8332a3ccc44e0a96e528a0c1af4c5").checked;return(bFiction);}
LiteraryAgentWizard.prototype.OnChangeCategory=function()
{var _this=this;var oManuscriptWordCount=document.getElementById("manuscriptWordCount");if(_this.IsFictionSelected())
{oManuscriptWordCount.style.display="";}
else
{oManuscriptWordCount.style.display="none";}}
LiteraryAgentWizard.prototype.CountSelectedAgents=function()
{var _this=this;var agents=document.getElementsByName("selectedAgentId");var count=0;for(var i=0;i<agents.length;i++)
{if(agents[i].checked)
{count++;}}
return count;}
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,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");bio.innerHTML="";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);projSampleDiv=document.getElementById("projSample");projSampleDiv.innerHTML="";sampleTypes=document.getElementById("allPopulatedSampleTypeIds").childNodes;sampleTexts=document.getElementById("allSampleTexts").childNodes;for(i=0;i<sampleTypes.length;i++)
{if(typeof(sampleTypes[i].value)!="undefined")
{temp=document.createElement("div");sampleId=sampleTypes[i].value;tempSampleTextId="sampleText_"+sampleId;tempSampleText=document.getElementById(tempSampleTextId).value;tempSampleName=_this.m_allSampleTypeNames[sampleId];temp.innerHTML="<strong>"+tempSampleName+"</strong><br /> "+tempSampleText;temp.id="samplePreview_"+sampleTypes[i].value;if(sampleTypes.length-1==i)
{temp.style.borderBottom='1px solid #d4d4d4';}
projSampleDiv.appendChild(temp);}}
allQueryLettersDiv=document.getElementById("queries");allQueryLettersDiv.innerHTML=" ";var arrCheckBoxes=document.getElementsByName("selectedAgentId");for(var i=0;i<arrCheckBoxes.length;i++)
{if(arrCheckBoxes[i].checked==true)
{var strAgentId=arrCheckBoxes[i].value;temp=document.createElement("div");var strAgentName=document.getElementById("agentName_queryLetter_"+strAgentId).innerHTML;var oQueryLetter=document.getElementById("queryLetter_"+strAgentId);temp.innerHTML=strAgentName+oQueryLetter.value;temp.id="pre_"+oQueryLetter.name;if(arrCheckBoxes.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("sampleTextarea");if(oTinyMCE)
{tinyMCE.execCommand("mceRemoveControl",true,"sampleTextarea");}
oTinyMCE=tinyMCE.get("nonfictionSampleTextarea");if(oTinyMCE)
{tinyMCE.execCommand("mceRemoveControl",true,"nonfictionSampleTextarea");}
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;}
document.getElementById("queryLetterEditor").style.display="";document.getElementById("grayOutButtons").style.display="";document.getElementById("agentListsDiv").style.display="none";document.getElementById("cancelAddAgentButton").style.display=(bFromAddAgent?"":"none");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.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();}
LiteraryAgentWizard.prototype.EditSample=function(strSampleTypeId,bFromAddSample)
{var _this=this;_this.m_strCurrentlyEditingSampleTypeId=strSampleTypeId;var strContent="";var oSampleText=document.getElementById("sampleText_"+_this.m_strCurrentlyEditingSampleTypeId);if(oSampleText)
{strContent=oSampleText.value;}
document.getElementById("sampleEditor").style.display="";document.getElementById("grayOutButtons").style.display="";document.getElementById("fictionSampleStep").style.display="none";document.getElementById("cancelAddSampleButton").style.display=(bFromAddSample?"":"none");document.getElementById("agentsForSampleType").innerHTML=document.getElementById("agentsForSampleType_"+strSampleTypeId).innerHTML;document.getElementById("editingSampleTypeName").innerHTML=_this.m_allSampleTypeNames[strSampleTypeId];var fnAfter=function()
{tinyMCE.get("sampleTextarea").setContent(strContent);}
var oTinyMCE=tinyMCE.get("sampleTextarea");if(!oTinyMCE)
{tinyMCE.execCommand("mceAddControl",true,"sampleTextarea");window.setTimeout(fnAfter,500);}
else
{fnAfter();}}
LiteraryAgentWizard.prototype.SaveSample=function()
{var _this=this;_this.AddOrUpdatePopulatedSampleType(_this.m_strCurrentlyEditingSampleTypeId,tinyMCE.get("sampleTextarea").getContent());document.getElementById("addSampleLink_"+_this.m_strCurrentlyEditingSampleTypeId).style.display="none";document.getElementById("editSampleLink_"+_this.m_strCurrentlyEditingSampleTypeId).style.display="";var dtNow=new Date();document.getElementById("lastModified_"+_this.m_strCurrentlyEditingSampleTypeId).innerHTML=StringFormat(g_resxStrings.LastModifiedLabel,FormatDate(dtNow));_this.CloseSampleEditor();}
LiteraryAgentWizard.prototype.CloseSampleEditor=function()
{var _this=this;document.getElementById("sampleEditor").style.display="none";document.getElementById("grayOutButtons").style.display="none";document.getElementById("fictionSampleStep").style.display="";_this.m_strCurrentlyEditingSampleTypeId="";}
LiteraryAgentWizard.prototype.CancelAddSample=function()
{var _this=this;_this.CloseSampleEditor();}
LiteraryAgentWizard.prototype.ValidateSubmit=function()
{var _this=this;if(document.getElementById("AIpreviewedCheckbox")!=null&&!document.getElementById("AIpreviewedCheckbox").checked)
{alert(g_resxStrings.YouMustCheckPreviewedCheckbox);return false;}
return true;}
LiteraryAgentWizard.prototype.SubmitFailed=function(strError,strProjectId)
{var _this=this;_this.m_bIsNavigating=false;_this.m_bIsSubmitting=false;_this.m_bIsSaving=false;document.getElementById("savedProjectId").value=strProjectId;}
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 faqAnswers(questionNum){currentQuestion=0;showAnswersCurrent=document.getElementById("showAnswers");showAnswersCurrentLink=document.getElementById("open");clickedLink=document.getElementById("close"+questionNum);showAnswersNext=document.getElementById("closeAnswers"+questionNum);if(showAnswersCurrent!=null){currentQuestion=showAnswersCurrentLink.className;showAnswersCurrent.id="closeAnswers"+currentQuestion;showAnswersCurrentLink.id="close"+currentQuestion;}
if(questionNum!=currentQuestion){showAnswersNext.id="showAnswers";clickedLink.id="open";}
return false;}
function openClose(idName,number){section=document.getElementById(idName+"OpenSection"+number);openLink=document.getElementById(idName+"Open"+number);closeLink=document.getElementById(idName+"Close"+number);if(openLink.style.display=="none"){section.style.display="none";openLink.style.display="block";closeLink.style.display="none";}else{section.style.display="block";openLink.style.display="none";closeLink.style.display="block";}}
function toggleVideo(){var eleObj=document.getElementById("toggleVideoDiv");var icoObj=document.getElementById("toggleVideoIcon");if(eleObj.style.display=="block"){eleObj.style.display="none";icoObj.src=LinkSmart("resources/expand.gif");}
else{eleObj.style.display="block";icoObj.src=LinkSmart("resources/collapse.gif");}}
var kCountryCodeUS="US";var kCountryCodeCanada="CA";function DisplayStateOptions()
{var strCountry=document.getElementById("comboCountry").value;var comboUSStyle="none",comboCanadaStyle="none",textOtherStyle="none";if(strCountry==kCountryCodeUS)
{comboUSStyle="";}
else if(strCountry==kCountryCodeCanada)
{comboCanadaStyle="";}
else
{textOtherStyle="";}
document.getElementById("comboUSState").style.display=comboUSStyle;document.getElementById("comboCanadaProvince").style.display=comboCanadaStyle;document.getElementById("textProvinceOther").style.display=textOtherStyle;}
