// *********************************************** //
// * 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 RESET HTML (div) in a form *
// ******************************************
function ResetHTML(id)
{
    $('#'+id).html($('#'+id).html());
}
// ******* //
// * 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[0].checked == true)
		{
			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
		}
		else
		{
			document.Frm.location[1].checked = false
			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
		}
	}
	//--#All Americas
	if (LocationGroup == '2')
	{
		if(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[15].checked = true
		}
		else
		{
			document.Frm.location[12].checked = false
			document.Frm.location[13].checked = false
			document.Frm.location[14].checked = false
			document.Frm.location[15].checked = false
		}
	}
	//--#All Western Europe
	if (LocationGroup == '3')
	{
		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[22].checked = true
			document.Frm.location[23].checked = true
			document.Frm.location[24].checked = true
		}
		else
		{
			document.Frm.location[17].checked = false
			document.Frm.location[18].checked = false
			document.Frm.location[19].checked = false
			document.Frm.location[20].checked = false
			document.Frm.location[21].checked = false
			document.Frm.location[22].checked = false
			document.Frm.location[23].checked = false
			document.Frm.location[24].checked = false
		}
	}
	//--#All Northern Europe
	if (LocationGroup == '4')
	{
		if(document.Frm.location[25].checked == true)
		{
			document.Frm.location[26].checked = true
			document.Frm.location[27].checked = true
			document.Frm.location[28].checked = true
			document.Frm.location[29].checked = true
			document.Frm.location[30].checked = true
			document.Frm.location[31].checked = true
			document.Frm.location[32].checked = true
			document.Frm.location[33].checked = true
		}
		else
		{
			document.Frm.location[26].checked = false
			document.Frm.location[27].checked = false
			document.Frm.location[28].checked = false
			document.Frm.location[29].checked = false
			document.Frm.location[30].checked = false
			document.Frm.location[31].checked = false
			document.Frm.location[32].checked = false
			document.Frm.location[33].checked = false
		}
	}
	//--#All Southern Europe
	if (LocationGroup == '5')
	{
		if(document.Frm.location[34].checked == true)
		{
			document.Frm.location[35].checked = true
			document.Frm.location[36].checked = true
			document.Frm.location[37].checked = true
			document.Frm.location[38].checked = true
			document.Frm.location[39].checked = true
			document.Frm.location[40].checked = true
			document.Frm.location[41].checked = true
			document.Frm.location[42].checked = true
			document.Frm.location[43].checked = true
		}
		else
		{
			document.Frm.location[35].checked = false
			document.Frm.location[36].checked = false
			document.Frm.location[37].checked = false
			document.Frm.location[38].checked = false
			document.Frm.location[39].checked = false
			document.Frm.location[40].checked = false
			document.Frm.location[41].checked = false
			document.Frm.location[42].checked = false
			document.Frm.location[43].checked = false
		}
	}
	//--#All Eastern Europe
	if (LocationGroup == '6')
	{
		if(document.Frm.location[44].checked == true)
		{
			document.Frm.location[45].checked = true
			document.Frm.location[46].checked = true
			document.Frm.location[47].checked = true
			document.Frm.location[48].checked = true
			document.Frm.location[49].checked = true
			document.Frm.location[50].checked = true
			document.Frm.location[51].checked = true
			document.Frm.location[52].checked = true
		}
		else
		{
			document.Frm.location[45].checked = false
			document.Frm.location[46].checked = false
			document.Frm.location[47].checked = false
			document.Frm.location[48].checked = false
			document.Frm.location[49].checked = false
			document.Frm.location[50].checked = false
			document.Frm.location[51].checked = false
			document.Frm.location[52].checked = false
		}
	}
	//--#All Asia Pacific
	if (LocationGroup == '7')
	{
		if(document.Frm.location[53].checked == true)
		{
			document.Frm.location[54].checked = true
			document.Frm.location[55].checked = true
			document.Frm.location[56].checked = true
			document.Frm.location[57].checked = true
			document.Frm.location[58].checked = true
			document.Frm.location[59].checked = true
			document.Frm.location[60].checked = true
			document.Frm.location[61].checked = true
		}
		else
		{
			document.Frm.location[54].checked = false
			document.Frm.location[55].checked = false
			document.Frm.location[56].checked = false
			document.Frm.location[57].checked = false
			document.Frm.location[58].checked = false
			document.Frm.location[59].checked = false
			document.Frm.location[60].checked = false
			document.Frm.location[61].checked = false
		}
	}
	//--#All Southern Asia
	if (LocationGroup == '8')
	{
		if(document.Frm.location[62].checked == true)
		{
			document.Frm.location[63].checked = true
			document.Frm.location[64].checked = true
			document.Frm.location[65].checked = true
		}
		else
		{
			document.Frm.location[63].checked = false
			document.Frm.location[64].checked = false
			document.Frm.location[65].checked = false
		}
	}
	//--#All Middle East
	if (LocationGroup == '9')
	{
		if(document.Frm.location[66].checked == true)
		{
			document.Frm.location[67].checked = true
			document.Frm.location[68].checked = true
			document.Frm.location[69].checked = true
			document.Frm.location[70].checked = true
			document.Frm.location[71].checked = true
			document.Frm.location[72].checked = true
			document.Frm.location[73].checked = true
			document.Frm.location[74].checked = true
		}
		else
		{
			document.Frm.location[67].checked = false
			document.Frm.location[68].checked = false
			document.Frm.location[69].checked = false
			document.Frm.location[70].checked = false
			document.Frm.location[71].checked = false
			document.Frm.location[72].checked = false
			document.Frm.location[73].checked = false
			document.Frm.location[74].checked = false
		}
	}
	//--#All Africa
	if (LocationGroup == '10')
	{
		if(document.Frm.location[75].checked == true)
		{
			document.Frm.location[76].checked = true
			document.Frm.location[77].checked = true
		}
		else
		{
			document.Frm.location[76].checked = false
			document.Frm.location[77].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[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[0].checked = true
		}
		else
		{
			document.Frm.location[0].checked = false
		}
	}
	//--#All Americas
	if (LocationGroup == '2')
	{
		if(document.Frm.location[12].checked == true &&
		document.Frm.location[13].checked == true &&
		document.Frm.location[14].checked == true &&
		document.Frm.location[15].checked == true)
		{
			document.Frm.location[11].checked = true
		}
		else
		{
			document.Frm.location[11].checked = false
		}
	}
	//--#All Western Europe
	if (LocationGroup == '3')
	{
		if(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[22].checked == true &&
		document.Frm.location[23].checked == true &&
		document.Frm.location[24].checked == true)
		{
			document.Frm.location[16].checked = true
		}
		else
		{
			document.Frm.location[16].checked = false
		}
	}
	//--#All Northern Europe
	if (LocationGroup == '4')
	{
		if(document.Frm.location[26].checked == true &&
		document.Frm.location[27].checked == true &&
		document.Frm.location[28].checked == true &&
		document.Frm.location[29].checked == true &&
		document.Frm.location[30].checked == true &&
		document.Frm.location[31].checked == true &&
		document.Frm.location[32].checked == true &&
		document.Frm.location[33].checked == true)
		{
			document.Frm.location[25].checked = true
		}
		else
		{
			document.Frm.location[25].checked = false
		}
	}
	//--#All Southern Europe
	if (LocationGroup == '5')
	{
		if(document.Frm.location[35].checked == true &&
		document.Frm.location[36].checked == true &&
		document.Frm.location[37].checked == true &&
		document.Frm.location[38].checked == true &&
		document.Frm.location[39].checked == true &&
		document.Frm.location[40].checked == true &&
		document.Frm.location[41].checked == true &&
		document.Frm.location[42].checked == true &&
		document.Frm.location[43].checked == true)
		{
			document.Frm.location[34].checked = true
		}
		else
		{
			document.Frm.location[34].checked = false
		}
	}
	//--#All Eastern Europe
	if (LocationGroup == '6')
	{
		if(document.Frm.location[45].checked == true &&
		document.Frm.location[46].checked == true &&
		document.Frm.location[47].checked == true &&
		document.Frm.location[48].checked == true &&
		document.Frm.location[49].checked == true &&
		document.Frm.location[50].checked == true &&
		document.Frm.location[51].checked == true &&
		document.Frm.location[52].checked == true)
		{
			document.Frm.location[44].checked = true
		}
		else
		{
			document.Frm.location[44].checked = false
		}
	}
	//--#All Asia Pacific
	if (LocationGroup == '7')
	{
		if(document.Frm.location[54].checked == true &&
		document.Frm.location[55].checked == true &&
		document.Frm.location[56].checked == true &&
		document.Frm.location[57].checked == true &&
		document.Frm.location[58].checked == true &&
		document.Frm.location[59].checked == true &&
		document.Frm.location[60].checked == true &&
		document.Frm.location[61].checked == true)
		{
			document.Frm.location[53].checked = true
		}
		else
		{
			document.Frm.location[53].checked = false
		}
	}
	//--#All Southern Asia
	if (LocationGroup == '8')
	{
		if(document.Frm.location[63].checked == true &&
		document.Frm.location[64].checked == true &&
		document.Frm.location[65].checked == true)
		{
			document.Frm.location[62].checked = true
		}
		else
		{
			document.Frm.location[62].checked = false
		}
	}
	//--#All Middle East
	if (LocationGroup == '9')
	{
		if(document.Frm.location[67].checked == true &&
		document.Frm.location[68].checked == true &&
		document.Frm.location[69].checked == true &&
		document.Frm.location[70].checked == true &&
		document.Frm.location[71].checked == true &&
		document.Frm.location[72].checked == true &&
		document.Frm.location[73].checked == true &&
		document.Frm.location[74].checked == true)
		{
			document.Frm.location[66].checked = true
		}
		else
		{
			document.Frm.location[66].checked = false
		}
	}
	//--#All Africa
	if (LocationGroup == '10')
	{
		if(document.Frm.location[76].checked == true &&
		document.Frm.location[77].checked == true)
		{
			document.Frm.location[75].checked = true
		}
		else
		{
			document.Frm.location[75].checked = false
		}
	}
};
// ******* //
// * End * //
// ******* //

