function sendForm(myAction){
	document.forms[0].action = myAction;
	document.forms[0].method = "post";
	document.forms[0].submit();
};
function addZoneCountry(elt){
	var a = elt.value.split('$'),
		a_item = new Array;
	if(a[0]=="zone")
	{
		if(parseFloat("" + a[1]) > 0)
		{
			addZone(a[1],a[2]);
		}else if(parseFloat("" + a[1]) == -100){
			for(var i=0;i<document.forms[0].h_id_global.length;i++){
				a_item = (""+document.forms[0].h_id_global[i].value).split("$");
				addZone(a_item[0],a_item[1]);
			};
		}else if(parseFloat("" + a[1]) == -10){
			for(var i=0;i<document.forms[0].h_id_emea.length;i++){
				a_item = (""+document.forms[0].h_id_emea[i].value).split("$");
				addZone(a_item[0],a_item[1]);
			};
		}
	}
	if(a[0]=="country")
	{
		addCountry(a[1],a[2]);
	}
};
function addCountry(id_country,country){
	regionList.chose(new Option(''+country, ''+id_country));
	//document.forms[0].f_select_region.value = "-1";
};
function addZone(id_zone,zone){
	var myItem = eval("document.forms[0].h_id_zone_"+id_zone),
		a_item = new Array;
	if(myItem){
		addCountry('', ''+(''+zone).toUpperCase());
		if(myItem.length > 1){
			for(var i=0;i<myItem.length;i++){
				a_item = (""+myItem[i].value).split("$");
				addCountry(''+a_item[0], ''+a_item[1]);
			};
		}else{
			a_item = (""+myItem.value).split("$");
			addCountry(''+a_item[0], ''+a_item[1]);
		}
	}
	//document.forms[0].f_select_region.value = "-1";
};
function addRegional(myItem){
	var my_reg = document.forms[0].f_subsidiary.value;
	
	if(my_reg == ""){
		my_reg = myItem;
	}else{
		my_reg = my_reg + "\n" + myItem;
	}
	document.forms[0].f_subsidiary.value = my_reg;
};
function addVBrand(bra_id_brand,bra_brand){
	var temp = new Option(''+bra_brand, ''+bra_id_brand);
	var myItem = document.forms[0].l_brand;
	var isOK =1;
	
	for(var i=0;i<myItem.length;i++)
	{
		if(bra_id_brand == myItem.options[i].value)
		{
			isOK = 0;
		}
	};
	if(isOK == 1)
	{
		brandList.chose(temp);
	}
};
function addMBrand(myItem){
	var my_reg = document.forms[0].l_brand.value;
	
	if(my_reg == ""){
		my_reg = myItem;
	}else{
		my_reg = my_reg + "\n" + myItem;
	}
	document.forms[0].l_brand.value = my_reg;
};
function addBrand(myItem){
	var my_reg = document.forms[0].f_authorised_product.value;
	
	if(my_reg == ""){
		my_reg = myItem;
	}else{
		my_reg = my_reg + "\n" + myItem;
	}
	document.forms[0].f_authorised_product.value = my_reg;
};
function addLBrand(bra_id_brand,bra_brand){
	var temp = new Option(''+bra_brand, ''+bra_id_brand);
	var myItem = document.forms[0].l_brand;
	var isOK =1;
	
	for(var i=0;i<myItem.length;i++)
	{
		
		if(bra_id_brand == myItem.options[i].value)
		{
			isOK = 0;
		}
	};
	if(isOK == 1)
	{
		brandList.chose(temp);
	}
};
function addOBrand(myItem){
	var my_reg = document.forms[0].f_other_product.value;
	
	if(my_reg == ""){
		my_reg = myItem;
	}else{
		my_reg = my_reg + "\n" + myItem;
	}
	document.forms[0].f_other_product.value = my_reg;
};

