// 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 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=yes,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();}
}
//for Doc upload
function PopupCalendarDocs(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=yes,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=yes,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 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 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/ImageNewImage.aspx?ItemId=' + itemID,'ImageUpload',settings);
	window.event.returnValue = false
	PopupWindow.focus();
	// close this popup if parent page closes

	window.onunload = function(){PopupWindow.close();}
}
function PopupTrainingDocUpload(itemID)
{
	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/TrainingModule/DelegateUpload.aspx?ItemId=' + itemID,'Doc Upload',settings);
	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 PopupDelegateNote(itemID)
{
	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/TrainingModule/AdminDelegateNote.aspx?ItemId=' + itemID,'Note',settings);
	window.event.returnValue = false
	PopupWindow.focus();
	// close this popup if parent page closes

window.onunload = function(){PopupWindow.close();}
}

function PopupAdvertisingAdUpload(itemID)
{
	var PopupWindow=null;
	w=450,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=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)
//Function for pop up a Image Gallery given an gallery image ID
{
	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/DocsModule/DocumentDownloads.aspx?itemID=' + itemIndex,'Gallery',settings);
	PopupWindow.focus();
	// close this popup if parent page closes
	window.onunload = function(){PopupWindow.close();}
	}
	
function PopupDocUpload(itemID)
{
	var PopupWindow=null;
	w=500,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=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=no';
	PopupWindow=window.open('Modules/DocsModule/DocUploadPopup.aspx?ItemId=' + itemID,'Note',settings);
	window.event.returnValue = false
	PopupWindow.focus();
	// close this popup if parent page closes

window.onunload = function(){PopupWindow.close();}
}
function PopupActiveReport(rep,proc,type,itemid,date1,date2)
			{
			var PopupWindow=null;
			w=800,h=600,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/ReportModule/ActiveReportViewer.aspx?rep=' + rep + '&proc=' + proc + '&type=' + type+ '&itemid=' + itemid+ '&date1=' + date1+ '&date2=' + date2,'ActiveReport',settings);
			PopupWindow.focus();
			// close this popup if parent page closes
			window.onunload = function(){PopupWindow.close();}
			}