var ZenEditWindow;
var ZenImageGallery;
var ZenFileGallery;
		
function OpenEditWindow(iPageID, iComponentLoc){
	if (ZenEditWindow && ZenEditWindow.location)EditWindow.close();
	window.open("/admin/ContentEdit.aspx?page=" + iPageID + "&cID=" + iComponentLoc, "ZenEditWindow","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=701,left=25,top=25,screenX=25,screenY=25");
	}
	
function OpenImageGallery(iPageID){
	if (ZenImageGallery && ZenImageGallery.location)EditWindow.close();
	window.open("/admin/ImageGalleryFrame.aspx?PageID=" + iPageID,"ZenImageGallery","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=550,left=25,top=25,screenX=25,screenY=25");
	}

function OpenImageGallery(iPageID,sCallingCtlName){
	if (ZenImageGallery && ZenImageGallery.location)EditWindow.close();
	window.open("/admin/ImageGalleryFrame.aspx?PageID=" + iPageID + "&ctl=" + sCallingCtlName,"ZenImageGallery","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=550,left=25,top=25,screenX=25,screenY=25");
	}
	
function CloseEditWindow(){
	CurrentURL = window.opener.location.href;
	opener.document.location = CurrentURL;
	}
	
function RefreshImageGallery(iPageID, sCallingControl){
	top.imagegal.document.location = 'ImageGallery.aspx?PageID=' + iPageID + '&ctl=' + sCallingControl;
	}
	
function MarkAsChanged(){
	document.txtChangesMade.value = "True"
	}
	
function selectimage(sImage,iWidth,iHeight,sCallingCtlName){
	var sImageHTML;
	sImageHTML = "<img src='/UserImages/" + sImage + "' border='0' width='" + iWidth + "' height='" + iHeight + "'>";
	//parent.window.opener.setSnippet("HTMLTextBox1", sImageHTML);
	parent.window.opener.setSnippet(sCallingCtlName, sImageHTML);
	parent.window.close();
}

function ImageGalleryShowAll(){
	document.forms[0].txtSearch.value="";
	document.forms[0].submit();
	}
	
function OpenFileGallery(iPageID){
	if (ZenFileGallery && ZenFileGallery.location)EditWindow.close();
	window.open("/admin/FileGalleryFrame.aspx?PageID=" + iPageID,"ZenFileGallery","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=550,left=25,top=25,screenX=25,screenY=25");
	}

function OpenFileGallery(iPageID,sCallingCtlName){
	if (ZenFileGallery && ZenFileGallery.location)EditWindow.close();
	window.open("/admin/FileGalleryFrame.aspx?PageID=" + iPageID + "&ctl=" + sCallingCtlName,"ZenFileGallery","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=550,left=25,top=25,screenX=25,screenY=25");
	}
	
function selectfile(sFilePath,sCallingCtlName){
	var sHTML;
	var sText;
	//sSelText = parent.window.opener.... can't find anything in ClientAPI
	sText = "[Type Linking Text Here]";
	sHTML = "<A href ='" + sFilePath + "' target='_blank'>" + sText + "</A>";
	parent.window.opener.setSnippet(sCallingCtlName, sHTML);
	parent.window.close();
}

function FileGalleryShowAll(){
	document.forms[0].txtSearch.value="";
	document.forms[0].submit();
	}

function RefreshFileGallery(iPageID, sCallingControl){
	top.filegal.document.location = 'FileGallery.aspx?PageID=' + iPageID + '&ctl=' + sCallingControl;
	}
	
function confirmdelete(){
 
}

function OpenMenuEditWindow(iPageGroupID,iPageID){
	if (ZenEditWindow && ZenEditWindow.location)EditWindow.close();
		window.open("/admin/MenuManage.aspx?PageGroupID=" + iPageGroupID + '&PageID=' + iPageID, "ZenMenuEdit","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=740,height=475,left=25,top=25,screenX=25,screenY=25");

	}	
	
function OpenHeadlineEditWindow(iPageID,iHeadlineID){
	if (ZenEditWindow && ZenEditWindow.location)EditWindow.close();
	window.open("/admin/HeadlineEdit.aspx?page=" + iPageID + "&ID=" + iHeadlineID, "ZenEditWindow","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=550,left=25,top=25,screenX=25,screenY=25");
	}
	
function OpenHeadlineAdvEditWindow(iPageID,iHeadlineID,iPreReleaseID,iLoc){
	if (ZenEditWindow && ZenEditWindow.location)EditWindow.close();
	window.open("/admin/HeadlineAdvEdit.aspx?page=" + iPageID + "&HID=" + iHeadlineID + "&PRID=" + iPreReleaseID + "&LOC=" + iLoc, "ZenEditWindow","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=550,left=25,top=25,screenX=25,screenY=25");
	}
	
function OpenTestimonialEditWindow(iPageID){
	if (ZenEditWindow && ZenEditWindow.location)EditWindow.close();
	window.open("/admin/Testimonials.aspx?Page=" + iPageID, "ZenEditWindow","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=700,height=550,left=25,top=25,screenX=25,screenY=25");
	}
/*	
function OpenAdvertEditWindow(iAdvertID, bIsHtml){
	if (ZenEditWindow && ZenEditWindow.location)EditWindow.close();
	window.open("/admin/AdvertsModify.aspx?ID=" + iAdvertID + "&HTML=" + bIsHtml, "ZenEditWindow","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=850,height=720,left=25,top=25,screenX=25,screenY=25");
	}
*/

function OpenAdvertEditWindow(iPageID){
	if (ZenEditWindow && ZenEditWindow.location)EditWindow.close();
	window.open("/admin/Adverts.aspx?Page=" + iPageID, "ZenEditWindow","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0,width=850,height=600,left=25,top=25,screenX=25,screenY=25");
	}

function OpenAdvertStatsWindow(iAdvertID){
	if (ZenEditWindow && ZenEditWindow.location)EditWindow.close();
	window.open("/admin/AdvertsStats.aspx?ID=" + iAdvertID, "ZenEditWindow","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=850,height=720");
	}
	
function fnShowPopUpHelp(category,item, e) 
{	
	var text = "Sorry, no help is currently available for this field.";
	
	switch (category)
	{	
		case "Feedback":
			switch (item)
			{
				case "Name":
					text = "The name by which you are, or would like to be, referred to.";
					break;
				case "Contact E-Mail Address":
					text = "An E-Mail address which we can use to contact you regarding your feedback.";
					break;
				case "About":
					text = "The subject that your feedback is about. This could be a page title, a specific piece of functionality or bug title etc. The text defaults to the title of the page you were viewing when you selected the 'Provide Feedback' link.";
					break ;
			}
			break ;
	}

  MOverlib.show(item, text, 'PopUpHelp', {ev:e});
}


function nd(){
    MOverlib.hide();
}