function addDistributor(COM_id_company,COM_company){
	var temp = new Option(''+COM_company, ''+COM_id_company);
	var myItem = document.forms[0].l_brand;
	var isOK =1;
	
	for(var i=0;i<myItem.length;i++)
	{
		if(COM_id_company == myItem.options[i].value)
		{
			isOK = 0;
		}
	};
	if(isOK == 1)
	{
		brandList.chose(temp);
	}
};
function showLog(){
	var contactam = document.getElementById('contactam').style;
	var contactlog = document.getElementById('contactlog').style;
	var otheram = document.getElementById('otheram').style;
	var otherlog = document.getElementById('otherlog').style;
		
	if (contactam.display != 'none') {
		contactam.display = 'none';
	}
	if (contactlog.display == 'none') {
		contactlog.display = 'block';
	}
	if (otherlog.display != 'none') {
		otherlog.display = 'none';
	}
	if (otheram.display == 'none') {
		otheram.display = 'block';
	}
};
function showAM(){
	var contactam = document.getElementById('contactam').style;
	var contactlog = document.getElementById('contactlog').style;
	var otheram = document.getElementById('otheram').style;
	var otherlog = document.getElementById('otherlog').style;
		
	if (contactlog.display != 'none') {
		contactlog.display = 'none';
	}
	if (contactam.display == 'none') {
		contactam.display = 'block';
	}
	if (otheram.display != 'none') {
		otheram.display = 'none';
	}
	if (otherlog.display == 'none') {
		otherlog.display = 'block';
	}
};
function stripSpaces(form_item){
	var mytext = new String("");
	
	mytext = form_item.value;
	while (mytext.charAt(0) == ' ') {
		mytext = mytext.substring(1,mytext.length);
	}
	while (mytext.charAt(mytext.length - 1) == ' ') {
		mytext = mytext.substring(0, (mytext.length - 1));
	}
	form_item.value = mytext;
};
function checkDistri(myItem){
	if(myItem.name == "f_other_distri_importance"){
		if(myItem.options[myItem.selectedIndex].value > 0){
			document.forms[0].f_other_distri.checked = true;
		}
	}else{
		var myIndex = ("" + myItem.name).lastIndexOf("_")+1;
		var myId = ("" + myItem.name).substring(myIndex, ("" + myItem.name).length);
		if(myItem.options[myItem.selectedIndex].value > 0){
			for(var i=0;i<document.forms[0].f_distribution.length;i++){
				if(document.forms[0].f_distribution[i].value == myId){
					document.forms[0].f_distribution[i].checked = true;
				}
			};
		}
	}
};
function loadDistri(myItem){
	var thisItem;
	if(myItem.name == "f_other_distri"){
		if(myItem.checked == true){
			document.forms[0].f_other_distri_importance.selectedIndex = 1;
		}else{
			document.forms[0].f_other_distri_importance.selectedIndex = 0;
		}
	}else{
		if(myItem.checked == true){
			thisItem = eval("document.forms[0].f_distri_importance_" + myItem.value);
			if(thisItem && thisItem.options[thisItem.selectedIndex].value < 1){
				thisItem.selectedIndex = 1;
			}
		}else{
			thisItem = eval("document.forms[0].f_distri_importance_" + myItem.value);
			if(thisItem && thisItem.options[thisItem.selectedIndex].value > 0){
				thisItem.selectedIndex = 0;
			}
		}
	}
};
function checkForum(form_item){
	if(form_item.value == 1){
		document.forms[0].f_shortlist[0].checked = false;
		document.forms[0].f_shortlist[1].checked = true;
		document.forms[0].f_invited[0].checked = false;
		document.forms[0].f_invited[1].checked = true;
		document.forms[0].f_rejected[0].checked = false;
		document.forms[0].f_rejected[1].checked = true;
		document.forms[0].f_declined[0].checked = false;
		document.forms[0].f_declined[1].checked = true;
		document.forms[0].f_cancelled[0].checked = false;
		document.forms[0].f_cancelled[1].checked = true;
		document.forms[0].f_cancelled7[0].checked = false;
		document.forms[0].f_cancelled7[1].checked = true;
		document.forms[0].f_waiting_list[0].checked = false;
		document.forms[0].f_waiting_list[1].checked = true;
		document.forms[0].f_will_attend[0].checked = false;
		document.forms[0].f_will_attend[1].checked = true;
		form_item.checked = true;
	}
	if(document.forms[0].f_shortlist[0].checked == false && document.forms[0].f_invited[0].checked == false && document.forms[0].f_rejected[0].checked == false && document.forms[0].f_declined[0].checked == false && document.forms[0].f_cancelled[0].checked == false && document.forms[0].f_cancelled7[0].checked == false && document.forms[0].f_waiting_list[0].checked == false && 	document.forms[0].f_will_attend[0].checked == false){
		document.forms[0].f_shortlist[0].checked = false;
		document.forms[0].f_shortlist[1].checked = true;
	}
};
function checkURL(myItem){
	if((myItem.value.search(/http[s]?:\/\/[A-Za-z0-9_-]*/gi) == -1) && (myItem.value + "" != "n/a")){
		alert("Please check your URL.");
		myItem.focus();
		myItem.value = "http://www.";
		return false;
	}else{
		return true;
	}
};

