

<!--

//
// Global variables
//

//var needToConfirm = true;
var chosenWindow = null;


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


/*
    /// left here for illustrative purposes
    //
  //var formIds = new Array('name', 'gender', 'sendEmail', 'radVanilla', 'radChocolate', 'radStrawberry');
  //var formValues = new Array('', '', '', '', '', '');
  
  function populateArrays()
  {
    // assign the default values to the items in the values array
    for (var i = 0; i < formIds.length; i++)
    {
      var elem = document.getElementById(formIds[i]);
      if (elem)
        if (elem.type == 'checkbox' || elem.type == 'radio')
          formValues[i] = elem.checked;
        else
          formValues[i] = elem.value;
    }      
  }

//
// confirmExit Function
//
// used by page class to check id form values have changed and have not been saved.
// This function should only be utilised on control pages where value are entered by the user

function confirmExit()
  {
    if (needToConfirm)
    {
      // check to see if any changes to the data entry fields have been made
      for (var i = 0; i < formValues.length; i++)
      {
        var elem = document.getElementById(formIds[i]);
        if (elem)
          if ((elem.type == 'checkbox' || elem.type == 'radio')
                  && formValues[i] != elem.checked)
            return "You have attempted to leave this page.  If you have made any changes to the fields without clicking the Save or Update button, your changes will be lost.  Are you sure you want to exit this page?";
          else if (!(elem.type == 'checkbox' || elem.type == 'radio') &&
                  elem.value != formValues[i])
            return "You have attempted to leave this page.  If you have made any changes to the fields without clicking the Save or Update button, your changes will be lost.  Are you sure you want to exit this page?";
      }

      // no changes - return nothing      
    }
  }
*/

function setControlFocus(controlName)
{
	var selectedCtrl = MM_findObj(controlName);
	if (selectedCtrl!= null)
	{
		selectedCtrl.focus();
	}
}

function checkForPopUps() {
    /*  Function:      setEvents
        Creation Date: April 5, 2004
        Programmer:    Edmond Woychowsky
        Purpose:       The purpose of this function is to attempt to open
                       a popup window to determine if a popup blocker is
                       enabled.

        Update Date:            Programmer:         Description:
	*/

	var objChild;                           // Window
	var reWork = new RegExp('object','gi');	// Regular expression

	try {
		objChild = window.open('','child','width=50,height=50,status=no,resizable=yes'); 

		objChild.close();
	}
	catch(e) { }

	if(!reWork.test(String(objChild)))
		alert('Warning: A pop-up blocker is enabled for this site!');
	else
		alert('No pop-up blocker or pop-up blocker is disabled!');
}

function CloseWindow()
			{
				self.close();
			}




/*
	  Opens the Local Authority Selection Page
*/
function OpenCouncilSelect(idname, postBack)
{
	selectedCtrl = MM_findObj(idname);
    NewWindow('selectCouncil.aspx?formname=Form1&id=' + idname + '&selected=' + selectedCtrl.value + '&postBack=' + postBack,'popupCC',450,300,false);
}

 /*
	  Opens the Premises in a Local Authority Selection Page
*/
function OpenCouncilPremisesSelect(idname, postBack)
{
	selectedCtrl = MM_findObj(idname);
    NewWindow('selectPremises.aspx?formname=Form1&id=' + idname + '&selected=' + selectedCtrl.value + '&postBack=' + postBack,'popupCC',500,350,false);
}

function OpenCalendar(idname, postBack)
{
	selectedCtrl = MM_findObj(idname);
	chosenWindow = window.open('Calendar.aspx?formname=Form1&id=' + idname + '&selected=' + selectedCtrl.value + '&postBack=' + postBack, 'popupcal', 'width=165,height=220,left=200,top=250');
}

function CloseHelpWindow()
			{
				self.close();
			}
	
	
	
/*
	Function use with Calendar Selection Pop Box
	Programmer:    Eamonn Flynn
    Purpose:       The purpose of this function is to return the value
				   chosen in the Calendar selection box back to the
				   Form field calling it.
*/
function SetCouncil(formName, id, newValue, postBack)
{

	if (newValue.length > 0)
	{
		chosenWindow.close();
		eval('var theform = document.' + formName + ';');
		theform.elements[id].value = newValue;
		
		//var pcontrol = document.getElementById(id)
		//pcontrol.value = newValue;
		
		if (postBack)
			__doPostBack(id,'');
	}
	else
	{
		alert ('Please select a Council from the Grid.');
	}
}	

function SetCouncilPremises(formName, id, newValue, postBack)
{
	if (newValue.length > 0)
	{
		eval('var theform = document.' + formName + ';');
		chosenWindow.close();
		theform.elements[id].value = newValue;
		if (postBack)
			__doPostBack(id,'');
	}
	else
	{
		alert ('Please select a Premises from the Grid.');
	}
}		
		
	
			
/*
	Function use with Calendar Selection Pop Box
	Programmer:    Eamonn Flynn
    Purpose:       The purpose of this function is to return the value
				   chosen in the Calendar selection box back to the
				   Form field calling it.
*/
function SetCalendarDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	chosenWindow.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}	
	




/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
*/

///
/// Window used to display Guidance Help Pages
///
function NewGuidanceWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
chosenWindow = window.open(mypage,myname,settings)
if(chosenWindow.window.focus){chosenWindow.window.focus();}
}


function NewWindow(mypage,myname,w,h,scroll){

LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
chosenWindow = window.open(mypage,myname,settings);
checkFocus();
}

function checkFocus()
{
    if ((chosenWindow != null) && !(chosenWindow.closed))
    {
        chosenWindow.focus();
    }
} 



function winBRopen(theURL, Name, popW, popH, scroll) 
	{ 
	var winleft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;
	winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars=Yes,resizable=Yes,menubar=Yes,toolbar=No'
	Win = window.open(theURL, Name, winProp)
	return Win;
	}

-->