// *********************************************** //
// * 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 location checkboxes *
// ***************************************************
function checkUncheckLocation(LocationGroup)
{
	//--#All UK
	if (LocationGroup == '1')
	{
		if(document.FrmCandidate.location[0].checked == true)
		{
			document.FrmCandidate.location[1].checked = true
			document.FrmCandidate.location[2].checked = true
			document.FrmCandidate.location[3].checked = true
			document.FrmCandidate.location[4].checked = true
			document.FrmCandidate.location[5].checked = true
			document.FrmCandidate.location[6].checked = true
			document.FrmCandidate.location[7].checked = true
			document.FrmCandidate.location[8].checked = true
			document.FrmCandidate.location[9].checked = true
			document.FrmCandidate.location[10].checked = true
			document.FrmCandidate.location[11].checked = true
			document.FrmCandidate.location[12].checked = true
			document.FrmCandidate.location[13].checked = true
		}
		else
		{
			document.FrmCandidate.location[1].checked = false
			document.FrmCandidate.location[2].checked = false
			document.FrmCandidate.location[3].checked = false
			document.FrmCandidate.location[4].checked = false
			document.FrmCandidate.location[5].checked = false
			document.FrmCandidate.location[6].checked = false
			document.FrmCandidate.location[7].checked = false
			document.FrmCandidate.location[8].checked = false
			document.FrmCandidate.location[9].checked = false
			document.FrmCandidate.location[10].checked = false
			document.FrmCandidate.location[11].checked = false
			document.FrmCandidate.location[12].checked = false
			document.FrmCandidate.location[13].checked = false
		}
	}
	//--#All Africa
	if (LocationGroup == '2')
	{
		if(document.FrmCandidate.location[14].checked == true)
		{
			document.FrmCandidate.location[15].checked = true
			document.FrmCandidate.location[16].checked = true
		}
		else
		{
			document.FrmCandidate.location[15].checked = false
			document.FrmCandidate.location[16].checked = false
		}
	}
	//--#All Asia Pacific
	if (LocationGroup == '3')
	{
		if(document.FrmCandidate.location[17].checked == true)
		{
			document.FrmCandidate.location[18].checked = true
			document.FrmCandidate.location[19].checked = true
			document.FrmCandidate.location[20].checked = true
			document.FrmCandidate.location[21].checked = true
			document.FrmCandidate.location[22].checked = true
			document.FrmCandidate.location[23].checked = true
			document.FrmCandidate.location[24].checked = true
		}
		else
		{
			document.FrmCandidate.location[18].checked = false
			document.FrmCandidate.location[19].checked = false
			document.FrmCandidate.location[20].checked = false
			document.FrmCandidate.location[21].checked = false
			document.FrmCandidate.location[22].checked = false
			document.FrmCandidate.location[23].checked = false
			document.FrmCandidate.location[24].checked = false
		}
	}
	//--#All Europe
	if (LocationGroup == '4')
	{
		if(document.FrmCandidate.location[25].checked == true)
		{
			document.FrmCandidate.location[26].checked = true
			document.FrmCandidate.location[27].checked = true
		}
		else
		{
			document.FrmCandidate.location[26].checked = false
			document.FrmCandidate.location[27].checked = false
		}
	}
	//--#All Indian Subcontinent
	if (LocationGroup == '5')
	{
		if(document.FrmCandidate.location[28].checked == true)
		{
			document.FrmCandidate.location[29].checked = true
			document.FrmCandidate.location[30].checked = true
		}
		else
		{
			document.FrmCandidate.location[29].checked = false
			document.FrmCandidate.location[30].checked = false
		}
	}
	//--#All Middle East
	if (LocationGroup == '6')
	{
		if(document.FrmCandidate.location[31].checked == true)
		{
			document.FrmCandidate.location[32].checked = true
			document.FrmCandidate.location[33].checked = true
			document.FrmCandidate.location[34].checked = true
			document.FrmCandidate.location[35].checked = true
			document.FrmCandidate.location[36].checked = true
			document.FrmCandidate.location[37].checked = true
			document.FrmCandidate.location[38].checked = true
		}
		else
		{
			document.FrmCandidate.location[32].checked = false
			document.FrmCandidate.location[33].checked = false
			document.FrmCandidate.location[34].checked = false
			document.FrmCandidate.location[35].checked = false
			document.FrmCandidate.location[36].checked = false
			document.FrmCandidate.location[37].checked = false
			document.FrmCandidate.location[38].checked = false
		}
	}
	//--#All The Americas
	if (LocationGroup == '7')
	{
		if(document.FrmCandidate.location[39].checked == true)
		{
			document.FrmCandidate.location[40].checked = true
			document.FrmCandidate.location[41].checked = true
			document.FrmCandidate.location[42].checked = true
			document.FrmCandidate.location[43].checked = true
		}
		else
		{
			document.FrmCandidate.location[40].checked = false
			document.FrmCandidate.location[41].checked = false
			document.FrmCandidate.location[42].checked = false
			document.FrmCandidate.location[43].checked = false
		}
	}
};
// ******* //
// * End * //
// ******* //