function checkEmail(myItem){
	if((myItem.value.search(/[A-Za-z0-9_-]*@[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*/gi) == -1) && (myItem.value + "" != "n/a") && (myItem.value + "" != "")){
		alert("Please check your email address.");
		myItem.focus();
		myItem.value = "";
		return false;
	}else{
		return true;
	}
};

function stripPhone(form_item){
	var mytext = new String(""),
		mytemp = new String(""),
		mylength = 0,
		i = 0;
	
	mytext = form_item.value;
	mylength = mytext.length;
	if(mytext != "n/a"){		
		while(mytext.charAt(0).search(/[\d+(]/gi) == -1){
			mytext = mytext.substring(1,mytext.length);
			if(mytext.length == 0){
				break;
			}
		};
		for(var i = 1; i < mylength; i++){
			if(mytext.charAt(i).search(/[\d\s()]/gi) == -1){
				mytemp = mytext.substring(0,i);
				mytext = mytext.substring(i+1,mytext.length);
				mytext = mytemp + " " + mytext;
				mylength;
				i;
			}
		};
		if(mytext.charAt(mylength-1).search(/[\d\s()]/gi) == -1){
			mytext = mytext.substring(0,mylength-1);
		}
		form_item.value = mytext;
	}
	if(mytext == ""){
		restoreDialingCode(form_item);
	}
};

function stripMobile(form_item){
	var mytext = new String(""),
		mytemp = new String(""),
		mylength = 0,
		i = 0;
	
	mytext = form_item.value;
	mylength = mytext.length;
	if(mytext != "n/a"){		
		while(mytext.charAt(0).search(/[\d+]/gi) == -1){
			mytext = mytext.substring(1,mytext.length);
			if(mytext.length == 0){
				break;
			}
		};
		for(var i = 1; i < mylength; i++){
			if(mytext.charAt(i).search(/[\d]/gi) == -1){
				mytemp = mytext.substring(0,i);
				mytext = mytext.substring(i+1,mytext.length);
				mytext = mytemp + "" + mytext;
				mylength;
				i;
			}
		};
		if(mytext.charAt(mylength-1).search(/[\d]/gi) == -1){
			mytext = mytext.substring(0,mylength-1);
		}
		form_item.value = mytext;
	}
	if(mytext == ""){
		restoreDialingCode(form_item);
	}
};

function dialingCode(){
	var myForm = document.forms[0],
		tempCode = "",
		myIndex = 0;
	
	for(var i = 0; i < myForm.dialing_id.length; i++){
		if(myForm.dialing_id[i].value == myForm.f_id_country.options[myForm.f_id_country.selectedIndex].value){
			myIndex = i;
		}
	};
	if(myForm.f_id_country.selectedIndex == 0){
		if("" + myForm.f_tel.value == "+" + myForm.code.value){
			myForm.f_tel.value = "";
		}
		if("" + myForm.f_fax.value == "+" + myForm.code.value){
			myForm.f_fax.value = "";
		}
		myForm.code.value = "";
	}else{
		tempCode = "" + myForm.code.value;
			myForm.code.value = myForm.dialing_code[myIndex].value;
		if("" + myForm.f_tel.value == "+" + tempCode || "" + myForm.f_tel.value == "" || "" + myForm.f_tel.value == "+"){
			restoreDialingCode(myForm.f_tel);
		}
		if("" + myForm.f_fax.value == "+" + tempCode || "" + myForm.f_fax.value == "" || "" + myForm.f_fax.value == "+"){
			restoreDialingCode(myForm.f_fax);
		}
	}
};

function restoreDialingCode(form_item){
	var myForm = form_item.form;
	
	if(myForm.code){
		form_item.value = "+" + myForm.code.value;
	}else{
		form_item.value = "+" + myForm.at_code.value;
	}
};

function checkNumeric(myItem){
	var mytext;
	
	mytext = "" + myItem.value;
	if((isNaN(myItem.value) && mytext.toLowerCase() != "n/a" && mytext != "") || mytext.length > 18){
		alert("This field should contain a number.");
		myItem.focus();
		myItem.value = "";
		return false;
	}else{
		return true;
	}	
};

function checkInt(myItem){
	var mytext;
	
	mytext = "" + myItem.value;
	if((isNaN(myItem.value) && mytext.toLowerCase() != "n/a" && mytext != "") || mytext.length > 9){
		alert("This field should contain a number.");
		myItem.focus();
		myItem.value = "";
		return false;
	}else if(mytext != "" && mytext.toLowerCase() != "n/a" && mytext.length <= 9){
		myItem.value = parseInt(mytext);
		return true;
	}else{
		return true;
	}
};

function countSMS(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counterSMS[myIndex].value = counter;
	} else{
		document.forms[0].counterSMS.value = counter;
	}
};

function countChar150(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 150){
		myItem.value = myString.substring(0, 150);
		alert("Maximum size is 150 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter150[myIndex].value = counter;
	} else{
		document.forms[0].counter150.value = counter;
	}
};

function countChar200(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 200){
		myItem.value = myString.substring(0, 200);
		alert("Maximum size is 150 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter200[myIndex].value = counter;
	} else{
		document.forms[0].counter200.value = counter;
	}
};

function countCharAlert255(myItem){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 255){
		myItem.value = myString.substring(0, 255);
		alert("Maximum size is 255 characters.");	
	}
};

function countChar255(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 255){
		myItem.value = myString.substring(0, 255);
		alert("Maximum size is 255 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter255[myIndex].value = counter;
	} else{
		document.forms[0].counter255.value = counter;
	}
};



function countChar256(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 255){
		myItem.value = myString.substring(0, 255);
		alert("Maximum size is 255 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter256[myIndex].value = counter;
	} else{
		document.forms[0].counter256.value = counter;
	}
};



function countChar500(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 500){
		myItem.value = myString.substring(0, 500);
		alert("Maximum size is 500 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter500[myIndex].value = counter;
	} else{
		document.forms[0].counter500.value = counter;
	}
};

function countChar750(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 750){
		myItem.value = myString.substring(0, 750);
		alert("Maximum size is 750 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter750[myIndex].value = counter;
	} else{
		document.forms[0].counter750.value = counter;
	}
};

