var myUpdateWindow;

function displayMovie() {
	document.write('<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/6HGXrEVGHG0"></param><embed src="http://www.youtube.com/v/6HGXrEVGHG0" type="application/x-shockwave-flash" width="425" height="350"></embed></object><!-- <object width="325" height="350"><param name="movie" value="http://www.youtube.com/v/BnLTWKA9RyQ"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/BnLTWKA9RyQ" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object> -->');
}

function displaySlideShow() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="555" height="265" id="picShow" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="flash/picShow.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#999966" />');
	document.write('<param name="base" value="flash/" />');
	document.write('<embed src="flash/picShow.swf" base="flash/" quality="high" bgcolor="#999966" width="555" height="265" name="picShow" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function confirmDelete(directory_id, currentLocation, name)
{
	var response = confirm("Are you sure you want to delete " + name + "?");
	if (response == true)
		window.location = "deleteDirectoryEntry.php?id=" + directory_id + "&currentLocation=" + currentLocation;
}

function confirmUpdate(directory_id, currentLocation, name)
{
	var response = confirm("Are you sure you want to update " + name + "?" );
	if (response == true)
		myUpdateWindow = window.open("updateDirectoryEntry.php?id=" + directory_id + "&currentLocation=" + currentLocation,'mywin','width=400,height=550,toolbar=0,resizable=0');
}

function confirmDeleteContent(id, page, section, name)
{
	var response = confirm("Are you sure you want to delete " + name + "?");
	if (response == true)
		window.location = "deleteContentItem.php?id=" + id + "&section=" + section  + "&page=" + page + "&name=" + name;
}

function confirmUpdateContent(id, page, section, name)
{
	var response = confirm("Are you sure you want to update " + name + "?" );
	if (response == true)
		window.location = "cms_edit_entry.php?function=update&id=" + id + "&section=" + section  + "&page=" + page + "&name=" + name;
}

function addNewDirectoryEntry(currentLocation)
{
	myUpdateWindow = window.open("addDirectoryEntry.php?currentLocation=" + currentLocation,'mywin2','width=400,height=550,toolbar=0,resizable=0');
}

function openWin(addr) {
	window.open(addr);
}

function openEditWindow(page_name, section)
{
	//myUpdateWindow = window.open("cms_edit_entry.php?page=" + page_name + "&section=" + section,'mywin','width=400,height=550,toolbar=0,resizable=0,status=0');
	if (section == "body") {
		myUpdateWindow = window.open("cms_edit_body.php?page=" + page_name + "&section=" + section,'mywin','width=750,height=650,scrollbars=1,toolbar=0,resizable=1,status=1');
	} else
		myUpdateWindow = window.open("cms_edit_entry.php?page=" + page_name + "&section=" + section,'mywin','width=750,height=650,scrollbars=1,toolbar=0,resizable=1,status=1');
}

function openSiteFinderEditWindow(type, id)
{
	myUpdateWindow = window.open("cms_edit_sitebuilding.php?function=update&type=" + type + "&lid=" + id,'mywin','width=700,height=800,scrollbars=1,toolbar=0,resizable=1,status=1');
}

function openSiteFinderAddWindow(type)
{
	myUpdateWindow = window.open("cms_edit_sitebuilding.php?function=add&type=" + type,'mywin','width=700,height=800,scrollbars=1,toolbar=0,resizable=1,status=1');
}

function moveItemUp(id, page, section, ordering) 
{
	window.location = "cms_move_entry.php?direction=up&id=" + id + "&section=" + section  + "&page=" + page + "&ordering=" + ordering;
}

function moveItemDown(id, page, section, ordering) 
{
	window.location = "cms_move_entry.php?direction=down&id=" + id + "&section=" + section  + "&page=" + page + "&ordering=" + ordering;
}

function updateForm()
{
	var inst = tinyMCE.getInstanceById('contentValue');
 	document.myform.content.value = inst.getHTML();
}

function deleteMapItem(type, id, name)
{
	var response = confirm("Are you sure you want to delete " + name + "?");
	if (response == true)
		window.location = "deleteMapItem.php?id=" + id + "&type=" + type;
		
}

function openPDFViewer() 
{
	//window.location = "cms_pdf_viewer.php?&lid=" + lid + "&page=editMap&imageFile=" + document.myform.image.value + "&pdfName=" + document.myform.pdf.value + "&type=" + type + "&function=" + func;
	//myUpdateWindowPDF = window.open("cms_pdf_viewer.php?&lid=" + lid + "&page=editMap&imageFile=" + document.myform.image.value + "&pdfName=" + document.myform.pdf.value + "&type=" + type + "&function=" + func,'mywinPDF','width=700,height=800,scrollbars=1,toolbar=0,resizable=1,status=1');
	myUpdateWindowPDF = window.open("cms_pdf_viewer.php?page=editMap","mywinPDF","width=700,height=800,scrollbars=1,toolbar=0,resizable=1,status=1");
}

function PDFViewerExit(file)
{
	opener.document.myform.pdf.value = file;
	close();
}

function openImageViewer() 
{
	//window.location = "cms_image_viewer.php?&lid=" + lid + "&page=editMap&imageFile=" + document.myform.image.value + "&pdfName=" + document.myform.pdf.value + "&type=" + type + "&function=" + func;
	//myUpdateWindowImage = window.open("cms_image_viewer.php?&lid=" + lid + "&page=editMap&imageFile=" + document.myform.image.value + "&pdfName=" + document.myform.pdf.value + "&type=" + type + "&function=" + func,'mywinIMAGE','width=700,height=800,scrollbars=1,toolbar=0,resizable=1,status=1');
	myUpdateWindowImage = window.open("cms_image_viewer.php?page=editMap","mywinIMAGE","width=700,height=800,scrollbars=1,toolbar=0,resizable=1,status=1,location=1");
}

function ImageViewerExit(file)
{
	opener.document.myform.image.value = file;
	close();
}

function openPrinterFriendlyNewsletter(id)
{
	//myPrintingWindow = window.open("newsletter.php?id=" + id + "&pf=1","mywinNEWSLETTER","width=800,height=600,scrollbars=1,menubar=1,toolbar=0,resizable=1,status=1,location=0");
	myPrintingWindow = window.open("http://www.abcdcorp.org/documents/newsletter_" + id + ".pdf","mywinNEWSLETTER");
}

function addNewsletterStory(id)
{
	myAddWindow = window.open("cms_add_newsletter_story.php?id=" + id,'mywin2','width=700,height=550,toolbar=0,resizable=0');
}

function confirmDeleteNewsletterStory(id, story_id, name)
{
	var response = confirm("Are you sure you want to delete " + name + "?");
	if (response == true)
		window.location = "cms_delete_newsletter_story.php?id=" + id + "&story_id=" + story_id;
}

function confirmUpdateNewsletterStory(id, story_id)
{
	var response = confirm("Are you sure you want to update this story?");
	if (response == true)
		myUpdateWindow = window.open("cms_edit_newsletter_story.php?id=" + id + "&story_id=" + story_id,'mywin','width=700,height=550,toolbar=0,resizable=0');
}

function openNewsletterControlPanel()
{
	myUpdateWindowImage = window.open("cms_newsletter_cpanel.php","mywinIMAGE","width=600,height=600,scrollbars=1,toolbar=0,resizable=1,status=1,location=0");
}

function openNewsletterEmailPanel(id)
{
	myEmailWindow = window.open("cms_newsletter_emailpanel.php?id=" + id,"mywinIMAGE","width=600,height=600,scrollbars=1,toolbar=0,resizable=1,status=1,location=0");
}

function openNewsletter()
{
	opener.location = "newsletter.php?id=" + document.myform2.name.value; 
	self.close();
}

function deleteNewsletter(id)
{
	var response = confirm("Are you sure you want to delete this newsletter?");
	if (response == true)
		window.location = "cms_delete_newsletter.php?id=" + id;
}

function makeNewsletterActive(id)
{
	var response = confirm("Are you sure you want to make this the active newsletter?");
	if (response == true)
		window.location = "cms_makeactive_newsletter.php?id=" + id;
}

function makeNewsletterVisible(id)
{
	var response = confirm("Are you sure you want to make this newsletter visible?");
	if (response == true)
		window.location = "cms_makevisible_newsletter.php?id=" + id;
}

function updateNewsletterTitle(id) 
{
	myUpdateWindowImage = window.open("cms_edit_newsletter_title.php?id=" + id,"mywinIMAGE","width=400,height=400,scrollbars=1,toolbar=0,resizable=1,status=1,location=0");
}

function sendBulkEmailNewsletter(id)
{
	var response = confirm("Are you sure you want to send this newsletter to everyone on the mailing list?");
	//alert("cms_bulkemail_newsletter.php?id=" + id);
	if (response == true)
		window.location = "cms_bulkemail_newsletter.php?id=" + id;
}

function openNewsletterRecipients()
{
	myUpdateWindowImage = window.open("cms_edit_newsletter_recipients.php","mywinNewsletterRecips","width=700,height=600,scrollbars=1,toolbar=0,resizable=1,status=1,location=0");
}