// ***************************************************
// * Function to check / uncheck location checkboxes *
// ***************************************************
function checkUncheckLocationGroup(LocationGroup)
{
	//--#All UK
	if (LocationGroup == '1')
	{
		if ($('input[name=location_gr1]').is(':checked'))
		{
			$('#location_1').attr('checked', true);
			$('#location_2').attr('checked', true);
			$('#location_3').attr('checked', true);
			$('#location_4').attr('checked', true);
			$('#location_5').attr('checked', true);
			$('#location_6').attr('checked', true);
			$('#location_7').attr('checked', true);
			$('#location_8').attr('checked', true);
			$('#location_9').attr('checked', true);
			$('#location_10').attr('checked', true);
			$('#location_11').attr('checked', true);
			$('#location_12').attr('checked', true);
			$('#location_13').attr('checked', true);
		}
		else
		{
			$('#location_1').attr('checked', false);
			$('#location_2').attr('checked', false);
			$('#location_3').attr('checked', false);
			$('#location_4').attr('checked', false);
			$('#location_5').attr('checked', false);
			$('#location_6').attr('checked', false);
			$('#location_7').attr('checked', false);
			$('#location_8').attr('checked', false);
			$('#location_9').attr('checked', false);
			$('#location_10').attr('checked', false);
			$('#location_11').attr('checked', false);
			$('#location_12').attr('checked', false);
			$('#location_13').attr('checked', false);
		}
	}
	//--#All Africa
	if (LocationGroup == '2')
	{
		if ($('input[name=location_gr2]').is(':checked'))
		{
			$('#location_14').attr('checked', true);
			$('#location_15').attr('checked', true);
		}
		else
		{
			$('#location_14').attr('checked', false);
			$('#location_15').attr('checked', false);
		}
	}
	//--#All Asia Pacific
	if (LocationGroup == '3')
	{
		if ($('input[name=location_gr3]').is(':checked'))
		{
			$('#location_16').attr('checked', true);
			$('#location_17').attr('checked', true);
			$('#location_18').attr('checked', true);
			$('#location_19').attr('checked', true);
			$('#location_20').attr('checked', true);
			$('#location_21').attr('checked', true);
			$('#location_22').attr('checked', true);
		}
		else
		{
			$('#location_16').attr('checked', false);
			$('#location_17').attr('checked', false);
			$('#location_18').attr('checked', false);
			$('#location_19').attr('checked', false);
			$('#location_20').attr('checked', false);
			$('#location_21').attr('checked', false);
			$('#location_22').attr('checked', false);
		}
	}
	//--#All Europe
	if (LocationGroup == '4')
	{
		if ($('input[name=location_gr4]').is(':checked'))
		{
			$('#location_23').attr('checked', true);
			$('#location_24').attr('checked', true);
		}
		else
		{
			$('#location_23').attr('checked', false);
			$('#location_24').attr('checked', false);
		}
	}
	//--#All Indian Subcontinent
	if (LocationGroup == '5')
	{
		if ($('input[name=location_gr5]').is(':checked'))
		{
			$('#location_25').attr('checked', true);
			$('#location_26').attr('checked', true);
		}
		else
		{
			$('#location_25').attr('checked', false);
			$('#location_26').attr('checked', false);
		}
	}
	//--#All Middle East
	if (LocationGroup == '6')
	{
		if ($('input[name=location_gr6]').is(':checked'))
		{
			$('#location_27').attr('checked', true);
			$('#location_28').attr('checked', true);
			$('#location_29').attr('checked', true);
			$('#location_30').attr('checked', true);
			$('#location_31').attr('checked', true);
			$('#location_32').attr('checked', true);
			$('#location_33').attr('checked', true);
		}
		else
		{
			$('#location_27').attr('checked', false);
			$('#location_28').attr('checked', false);
			$('#location_29').attr('checked', false);
			$('#location_30').attr('checked', false);
			$('#location_31').attr('checked', false);
			$('#location_32').attr('checked', false);
			$('#location_33').attr('checked', false);
		}
	}
	//--#All The Americas
	if (LocationGroup == '7')
	{
		if ($('input[name=location_gr7]').is(':checked'))
		{
			$('#location_34').attr('checked', true);
			$('#location_35').attr('checked', true);
			$('#location_36').attr('checked', true);
			$('#location_37').attr('checked', true);
		}
		else
		{
			$('#location_34').attr('checked', false);
			$('#location_35').attr('checked', false);
			$('#location_36').attr('checked', false);
			$('#location_37').attr('checked', false);
		}
	}	
};
// ******* //
// * End * //
// ******* //