function countChar1000(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 1000){
		myItem.value = myString.substring(0, 1000);
		alert("Maximum size is 1000 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter1000[myIndex].value = counter;
	} else{
		document.forms[0].counter1000.value = counter;
	}
};

function countChar1500(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 1500){
		myItem.value = myString.substring(0, 1500);
		alert("Maximum size is 1500 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter1500[myIndex].value = counter;
	} else{
		document.forms[0].counter1500.value = counter;
	}
};

function countChar3500(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 3500){
		myItem.value = myString.substring(0, 3500);
		alert("Maximum size is 3500 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter3500[myIndex].value = counter;
	} else{
		document.forms[0].counter3500.value = counter;
	}
};

function countChar4000(myItem, myIndex){
	myLength = 0,
	myString = "",
	counter = 0;
	
	myString = "" + myItem.value;
	myLength = myString.length;

	if (myLength > 4000){
		myItem.value = myString.substring(0, 4000);
		alert("Maximum size is 4000 characters.");	
	}
	counter = myLength;
	if(myIndex >= 0){
		document.forms[0].counter4000[myIndex].value = counter;
	} else{
		document.forms[0].counter4000.value = counter;
	}
};

function checkPresentation(myItem){
	if((myItem.value.search(/[A-Za-z0-9_-]*\.pdf|ppt|pps/gi) == -1) && (myItem.value + "" != "n/a") && (myItem.value + "" != "")){
		alert("Presentation file should be a Powerpoint or a PDF file.");
		myItem.focus();
		return false;
	}else{
		return true;
	}
};

function checkLogo(myItem){
	if((myItem.value.search(/[A-Za-z0-9_-]*\.eps|tiff|tif|jpeg|jpg|jpe|ai|ai5|ai4|ai3|ps/gi) == -1) && (myItem.value + "" != "n/a") && (myItem.value + "" != "")){
		alert("Logo file should be an EPS, a TIFF or a JPEG file.");
		myItem.focus();
		return false;
	}else{
		return true;
	}
};

function checkLogoWeb(myItem){
	if((myItem.value.search(/[A-Za-z0-9_-]*\.gif|jpeg|jpg|jpe/gi) == -1) && (myItem.value + "" != "n/a") && (myItem.value + "" != "")){
		alert("Logo file should be an a GIF or a JPEG file.");
		myItem.focus();
		return false;
	}else{
		return true;
	}
};

function checkDateMonth(myItem){
	var myArrayDate, myMonth, myYear, myString, myYearDigit;
	
	myString = myItem.value + "";
	
	myArrayDate = myString.split("/");
	myMonth = Math.round(parseFloat(myArrayDate[0]));
	myYear = Math.round(parseFloat(myArrayDate[1]));
	myString = myArrayDate[1] + "";
	myYearDigit = myString.length;
	if (myItem.value + "" != "mm/aaaa" && myItem.value + "" != "mm/yyyy" && myItem.value + "" != "n/a" && (isNaN(myMonth) || isNaN(myYear) || (myYear < 1) || (myMonth < 1) || (myMonth > 12) || (myYearDigit != 4))){
		alert("Please check date format (mm/yyyy).");
		myItem.focus();
		myItem.value = "mm/yyyy";
		return false;
	}else{
		return true;
	}
};

function restoreDateMonth(myItem){
	if ("" + myItem.value == "" ){
		myItem.value = "mm/yyyy";
	}
};

function restoreDate(myItem){
	if ("" + myItem.value == "" ){
		myItem.value = "dd/mm/yyyy";
	}
};

function restoreTime(myItem){
	if ("" + myItem.value == "" ){
			myItem.value = "hh:mm";
	}
};

function emptyMe(myItem) {
	if ("" + myItem.value == "mm/yyyy" || "" + myItem.value == "hh:mm" || "" + myItem.value == "dd/mm/yyyy"){
			myItem.value = "";
	}
};

function checkHour(myItem){
	var myArrayHour, mytext, myHour, myMinute;
	mytext = "" + myItem.value;
	
	myArrayHour = mytext.split(":");
	myHour = parseInt(myArrayHour[0]);
	myMinute = parseInt(myArrayHour[1]);
	if((mytext != "hh:mm") && (isNaN(myHour) || isNaN(myMinute) || (myHour < 0) || (myHour > 23) || (myMinute < 0) || (myMinute > 59)))
	{
		alert("Please check your the format of the time (hh:mm)");
		myItem.focus();
		myItem.value = "hh:mm";
		return false;
	}
	else
	{
		return true;
	}
};

function checkCardNumber(myItem){
	var myStr;
	myStr = "" + myItem.value;
	
	if(isNaN(myItem.value) || (myStr.length != 16 && myStr.length != 15)){
		alert("Please check your credit card number, it should be 15 or 16 digits long without spaces.");
		myItem.focus();
		myItem.value = "";
	}
};

