/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 4.0.0 Alpha 5
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2009 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
var jsAction;var curr_SectId=false;var curr_catid=false;var curr_nodeid=false;var submitAction;var hiddenDiv;function setFormValue(A,B){if(document.getElementById(A)!=undefined){document.getElementById(A).value=B}else{var C=document.createElement("input");C.type="hidden";C.name=A;C.id=A;C.value=B;document.getElementById("cms_data").appendChild(C)}}function searchNodes(A,B){if(A==undefined){A="."}url=A+"/ajax.php?do=find_leaves";if(document.getElementById("contenttypeid")!=undefined&&document.getElementById("contenttypeid").value!=""){url=url+"&contenttypeid="+document.getElementById("contenttypeid").value+"&formid="+encodeURI(B)}if(document.getElementById("title_filter")!=undefined&&document.getElementById("title_filter").value!=""){url=url+"&title_filter="+encodeURI(document.getElementById("title_filter").value)}if(document.getElementById("state_filter")!=undefined&&document.getElementById("state_filter").value!=""){url=url+"&state_filter="+document.getElementById("state_filter").value}if(document.getElementById("author_filter")!=undefined&&document.getElementById("author_filter").value!=""){url=url+"&author_filter="+document.getElementById("author_filter").value}load_html("search_results",url,"",null,null)}function setSection(B,A){if(jsAction=="move_section"||jsAction=="publish_section"||jsAction=="unpublish_section"||jsAction=="move_node"||jsAction=="publish_node"||jsAction=="unpublish_node"||jsAction=="new"||jsAction=="filter_category"||jsAction=="filter_section"||jsAction=="filter_nodesection"){document.getElementById("sectionid").value=B;document.getElementById("do").value=jsAction;document.getElementById("cms_data").submit()}else{if(jsAction=="new_section"||jsAction=="save_section"){setFormValue("target_sectionid",B);return false}else{if(jsAction=="doCategory"){flagSection(B);load_html("catedit_category_list",script_location+"/ajax.php?do=list_categories&sectionid="+B,"",null,null);setFormValue("sectionid",B);setFormValue("curr_SectId",B)}else{if(jsAction=="doSection"){flagSection(B);setFormValue("target_sectionid",B);setFormValue("sectionid",curr_SectId)}else{if(document.getElementById("sectionName")!=undefined){document.getElementById("sectionName").innerHTML=A}if(document.getElementById("sectionid")!=undefined){document.getElementById("sectionid").value=B}return false}}}}}function showCatEdit(C,A,B,D){submitAction="";jsAction="doCategory";curr_catid=B;curr_SectId=A;document.getElementById("title_editor").style.display="block";document.getElementById("categoryid").value=-1;document.getElementById("category_title").value=D;if(parseInt(A)>0){flagSection(A)}else{clearSectionFlags()}if(parseInt(B)>0){flagCategory(B)}else{clearCategoryFlags()}submitAction=C}function showSectionEdit(C,A,B,D){submitAction="";jsAction="doSection";document.getElementById("title_editor").style.display="block";document.getElementById("sectionid").value=-1;document.getElementById("section_title").value=D;curr_nodeid=B;curr_SectId=A;if("new_section"==C){flagSection(B)}else{flagSection(A)}submitAction=C}function setOrder(C,A,B){document.getElementById("do").value="set_order";setFormValue("id",C);setFormValue("sectionid",A);setFormValue("displayorder",B);document.getElementById("cms_data").submit()}function confirmCategoryDelete(B,A){if(B){if(confirm(A)){document.getElementById("categoryid").value=B;document.getElementById("do").value="delete_category";document.getElementById("cms_data").submit()}}}function confirmSectionDelete(B,A){if(B){if(confirm(A)){setFormValue("delete_sectionid",B);document.getElementById("do").value="delete_section";document.getElementById("cms_data").submit()}}}function setCategory(A,B){if(""==document.getElementById("category_title").value){alert(A);return }document.getElementById("title").value=document.getElementById("category_title").value;if("edit"==submitAction){document.getElementById("categoryid").value=curr_catid;document.getElementById("do").value="save_category";document.getElementById("cms_data").submit()}if("new"==submitAction){if(!(parseInt(curr_catid)>0||parseInt(document.getElementById("sectionid").value)>0)){alert(B);return }if(curr_catid){setFormValue("categoryid",curr_catid)}setFormValue("do","new_category");document.getElementById("cms_data").submit()}}function setEditedSection(A){if(""==document.getElementById("section_title").value){alert(A);return }setFormValue("title",document.getElementById("section_title").value);setFormValue("sectionid",curr_SectId);setFormValue("nodeid",curr_nodeid);document.getElementById("do").value=submitAction;document.getElementById("cms_data").submit()}function setCategoryView(){document.getElementById("catedit_section_list").style.display="none";document.getElementById("catedit_category_list").style.display="block";document.getElementById("section_tab").style.backgroundColor="#ffffff";document.getElementById("category_tab").style.backgroundColor="#bbbbbb"}function setSectionView(){document.getElementById("catedit_section_list").style.display="block";document.getElementById("catedit_category_list").style.display="none";document.getElementById("section_tab").style.backgroundColor="#bbbbbb";document.getElementById("category_tab").style.backgroundColor="#ffffff"}function flagSection(A){if("filter"==submitAction){document.getElementById("sectionid").value=A;document.getElementById("cms_data").submit()}i=1;while(document.getElementById("sectedit_id_"+i)!=undefined){if(document.getElementById("sectedit_id_"+i).value==A){document.getElementById("sectchecked_img_"+i).style.display="inline"}else{document.getElementById("sectchecked_img_"+i).style.display="none"}i++}if(document.getElementById("target_categoryid")!=undefined){document.getElementById("target_categoryid").value=false}}function clearSectionFlags(){i=1;while(document.getElementById("sectedit_id_"+i)!=undefined){document.getElementById("sectchecked_img_"+i).style.display="none";i++}}function flagCategory(A){if(parseInt(A)<1){document.getElementById("catchecked_img_0").style.display="inline"}else{document.getElementById("catchecked_img_0").style.display="none"}i=1;while(document.getElementById("catedit_id_"+i)!=undefined){if(document.getElementById("catedit_id_"+i).value==A){document.getElementById("catchecked_img_"+i).style.display="inline"}else{document.getElementById("catchecked_img_"+i).style.display="none"}i++}if(document.getElementById("target_categoryid")!=undefined){document.getElementById("target_categoryid").value=A}}function clearCategoryFlags(){i=1;while(document.getElementById("catedit_id_"+i)!=undefined){document.getElementById("catchecked_img_"+i).style.display="none";i++}}function getSectionList(A){load_html("cms_sections_list",script_location+"/ajax.php?do=list_allsection&order="+A,"",null,null)}function showNodeWindow(A){jsAction=A;document.getElementById("sel_node_0").style.display="block";document.getElementById("sel_node_0").focus();document.getElementById("title_filter").value="";if(document.getElementById("section_search_button")!=undefined){document.getElementById("section_search_button").click()}}function deleteGrouping(B,A){if(confirm(A)){document.getElementById("do").value="delete_"+B;document.getElementById("cms_data").submit()}else{return false}}function clearSearch(){if(document.getElementById("state_filter")!=undefined){document.getElementById("state_filter").selectedIndex=-1}if(document.getElementById("title_filter")!=undefined){document.getElementById("title_filter").value=""}if(document.getElementById("author_filter")!=undefined){document.getElementById("author_filter").selectedIndex=-1}if(document.getElementById("contenttypeid")!=undefined){document.getElementById("contenttypeid").selectedIndex=-1}}function toggleSubSection(A,C,B){if(parseInt(A)>0&&document.getElementById("sect_toggle_"+A)!=undefined){sect_body=document.getElementById("detail_list").tBodies[0];if(document.getElementById("sect_toggle_"+A).innerHTML==" -"){document.getElementById("sect_toggle_"+A).innerHTML=" +";for(i=sect_body.rows.length-1;i>0;i--){if(parseInt(sect_body.rows[i].cells[0].innerHTML)==A){if(i<sect_body.rows.length-2){parent_level=parseInt(sect_body.rows[i].cells[1].innerHTML);i++;this_level=parseInt(sect_body.rows[i].cells[1].innerHTML);if(this_level==parent_level+1){while((i<sect_body.rows.length)&&parseInt(sect_body.rows[i].cells[1].innerHTML)>parent_level){sect_body.deleteRow(i)}}break}}}}else{foundit=false;for(i=1;i<sect_body.rows.length;i++){if(sect_body.rows[i].cells[0].innerHTML==A&&i<sect_body.rows.length-2){parent_level=parseInt(sect_body.rows[i].cells[1].innerHTML);i++;this_level=parseInt(sect_body.rows[i].cells[1].innerHTML);if(this_level==parent_level+1){while((i<sect_body.rows[i].length)&&parseInt(sect_body.rows[i].cells[1].innerHTML)>parent_level){sect_body.rows[i].style.display="block";i++}}break}}if(foundit){document.getElementById("sect_toggle_"+A).innerHTML=" -"}else{curr_SectId=A;load_html("hidden_content",script_location+"/ajax.php?do="+B+A+"&level="+C,"",null,addSections);document.getElementById("sect_toggle_"+A).innerHTML=" -"}}}return false}function checkUrlAvailable(A,C,B){if(A!=undefined){hiddenDiv=C;load_html(hiddenDiv,getBaseUrl()+"/ajax.php?do=checkurl","url="+A.value+"&nodeid="+B,null,showDupUrl)}}function showDupUrl(){if(document.getElementById(hiddenDiv).innerHTML!=""){alert(document.getElementById(hiddenDiv).innerHTML)}}function addSections(){if(document.getElementById("hidden_content")!=undefined){xfr_body=document.getElementById("sect_xfer").tBodies[0];sect_body=document.getElementById("detail_list").tBodies[0];for(var A=1;A<sect_body.rows.length;A++){if(sect_body.rows[A].cells[0].innerHTML==curr_SectId){for(j=0;j<xfr_body.rows.length;j++){var B=sect_body.insertRow(A+j+1);B.innerHTML=xfr_body.rows[j].innerHTML}document.getElementById("sect_toggle_"+curr_SectId).innerHTML=" -";break}}}if(document.getElementById("hidden_content")!=undefined){document.getElementById("hidden_content").innerHTML=""}};