// *********************************************** //
// * Open new window function - without toolbars * //
// *********************************************** //
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}
// ******* //
// * End * //
// ******* //

// ******************************************** //
// * Open new window function - with toolbars * //
// ******************************************** //
var win=null;
function NewWindow1(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=yes,toolbar=yes,resizable=yes';
	win=window.open(mypage,myname,settings);
}
// ******* //
// * End * //
// ******* //

// ************************************************************* //
// * Open new window function - without toolbars (resizeable ) * //
// ************************************************************* //
var win=null;
function NewWindow2(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	win=window.open(mypage,myname,settings);
}
// ******* //
// * End * //
// ******* //

// ********************************************************
// * Function to CHECK / UNCHECK all checkboxes in a form *
// ********************************************************
function checkUncheckAll(theElement, theField)
{
	var arrContent = new Array;	
	var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++)
	{
		if(theForm[z].type == 'checkbox' && theForm[z].name == theField)
		{
			theForm[z].checked = theElement.checked;
		}
	}
}
// ******* //
// * End * //
// ******* //

// ***********************************************************************
// * Function to check if ALL checkbox in a form are checked / unchecked *
// ***********************************************************************
function checkAll(theElement, theField)
{
	var total = 1;
	
	if(eval("document." + theElement.form.name +"." + theField + ".length"))
	{
		var max = eval("document." + theElement.form.name +"." + theField + ".length");
		
		for (var idx = 1; idx < max; idx++)
		{
			if (eval("document." + theElement.form.name +"." + theField + "[" + idx + "].checked") == true)
			{
	    		total += 1;
	   		}
		}
		if(total < idx)
		{
			eval("document." + theElement.form.name +"." + theField + "_0.checked = false")
		}
		else
		{
			eval("document." + theElement.form.name +"." + theField + "_0.checked = true")
		}
		
	}
	else
	{
		eval("document." + theElement.form.name + "." + theField + "_0.checked = " + theElement.form.theElement.checked)	
	}
}
// ******* //
// * End * //
// ******* //

// ***************************************************
// * Function to check / uncheck location checkboxes *
// ***************************************************
function checkUncheckLocation(LocationGroup)
{
	//--#All UK
	if (LocationGroup == '1')
	{
		if(document.Frm.location[1].checked == true)
		{
			document.Frm.location[2].checked = true
			document.Frm.location[3].checked = true
			document.Frm.location[4].checked = true
			document.Frm.location[5].checked = true
			document.Frm.location[6].checked = true
			document.Frm.location[7].checked = true
			document.Frm.location[8].checked = true
			document.Frm.location[9].checked = true
			document.Frm.location[10].checked = true
			document.Frm.location[11].checked = true
			document.Frm.location[12].checked = true
			document.Frm.location[13].checked = true
		}
		else
		{
			document.Frm.location[2].checked = false
			document.Frm.location[3].checked = false
			document.Frm.location[4].checked = false
			document.Frm.location[5].checked = false
			document.Frm.location[6].checked = false
			document.Frm.location[7].checked = false
			document.Frm.location[8].checked = false
			document.Frm.location[9].checked = false
			document.Frm.location[10].checked = false
			document.Frm.location[11].checked = false
			document.Frm.location[12].checked = false
			document.Frm.location[13].checked = false
		}
	}
	//--#All International
	if (LocationGroup == '2')
	{
		if(document.Frm.location[14].checked == true)
		{
			document.Frm.location[15].checked = true
			document.Frm.location[16].checked = true
			document.Frm.location[17].checked = true
			document.Frm.location[18].checked = true
			document.Frm.location[19].checked = true
			document.Frm.location[20].checked = true
		}
		else
		{
			document.Frm.location[15].checked = false
			document.Frm.location[16].checked = false
			document.Frm.location[17].checked = false
			document.Frm.location[18].checked = false
			document.Frm.location[19].checked = false
			document.Frm.location[20].checked = false
		}
	}
	//--#All Other
	if (LocationGroup == '3')
	{
		if(document.Frm.location[21].checked == true)
		{
			document.Frm.location[22].checked = true
			document.Frm.location[23].checked = true
		}
		else
		{
			document.Frm.location[22].checked = false
			document.Frm.location[23].checked = false
		
		}
	}
};
// ******* //
// * End * //
// ******* //

// ********************************************************************************
// * Function to check if ALL location checkbox in a form are checked / unchecked *
// ********************************************************************************
function checkAllLocation(LocationGroup)
{
	//--#All UK
	if (LocationGroup == '1')
	{
		if(document.Frm.location[2].checked == true &&
		document.Frm.location[3].checked == true &&
		document.Frm.location[4].checked == true &&
		document.Frm.location[5].checked == true &&
		document.Frm.location[6].checked == true &&
		document.Frm.location[7].checked == true &&
		document.Frm.location[8].checked == true &&
		document.Frm.location[9].checked == true &&
		document.Frm.location[10].checked == true &&
		document.Frm.location[11].checked == true &&
		document.Frm.location[12].checked == true &&
		document.Frm.location[13].checked == true &&
		document.Frm.location[14].checked == true)
		{
			document.Frm.location[1].checked = true
		}
		else
		{
			document.Frm.location[1].checked = false
		}
	}
	//--#All International
	if (LocationGroup == '2')
	{
		if(document.Frm.location[16].checked == true &&
		document.Frm.location[17].checked == true &&
		document.Frm.location[18].checked == true &&
		document.Frm.location[19].checked == true &&
		document.Frm.location[20].checked == true &&
		document.Frm.location[21].checked == true)
		{
			document.Frm.location[15].checked = true
		}
		else
		{
			document.Frm.location[15].checked = false
		}
	}
}
// ******* //
// * End * //
// ******* //