function checkExpiration(myItem){
	var myArrayDate, myMonth, myYear, myString, myYearDigit;
	myString = myItem.value + "";
	
	myArrayDate = myString.split("/");
	myMonth = parseInt(myArrayDate[0]);
	myYear = parseInt(myArrayDate[1]);
	myString = myArrayDate[1] + "";
	myYearDigit = myString.length;
	if (isNaN(myMonth) || isNaN(myYear) || (myMonth < 0) || (myMonth > 12) || (myYearDigit < 4))
	{
		alert("Please check your expiration date format (mm/yyyy)");
		myItem.focus();
		myItem.value = "mm/yyyy";
		return false;
	}
	else
	{
		return true;
	}
};

function checkAndCompareDate(FirstDate,SecondDate,type){
	if(checkDate(FirstDate) && checkDate(SecondDate)) return true;
	if(compareDates(FirstDate, SecondDate, type)) return true;
	else {
		SecondDate.value = "dd/mm/yyyy";
		alert("Arrival date should be before departure date.");
		return false;
	}
};

function checkDate(myItem){
	var myArrayDate, myDay, myMonth, myYear, myString, myYearDigit;
	myString = myItem.value + "";
	if (myString == "" || myString == "dd/mm/yyyy"){
		myItem.value = "dd/mm/yyyy";
		return true;
	}
	myArrayDate = myString.split("/");
	
	myDay = Math.round(parseFloat(myArrayDate[0]));
	myMonth = Math.round(parseFloat(myArrayDate[1]));
	myYear = Math.round(parseFloat(myArrayDate[2]));
	myString = myYear + "";
	myYearDigit = myString.length;
	
	if (isNaN(myDay) || isNaN(myMonth) || isNaN(myYear) || (myYear < 1) || (myDay < 1) || (myMonth < 1) || (myMonth > 12) || (myYearDigit != 4) || (myDay > days_in(myMonth, myYear)))
	{
		alert("Please check your date format. (dd/mm/yyyy)");
		myItem.value = "dd/mm/yyyy";
		return true;
	}
	else
	{
		return false;
	}
};

function isLeap(year){
	if(year % 400 == 0){
		return true;
	}
	else if((year % 4 == 0) && (year % 100 != 0)){
		return true
	}
	else return false;
};
	
function days_in(month, year){
	if(month == 4 || month == 6 || month == 9 || month == 11){
		return 30;
	}
	else if(!isLeap(year) && month == 2){
		return 28;
	}
	else if(isLeap(year) && month == 2){
		return 29;
	}
	else return 31;
};

function compareDates(myDate, myDate2, type){
	
	var myArrayDate, myArraydate2, myDay, myMonth, myYear, myString, myString2, myYearDigit, theDate = new Date(), theDate2 = new Date(), debut = new Date, fin = new Date();
	
	debut.setDate(10);
	debut.setMonth(03);
	debut.setYear(2002);
	fin.setDate(12);
	fin.setMonth(03);
	fin.setYear(2002);
	myString = myDate.value + "";
	myString2 = myDate2.value + "";
	myArrayDate = myString.split("/");
	myArrayDate2 = myString2.split("/");
	theDate.setDate(myArrayDate[0]);
	theDate.setMonth(myArrayDate[1]-1);
	theDate.setYear(myArrayDate[2]);
	theDate2.setDate(myArrayDate2[0]);
	theDate2.setMonth(myArrayDate2[1]-1);
	theDate2.setYear(myArrayDate2[2]);
	
	if (myString == "" || myString2 == "" || myString == "jj/mm/aaaa" || myString2 == "jj/mm/aaaa" || myString == "dd/mm/yyyy" || myString2 == "dd/mm/yyyy"){
			return true;
	}
	
	if(theDate2.valueOf() - theDate.valueOf() < 0){
		return false;
	}
	else{
		return true;
	}
};

function checkPrct(myItem1){
	var myForm,
		total = 0,
		prct1 = 0,
		prct2 = 0,
		prct3 = 0,
		prct4 = 0,
		prct5 = 0,
		prct6 = 0,
		prct7 = 0,
		prct8 = 0;
		
	myForm = myItem1.form;
	if(!isNaN(parseFloat("" + myForm.f_distribution_prct.value)))
		prct1 = parseFloat("" + myForm.f_distribution_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_integration_prct.value)))
		prct2 = parseFloat("" + myForm.f_integration_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_assembling_prct.value)))
		prct3 = parseFloat("" + myForm.f_assembling_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_development_prct.value)))
		prct4 = parseFloat("" + myForm.f_development_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_retail_prct.value)))
		prct5 = parseFloat("" + myForm.f_retail_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_service_prct.value)))
		prct6 = parseFloat("" + myForm.f_service_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_direct_prct.value)))
		prct7 = parseFloat("" + myForm.f_direct_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_other_prct.value)))
		prct8 = parseFloat("" + myForm.f_other_prct.value);
	
	
	if (checkNumeric(myItem1)){
		total = parseFloat(prct1) + parseFloat(prct2) + parseFloat(prct3) + parseFloat(prct4) + parseFloat(prct5) + parseFloat(prct6) + parseFloat(prct7) + parseFloat(prct8);
		if(parseFloat(total) > 100){
			alert("The percentages sum is greater than 100.");
			myItem1.value = "";
			return false;
		}
		else{
				return true;
		}
	}
};

