//////////////////////////////////////////////
// Page navigation (lduchosal)
// navigation.js
// Last modified : 20/06/2001
//////////////////////////////////////////////

// loadContent
/**
function loadContent(contentName) {
	document.NavigationPrincipale.Action.value=contentName;
	document.NavigationPrincipale.action=contentName + ".asp";
//	document.NavigationPrincipale.Nav1.value=contentName;
//	document.NavigationPrincipale.Nav2.value='';
	// alert(contentName);
	//alert(document.NavigationPrincipale.Action.Value);
	document.NavigationPrincipale.submit();
}**/

function loadPage() {
	var contentName;
	contentName = document.NavigationPrincipale.Action.value;
	//TD_products.bgcolor=red;
	//alert(contentName);
}

function loadOption(oSelect, oForm) {
	// 
	var intIndex=oSelect.selectedIndex;
	var intValue=oSelect.options[intIndex].value;
	if (intValue != 0) { oForm.submit(); }
}

/**
function loadProduct(intIdProduct, oForm) {
	// alert("You are going to see product : "+ intIdProduct);
	//alert(oForm);
	oForm.action='products.asp';
//	oForm.Nav2.value='Product'
	oForm.IdProduct.value=intIdProduct;
	oForm.submit();
	
}

function loadJob(strJobsCategory) {
	document.Jobs.action='Jobs.asp';
	if (strJobsCategory != '') {
//		document.Jobs.Nav2.value=strJobsCategory;
		document.Jobs.Action.value=strJobsCategory;
		document.Jobs.submit();
	}
}**/

function loadDocument(intIdImage) {
	
}

function loadURL(strURL) {
	var newWindow = open(strURL);
}

function loadOffice(intIdCountry, strCountry) {
	//alert("Chargement des contact du pays "+ strContinent +" en cours.\nVeuillez patienter...");
	document.Office.action="Office.asp";
	if (!isNaN(intIdCountry)) {
		document.Office.Action.value=intIdCountry;
//		document.Office.Nav2.value=strCountry;
		document.Office.submit();
	}
}

/**
function loadDatasheet(strFilename) {
	var newWindow = open('/webfiles/'+ strFilename);
}

function loadAnchor(strAnchor) {
	document.location.href='#'+strAnchor;
}

function loadLine(strLine, intIdLine) {
	if (!isNaN(intIdLine) && intIdLine!=0) {	
		//alert('hehehe\nVous allez soumettre ce formulaire avec les paramêtres suivants:\n-action=line.asp\n-IdLine='+ intIdLine +'\n-Nav1='+strLine);

		document.Line.action='Line.asp';
		document.Line.IdLine.value=intIdLine;
//		document.Line.Nav1.value=strLine;
		document.Line.submit();
	}
}
function loadLine(strLine, intIdLine, intDisplayType) {
	if (!isNaN(intIdLine) && intIdLine!=0) {	
		//alert('hehehe\nVous allez soumettre ce formulaire avec les paramêtres suivants:\n-action=line.asp\n-IdLine='+ intIdLine +'\n-Nav1='+strLine);

		document.Line.action='Line'+ intDisplayType +'.asp';
		document.Line.IdLine.value=intIdLine;
//		document.Line.Nav1.value=strLine;
		document.Line.submit();
	}
}

function loadNews(intIdNews) {
	
	document.News.action="DetailNews.asp";
	document.News.Action.value=intIdNews;
	document.News.submit();	
	
}**/

function loadSales(intIdSale) {
	
	document.Sales.action="Sales.asp";
	document.Sales.Action.value=intIdSale;
	document.Sales.submit();	
	
}

function validContact(contactForm){

	var strMsg,	formLen, i, intTOR=0, intProductType=0;
	formLen = contactForm.elements.length;
	strMsg = 'The following fields are required:\n';
	for(i=0; i<formLen; i++){
	 	if(contactForm.elements[i].name == 'Family name' && contactForm.elements[i].value == ''){ strMsg = 'Please fill out all the fields marked with * in the Personal Information section.'; }
	 	if(contactForm.elements[i].name == 'Company' && contactForm.elements[i].value == ''){ strMsg = 'Please fill out all the fields marked with * in the Personal Information section.'; }
	 	if(contactForm.elements[i].name == 'Email address' && contactForm.elements[i].value == ''){ strMsg = 'Please fill out all the fields marked with * in the Personal Information section.'; }
		if(contactForm.elements[i].name == 'Application' && contactForm.elements[i].value == ''){ strMsg = 'Please fill out all the fields marked with * in the Personal Information section.'; }
		if(contactForm.elements[i].name == 'Website' && contactForm.elements[i].value == ''){ strMsg = 'Please fill out all the fields marked with * in the Personal Information section.'; }
		if(contactForm.elements[i].name == 'Country' && contactForm.elements[i].value == ''){ strMsg = 'Please fill out all the fields marked with * in the Personal Information section.'; }
		//if(contactForm.elements[i].name == 'Samples' || contactForm.elements[i].name == 'Price' || contactForm.elements[i].name == 'Alternative source' || contactForm.elements[i].name == 'Other' || contactForm.elements[i].name == 'Datasheet' || contactForm.elements[i].name == 'Technical information' || contactForm.elements[i].name == 'Employment') {
		//  if(contactForm.elements[i].checked == true){ intTOR++;	}
		//}

		if(contactForm.elements[i].name == 'RFID' || contactForm.elements[i].name == 'Real Time clocks Ics' || contactForm.elements[i].name == 'LCD Drivers' || contactForm.elements[i].name == 'Supervisory Ics' || contactForm.elements[i].name == 'Microcontroller' || contactForm.elements[i].name == 'ASICs' || contactForm.elements[i].name == 'Others' || contactForm.elements[i].name == 'Smart cards' ||
contactForm.elements[i].name == 'Services' || contactForm.elements[i].name == 'Analog & digital gate array' ||
contactForm.elements[i].name == 'LCD & Modules' ) {
		  if(contactForm.elements[i].checked == true){ intProductType++;	}
		}
	}
	
	//if(intTOR == 0){ strMsg += '  - Type of request\n'; }
	if(intProductType == 0){ strMsg = 'Check at least one box in the Product section.'; }
	if (strMsg.length!=35) { alert(strMsg); } 
	else { 
		contactForm.action='SendForm.asp';
		contactForm.submit(); 
	}
}
