// Javascript document

//Function for viewing/hiding loginbox
function showloginbox()
{
	if(document.getElementById('loginbox').style.display=='block') document.getElementById('loginbox').style.display='none';
	else 
	{
		document.getElementById('loginbox').style.display='block';
	}
	return(false);
}

//Resize the window
function Resize(width,height)
{
self.resizeTo(width,height);
}

//Function for help links
function PopupHelp(itemID)
{
	var PopupWindow=null;
	w=417,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/HTMLModule/HelpPage.aspx?ItemId=' + itemID,'Help',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

//Function for pop up grid pickers
function PopupGridPicker1(Txtctl,IDctl,itemID)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function PopupGridPicker2(Txtctl,IDctl,itemID,Txt2ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function PopupGridPicker3(Txtctl,IDctl,itemID,Txt2ctl,Txt3ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl + '&Txt3ctl=' + Txt3ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function PopupGridPicker4(Txtctl,IDctl,itemID,Txt2ctl,Txt3ctl,Txt4ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl + '&Txt3ctl=' + Txt3ctl + '&Txt4ctl=' + Txt4ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function PopupGridPicker5(Txtctl,IDctl,itemID,Txt2ctl,Txt3ctl,Txt4ctl,Txt5ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl + '&Txt3ctl=' + Txt3ctl + '&Txt4ctl=' + Txt4ctl + '&Txt5ctl=' + Txt5ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function PopupGridPicker6(Txtctl,IDctl,itemID,Txt2ctl,Txt3ctl,Txt4ctl,Txt5ctl,Txt6ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl + '&Txt3ctl=' + Txt3ctl + '&Txt4ctl=' + Txt4ctl + '&Txt5ctl=' + Txt5ctl + '&Txt6ctl=' + Txt6ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function PopupGridPicker7(Txtctl,IDctl,itemID,Txt2ctl,Txt3ctl,Txt4ctl,Txt5ctl,Txt6ctl,Txt7ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl + '&Txt3ctl=' + Txt3ctl + '&Txt4ctl=' + Txt4ctl + '&Txt5ctl=' + Txt5ctl + '&Txt6ctl=' + Txt6ctl + '&Txt7ctl=' + Txt7ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function PopupGridPicker8(Txtctl,IDctl,itemID,Txt2ctl,Txt3ctl,Txt4ctl,Txt5ctl,Txt6ctl,Txt7ctl,Txt8ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl + '&Txt3ctl=' + Txt3ctl + '&Txt4ctl=' + Txt4ctl + '&Txt5ctl=' + Txt5ctl + '&Txt6ctl=' + Txt6ctl + '&Txt7ctl=' + Txt7ctl + '&Txt8ctl=' + Txt8ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function PopupGridPicker9(Txtctl,IDctl,itemID,Txt2ctl,Txt3ctl,Txt4ctl,Txt5ctl,Txt6ctl,Txt7ctl,Txt8ctl,Txt9ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl + '&Txt3ctl=' + Txt3ctl + '&Txt4ctl=' + Txt4ctl + '&Txt5ctl=' + Txt5ctl + '&Txt6ctl=' + Txt6ctl + '&Txt7ctl=' + Txt7ctl + '&Txt8ctl=' + Txt8ctl + '&Txt9ctl=' + Txt9ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}
function PopupGridPicker10(Txtctl,IDctl,itemID,Txt2ctl,Txt3ctl,Txt4ctl,Txt5ctl,Txt6ctl,Txt7ctl,Txt8ctl,Txt9ctl,Txt10ctl)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchPage.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID+ '&Txt2ctl=' + Txt2ctl + '&Txt3ctl=' + Txt3ctl + '&Txt4ctl=' + Txt4ctl + '&Txt5ctl=' + Txt5ctl + '&Txt6ctl=' + Txt6ctl + '&Txt7ctl=' + Txt7ctl + '&Txt8ctl=' + Txt8ctl + '&Txt9ctl=' + Txt9ctl + '&Txt10ctl=' + Txt10ctl,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

//Function for pop up calendar
function PopupCalendar(ctl)
{
	var PopupWindow=null;
	w=225,h=225,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/FieldListModule/DatePicker.aspx?Ctl=' + ctl,'Calendar',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}
function PopupCalendarEmbedded(ctl)
{
	var PopupWindow=null;
	w=225,h=225,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('../FieldListModule/DatePicker.aspx?Ctl=' + ctl,'Calendar',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

//Function for pop up grid pickers
function PopupSearchNew(Txtctl,IDctl,itemID)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=yes,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/SearchModule/SearchNewPopup.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}
function PopupSearchNewEmbedded(Txtctl,IDctl,itemID)
{
	var PopupWindow=null;
	w=600,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=yes,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('../SearchModule/SearchNewPopup.aspx?Txtctl=' + Txtctl+'&IDctl=' +IDctl+'&ItemId=' +itemID,'Search',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}
//Function for pop up new artcle viewer
function PopupArticle(itemID)
{
	var PopupWindow=null;
	w=600,h=400,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=yes,toolbar=yes,status=no,scrollbars=yes,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/NewsModule/NewsPreviewPage.aspx?ItemId=' + itemID ,'ArticlePreview',settings);
	window.event.returnValue = false;
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

//Function for pop up newsletter viewer
function PopupNewsletter(itemID)
{
	var PopupWindow=null;
	w=600,h=400,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=yes,toolbar=yes,status=no,scrollbars=yes,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/NewsModule/EditionPreviewPage.aspx?ItemId=' + itemID ,'NewsletterPreview',settings);
	window.event.returnValue = false;
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

//Function for pop up a Image Gallery - give Gallery ID
function PopupGalleryImage(itemID)
{
	var PopupWindow=null;
	w=575,h=520,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=no';
	PopupWindow=window.open('Modules/ResourcesModule/GallerySlideShow.aspx?ItemId=' + itemID,'Gallery',settings);
	window.event.returnValue = false
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
	
}
function PopupGalleryImage2(itemIndex)
//Function for pop up a Image Gallery given an gallery image ID
{
	var PopupWindow=null;
	w=575,h=520,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=no';
	PopupWindow=window.open('Modules/ResourcesModule/GallerySlideShow.aspx?itemIndex=' + itemIndex,'Gallery',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
	}
	
function PopupImageUpload(itemID)
{
	var PopupWindow=null;
	w=500,h=240,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/ResourcesModule/ImageUploadPopup.aspx?ItemId=' + itemID,'ImageUpload',settings);
	window.event.returnValue = false
	PopupWindow.focus();
	// close this popup if parent page closes

	window.onunload = function(){PopupWindow.close();}
}
		
//Function for showing/hide facts
function factclick(ctl,img)
{
  if( ctl.style.display == "none") {
    ctl.style.display = "";
    img.src = "images/but_minus.gif";
    img.alt = "Hide details";
    }
  else {
    ctl.style.display = "none";
    img.src = "images/but_plus.gif";
    img.alt = "Show details";
    }
}

function PopupAdvertisingAdUpload(itemID)
{
	var PopupWindow=null;
	w=450,h=300,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=yes,dependent=no';
	PopupWindow=window.open('Modules/AdvertisingModule/AdminAdUpload.aspx?ItemId=' + itemID,'Gallery',settings);
	window.event.returnValue = false;
PopupWindow.focus();
//	 close this popup if parent page closes

window.onunload = function(){PopupWindow.close();}
}

function PopupDocDownload(itemIndex)
{
	var PopupWindow=null;
	w=500,h=200,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/ResourcesModule/PublicDocDownloads.aspx?itemID=' + itemIndex,'Download',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
	}
	
function PopupDocUpload(itemId)
{
	var PopupWindow=null;
	w=500,h=325,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=no';
	PopupWindow=window.open('Modules/ResourcesModule/DocUploadPopup.aspx?ItemId=' + itemId,'DocUpload',settings);
	window.event.returnValue = false
	PopupWindow.focus();
	// close this popup if parent page closes

window.onunload = function(){PopupWindow.close();}
}

function confirmDelete()
{
	var question = "Are you sure you want to delete this record?\n\n";
	question += "This record will be permanently deleted if you proceed.\n\n";
	question += "Click OK to continue, or Cancel to return to the current record.";
	var ask = confirm( question );
	window.event.returnValue = ask;
}

//Function for help links
function PopupNote(itemID)
{
	var PopupWindow=null;
	w=417,h=350,sh=screen.availheight,sw=screen.availWidth,T=(sh-h)/2,L=(sw-w)/2,settings='width='+ w + ',height='+ h + ',left=' + L + ',top=' + T + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no,dependent=no';
	PopupWindow=window.open('Modules/ContactsModule/AdminNoteView.aspx?ItemId=' + itemID,'Note',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
}

function confirmNewsletterSend()
{
	var question = "Are you sure you want to send this newsletter?\n\n";
	question += "This record will be sent to recipients if you proceed.\n\n";
	question += "Click OK to continue, or Cancel to return to the current page.";
	var ask = confirm( question );
	window.event.returnValue = ask;
}

function downloadExport(itemId)
{
	var PopupWindow=null;
	w=800,h=600,settings='width='+ w + ',height='+ h + ',left=100,top=100,location=no,directories=no,menubar=yes,toolbar=yes,status=no,scrollbars=yes,resizable=yes,dependent=no';
	PopupWindow=window.open('Modules/GroupsModule/AdminExportDownload.aspx?ItemId=' + itemId,'Download',settings);
	PopupWindow.focus();
}