function checkCust(myItem1){
	var myForm,
		total = 0,
		cust1 = 0,
		cust2 = 0,
		cust3 = 0,
		cust4 = 0,
		cust5 = 0,
		cust6 = 0,
		cust7 = 0,
		cust8 = 0,
		cust9 = 0,
		cust10 = 0,
		cust11 = 0;
		
	myForm = myItem1.form;
	if(!isNaN(parseFloat("" + myForm.f_cust_retailer_prct.value)))
		cust1 = parseFloat("" + myForm.f_cust_retailer_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_assembler_prct.value)))
		cust2 = parseFloat("" + myForm.f_cust_assembler_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_dealer_prct.value)))
		cust3 = parseFloat("" + myForm.f_cust_dealer_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_ecommerce_prct.value)))
		cust4 = parseFloat("" + myForm.f_cust_ecommerce_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_sub_distri_prct.value)))
		cust5 = parseFloat("" + myForm.f_cust_sub_distri_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_franchise_prct.value)))
		cust6 = parseFloat("" + myForm.f_cust_franchise_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_var_prct.value)))
		cust7 = parseFloat("" + myForm.f_cust_var_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_trader_prct.value)))
		cust8 = parseFloat("" + myForm.f_cust_trader_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_reseller_prct.value)))
		cust9 = parseFloat("" + myForm.f_cust_reseller_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_export_prct.value)))
		cust10 = parseFloat("" + myForm.f_cust_export_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_cust_telco_prct.value)))
		cust11 = parseFloat("" + myForm.f_cust_telco_prct.value);
	
	if (checkNumeric(myItem1)){
		total = parseFloat(cust1) + parseFloat(cust2) + parseFloat(cust3) + parseFloat(cust4) + parseFloat(cust5) + parseFloat(cust6) + parseFloat(cust7) + parseFloat(cust8) + parseFloat(cust9) + parseFloat(cust10) + parseFloat(cust11);
		if(parseFloat(total) > 100){
			alert("The percentages sum is greater than 100.");
			myItem1.value = "";
			return false;
		}
		else{
				return true;
		}
	}
};

function checkGeoPrct(myItem1){
	var myForm,
		total = 0,
		prct1 = 0,
		prct2 = 0,
		prct3 = 0;
		
	myForm = myItem1.form;
	if(!isNaN(parseFloat("" + myForm.f_national_prct.value)))
		prct1 = parseFloat("" + myForm.f_national_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_regional_prct.value)))
		prct2 = parseFloat("" + myForm.f_regional_prct.value);
	if(!isNaN(parseFloat("" + myForm.f_international_prct.value)))
		prct3 = parseFloat("" + myForm.f_international_prct.value);
	
	if (checkNumeric(myItem1)){
		total = parseFloat(prct1) + parseFloat(prct2) + parseFloat(prct3);
		if(parseFloat(total) > 100){
			alert("The percentages sum is greater than 100.");
			myItem1.value = "";
			return false;
		}
		else{
				return true;
		}
	}
};

