
function help_window(helpurl)
{HelpWin=window.open(helpurl,'HelpWindow','scrollbars=yes,resizable=yes,toolbar=no,height=400,width=400');}
function resource_list_window(){width=500;height=450;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);HelpWin=window.open('?op=resourceList','ResourceListWindow','top='+y+',left='+x+',scrollbars=yes,resizable=yes,toolbar=no,height='+height+',width='+width);}
function userPictureSelectWindow()
{width=500;height=450;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);UserPicture=window.open('?op=userPictureSelect','UserPictureSelect','top='+y+',left='+x+',scrollbars=yes,resizable=yes,toolbar=no,height='+height+',width='+width);}
function resetUserPicture()
{window.document.userSettings.userPictureId.value=0;window.document.userSettings.userPicture.src='imgs/no-user-picture.jpg';}
function resetBlogId()
{window.document.updateGlobalSettings.blogId.value='';}
function emptyList(box)
{while(box.options.length)box.options[0]=null;}
function fillList(box,numElems)
{for(i=1;i<=numElems;i++){option=new Option(i,i);box.options[box.length]=option;}
box.selectedIndex=0;}
function changeList(box)
{daysMonth=days[box.options[box.selectedIndex].value-1];emptyList(box.form.postDay);fillList(box.form.postDay,daysMonth);}
function addText(input,insText)
{input.focus();if(input.createTextRange){parent.opener.document.selection.createRange().text+=insText;}
else if(input.setSelectionRange){var len=input.selectionEnd;input.value=input.value.substr(0,len)+insText+input.value.substr(len);input.setSelectionRange(len+insText.length,len+insText.length);}
else{input.value+=insText;}}
function returnResourceInformation(resId,url)
{parent.opener.document.userSettings.userPictureId.value=resId;parent.opener.document.userSettings.userPicture.src=url;parent.opener.document.userSettings.userPictureUrl.value=url;}
function openScreenshotWindow(destUrl)
{ScreenshotWindow=window.open(destUrl,'Screenshot','scrollbars=yes,resizable=yes,toolbar=no,height=600,width=800');}
function openTemplateChooserWindow()
{width=500;height=450;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);TemplateSelectorWindow=window.open('?op=blogTemplateChooser','TemplateChooser','top='+y+',left='+x+',scrollbars=yes,resizable=yes,toolbar=no,height='+height+',width='+width);}
function blogTemplateSelector(templateId)
{templateSelectList=parent.opener.document.blogSettings.blogTemplate;for(i=0;i<templateSelectList.options.length;i++){if(templateSelectList.options[i].value==templateId){templateSelectList.selectedIndex=i;break;}}
window.close();}
function toggleNotificationArea()
{var elem=document.getElementById('emailTextNotification');if(elem.style.display=='none')
elem.style.display='';else
elem.style.display='none';return true;}
var currentSection='';sections=["general","summary","templates","urls","email","uploads","helpers","interfaces","security","bayesian","resources","search"];function _toggle(sectionId)
{element=document.getElementById(sectionId);currentStatus=element.style.display;if(element.style.display=='none')
element.style.display='block';else
element.style.display='none';return true;}
function toggleSection(sectionId)
{if(sectionId=='none')
return false;toggleAll(false);_toggle(sectionId);currentSection=sectionId;return true;}
function toggleAll(enabled)
{if(enabled)statusString='block';else statusString='none';for(i=0;i<sections.length;i++){element=document.getElementById(sections[i]);element.style.display=statusString;}}
function moveElement(srcList,dstList)
{indexId=srcList.selectedIndex;if(indexId==-1)
return false;optText=srcList.options[indexId].text;optId=srcList.options[indexId].value;if(optId==-1){return false;}
newOpt=new Option(optText,optId);dstList.options[dstList.options.length]=newOpt;srcList.options[indexId]=null;return true;}
function listSelectAll(listId)
{list=document.getElementById(listId);for(i=0;i<list.options.length;i++){list.options[i].selected=true;}
return true;}
function editBlogRemoveSelected()
{userList=document.getElementById('userList');length=userList.options.length;for(i=0;i<length;i++){if(userList.options[i]){if(userList.options[i].selected){userList.options[i]=null;i--;}}}
return(true);}
function MM_jumpMenu(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if(restore)selObj.selectedIndex=0;}
function getPostEditFormElements(formId)
{var formData='';form=document.getElementById(formId);for(i=0;i<form.elements.length;i++){itemName=form.elements[i].name;itemValue=form.elements[i].value;if(itemName!="op"){if(itemName=="postCategories[]"){for(var j=0;j<form.elements[i].options.length;j++){if(form.elements[i].options[j].selected)
formData=formData+itemName+"="+form.elements[i].options[j].value+"&";}}
else if(itemName=="postText"&&htmlAreaEnabled){if(blogLocale=="UTF-8"){formData=formData+itemName+"="+encodeURIComponent(tinyMCE.getContent('postText'))+"&";}else{formData=formData+itemName+"="+escape(tinyMCE.getContent('postText'))+"&";}}
else if(itemName=="postExtendedText"&&htmlAreaEnabled){if(blogLocale=="UTF-8"){formData=formData+itemName+"="+encodeURIComponent(tinyMCE.getContent('postExtendedText'))+"&";}else{formData=formData+itemName+"="+escape(tinyMCE.getContent('postExtendedText'))+"&";}}
else{if(blogLocale=="UTF-8"){formData=formData+itemName+"="+encodeURIComponent(itemValue)+"&";}else{formData=formData+itemName+"="+escape(itemValue)+"&";}}}}
return formData;}
function getFlashPlayerHTML(url,height,width)
{var playerUrl=plogBaseUrl+"/flash/mp3player/mp3player.swf";var htmlCode="<object data=\""+playerUrl+"\" type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\" class=\"ltPlayer\">"+"<param name=\"quality\" value=\"best\" />"+"<param name=\"bgcolor\" value=\"#FFFFFF\" />"+"<param name=\"movie\" value=\""+playerUrl+"\" />"+"<param name=\"FlashVars\" value=\"&file="+url+"&height="+height+"&width="+width+"\" />"+"</object>";return htmlCode;}