function changeLogistic() {
	document.forms[0].f_change_logistic.value = 1;
};
function changeReservation() {
	document.forms[0].f_change_reservation.value = 1;
};
function getValidate(myFirstDate,myLastDate,sNights,my_remote,typeStr,my_person){
	var myForm=document.forms[0],myURL =""; 
	if(document.forms[0].f_invited[0].checked == true || document.forms[0].f_will_attend[0].checked == true){
		myURL =	"../secured/HotelBooking/admin/hb_f1.asp?f_arr=" + myFirstDate; 
		myURL = myURL + "&f_dep=" + myLastDate; 
		myURL = myURL + "&f_admin=2&f_orig=" + sNights + "&f_nights=" + sNights;
		myURL = myURL + "&f_first_name=";
		myURL = myURL + escape(myForm.f_first_name.value);
		myURL = myURL + "&f_last_name=";
		myURL = myURL + escape(myForm.f_last_name.value);
		myURL = myURL + "&f_type=" + my_remote + "&f_typeStr=" + typeStr + "&f_id_person=" + my_person;
		launchwin(myURL,"hb","alwaysRaised=yes,height=480,width=500,menubar=no,resizable=yes,toolbar=no,status=yes,screenX=50,scrollbars=no");
	}else{
		alert("This attendee is not confirmed.");
	}
};
function getValidate2(myFirstDate,myLastDate,sNights,my_remote,typeStr,my_person){
	var myForm=document.forms[0],myURL =""; 
	if(document.forms[0].f_status.value == 'inv' || document.forms[0].f_status.value == 'conf'){
		myURL =	"../secured/HotelBooking/admin/hb_f1.asp?f_arr=" + myFirstDate; 
		myURL = myURL + "&f_dep=" + myLastDate; 
		myURL = myURL + "&f_admin=2&f_orig=" + sNights + "&f_nights=" + sNights;
		myURL = myURL + "&f_first_name=";
		myURL = myURL + escape(myForm.f_first_name.value);
		myURL = myURL + "&f_last_name=";
		myURL = myURL + escape(myForm.f_last_name.value);
		myURL = myURL + "&f_type=" + my_remote + "&f_typeStr=" + typeStr + "&f_id_person=" + my_person;
		launchwin(myURL,"hb","alwaysRaised=yes,height=480,width=500,menubar=no,resizable=yes,toolbar=no,status=yes,screenX=50,scrollbars=no");
	}else{
		alert("This attendee is not confirmed.");
	}
};
function editHotelBooking(myFirstDate,myLastDate,sNights,my_remote,typeStr,my_person){
	var myForm=document.forms[0],myURL ="";
	if(document.forms[0].f_invited[0].checked == true || document.forms[0].f_will_attend[0].checked == true){
		myURL =	"../secured/HotelBooking/admin/hb_f1.asp?f_arr=" + myFirstDate;
		myURL = myURL + "&f_dep=" + myLastDate;
		myURL = myURL + "&f_admin=1&f_orig=" + sNights + "&f_nights=" + sNights;
		myURL = myURL + "&f_first_name=";
		myURL = myURL + escape(myForm.f_first_name.value);
		myURL = myURL + "&f_last_name=";
		myURL = myURL + escape(myForm.f_last_name.value);
		myURL = myURL + "&f_type=" + my_remote + "&f_typeStr=" + typeStr;
		myURL = myURL + "&f_id_person=" + my_person;
		launchwin(myURL,"hb","alwaysRaised=yes,height=480,width=500,menubar=no,resizable=yes,toolbar=no,status=yes,screenX=50,scrollbars=no");
	}else{
		alert("This attendee is not confirmed.");
	}	
};
function editHotelBooking2(myFirstDate,myLastDate,sNights,my_remote,typeStr,my_person){
	var myForm=document.forms[0],myURL ="";
	if(document.forms[0].f_status.value == 'inv' || document.forms[0].f_status.value == 'conf'){
		myURL =	"../secured/HotelBooking/admin/hb_f1.asp?f_arr=" + myFirstDate;
		myURL = myURL + "&f_dep=" + myLastDate;
		myURL = myURL + "&f_admin=1&f_orig=" + sNights + "&f_nights=" + sNights;
		myURL = myURL + "&f_first_name=";
		myURL = myURL + escape(myForm.f_first_name.value);
		myURL = myURL + "&f_last_name=";
		myURL = myURL + escape(myForm.f_last_name.value);
		myURL = myURL + "&f_type=" + my_remote + "&f_typeStr=" + typeStr;
		myURL = myURL + "&f_id_person=" + my_person;
		launchwin(myURL,"hb","alwaysRaised=yes,height=480,width=500,menubar=no,resizable=yes,toolbar=no,status=yes,screenX=50,scrollbars=no");
	}else{
		alert("This attendee is not confirmed.");
	}	
};
function getHotelBooking(my_remote,typeStr,my_person){
	var myForm=document.forms[0],myURL ="";
	if(document.forms[0].f_invited[0].checked == true || document.forms[0].f_will_attend[0].checked == true){
		myURL =	"../secured/HotelBooking/admin/hb_f1.asp?f_arr=";
		if (myForm.f_arrival_date.value != "dd/mm/yyyy"){
			myURL = myURL + escape(myForm.f_arrival_date.value);
		}
		myURL = myURL + "&f_dep=";
		if (myForm.f_departure_date.value != "dd/mm/yyyy"){;
			myURL = myURL + escape(myForm.f_departure_date.value);
		}
		myURL = myURL + "&f_admin=0&f_first_name=";
		myURL = myURL + escape(myForm.f_first_name.value);
		myURL = myURL + "&f_last_name=";
		myURL = myURL + escape(myForm.f_last_name.value);
		myURL = myURL + "&f_type=" + my_remote + "&f_typeStr=" + typeStr + "&f_id_person=" + my_person;
		launchwin(myURL,"hb","alwaysRaised=yes,height=480,width=500,menubar=no,resizable=yes,toolbar=no,status=yes,screenX=50,scrollbars=no");
	}else{
		alert("This attendee is not confirmed.");
	}
};
function getHotelBooking2(my_remote,typeStr,my_person){
	var myForm=document.forms[0],myURL ="";
	if(document.forms[0].f_status.value == 'inv' || document.forms[0].f_status.value == 'conf'){
		myURL =	"../secured/HotelBooking/admin/hb_f1.asp?f_arr=";
		if (myForm.f_arrival_date.value != "dd/mm/yyyy" && myForm.f_arrival_date.value != "jj/mm/aaaa"){
			myURL = myURL + escape(myForm.f_arrival_date.value);
		}
		myURL = myURL + "&f_dep=";
		if (myForm.f_departure_date.value != "dd/mm/yyyy" && myForm.f_departure_date.value != "jj/mm/aaaa"){;
			myURL = myURL + escape(myForm.f_departure_date.value);
		}
		myURL = myURL + "&f_admin=0&f_first_name=";
		myURL = myURL + escape(myForm.f_first_name.value);
		myURL = myURL + "&f_last_name=";
		myURL = myURL + escape(myForm.f_last_name.value);
		myURL = myURL + "&f_type=" + my_remote + "&f_typeStr=" + typeStr + "&f_id_person=" + my_person;
		launchwin(myURL,"hb","alwaysRaised=yes,height=480,width=500,menubar=no,resizable=yes,toolbar=no,status=yes,screenX=50,scrollbars=no");
	}else{
		alert("This attendee is not confirmed.");
	}
};
function getHotelBookingUser_index(my_remote,typeStr,my_person,my_index){
	var myForm=document.forms[0],myURL ="";
	myURL =	"../secured/HotelBooking/hb_f1.asp?f_arr=";
	if (myForm.f_arrival_date[my_index].value != "dd/mm/yyyy"){
		myURL = myURL + escape(myForm.f_arrival_date[my_index].value);
	}
	myURL = myURL + "&f_dep=";
	if (myForm.f_departure_date[my_index].value != "dd/mm/yyyy"){;
		myURL = myURL + escape(myForm.f_departure_date[my_index].value);
	}
	myURL = myURL + "&f_admin=0&f_first_name=";
	myURL = myURL + escape(myForm.f_first_name[my_index].value);
	myURL = myURL + "&f_last_name=";
	myURL = myURL + escape(myForm.f_last_name[my_index].value);
	myURL = myURL + "&f_type=" + my_remote + "&f_typeStr=" + typeStr + "&f_id_person=" + my_person;
	launchwin(myURL,"hb","alwaysRaised=yes,height=480,width=500,menubar=no,resizable=yes,toolbar=no,status=yes,screenX=50,scrollbars=no");
};
function getHotelBookingUser(my_remote,typeStr,my_person){
	var myForm=document.forms[0],myURL ="";
	myURL =	"../secured/HotelBooking/hb_f1.asp?f_arr=";
	if (myForm.f_arrival_date.value != "dd/mm/yyyy"){
		myURL = myURL + escape(myForm.f_arrival_date.value);
	}
	myURL = myURL + "&f_dep=";
	if (myForm.f_departure_date.value != "dd/mm/yyyy"){;
		myURL = myURL + escape(myForm.f_departure_date.value);
	}
	myURL = myURL + "&f_admin=0&f_first_name=";
	myURL = myURL + escape(myForm.f_first_name.value);
	myURL = myURL + "&f_last_name=";
	myURL = myURL + escape(myForm.f_last_name.value);
	myURL = myURL + "&f_type=" + my_remote + "&f_typeStr=" + typeStr + "&f_id_person=" + my_person;
	launchwin(myURL,"hb","alwaysRaised=yes,height=480,width=500,menubar=no,resizable=yes,toolbar=no,status=yes,screenX=50,scrollbars=no");
};

function bc_itLoad(myContent){
	window.parent.parent.frames[0].location.replace("../bc_itmanage.asp?f_content=" + myContent);
};
function bc_itLoadParent(myContent){
	window.parent.parent.parent.frames[0].location.replace("../bc_itmanage.asp?f_content=" + myContent);
};
function bc_visLoad(myContent){
	window.parent.parent.frames[0].location.replace("../bc_vismanage.asp?f_content=" + myContent);
};
function bc_visLoadParent(myContent){
	window.parent.parent.parent.frames[0].location.replace("../bc_vismanage.asp?f_content=" + myContent);
};
function bc_parLoad(myContent){
	window.parent.parent.frames[0].location.replace("../bc_parmanage.asp?f_content=" + myContent);
};
function bc_parLoadParent(myContent){
	window.parent.parent.parent.frames[0].location.replace("../bc_parmanage.asp?f_content=" + myContent);
};
function bc_venLoad(myContent){
	window.parent.parent.frames[0].location.replace("../bc_venmanage.asp?f_content=" + myContent);
};
function bc_venLoadParent(myContent){
	window.parent.parent.parent.frames[0].location.replace("../bc_venmanage.asp?f_content=" + myContent);
};
function bc_jouLoad(myContent){
	window.parent.parent.frames[0].location.replace("../bc_joumanage.asp?f_content=" + myContent);
};
function bc_jouLoadParent(myContent){
	window.parent.parent.parent.frames[0].location.replace("../bc_joumanage.asp?f_content=" + myContent);
};
function bc_speLoad(myContent){
	window.parent.parent.frames[0].location.replace("../bc_spemanage.asp?f_content=" + myContent);
};
function bc_speLoadParent(myContent){
	window.parent.parent.parent.frames[0].location.replace("../bc_spemanage.asp?f_content=" + myContent);
};
function bc_staLoad(myContent){
	window.parent.parent.frames[0].location.replace("../bc_stamanage.asp?f_content=" + myContent);
};
function bc_staLoadParent(myContent){
	window.parent.parent.parent.frames[0].location.replace("../bc_stamanage.asp?f_content=" + myContent);
};
function countAdminChar(myItem, myCounter, myLen) {
    var myLength = 0,
	myString = "",
	myCounterElement,
	counter = 0;

    myString = "" + myItem.value;
    myLength = myString.length;
    myCounterElement = eval("document.forms[0]." + myCounter);

    if (myLength > myLen) {
        myItem.value = myString.substring(0, myLen);
        alert("Maximum size is " + myLen + " characters.");
    }
    counter = myLength;
    myCounterElement.value = counter;
};
