// SITE MANAGEMENT
function addSite(selectedId) {
		window.location.href="ax.site.php?action=add&countryId="+selectedId;
}
function editSite(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a site");
	} else {
		window.location.href="ax.site.php?action=edit&countryId="+selectedId;
	}
}
function delSite(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a site");
	} else {
		if(confirm("Delete complete country site - are you sure?") == true) {
			window.location.href="ax.site.php?action=del&countryId="+selectedId;
		}
	}
}
//function openSiteWin(selectedId,action) {
//	winPage = 'ax.site.php?id='+selectedId+'&action='+action;
//	siteBox=dhtmlwindow.open('siteBox', 'iframe', winPage, 'Country sites', 'width=600px,height=450px,left=150px,top=100px,resize=1,scrolling=0,center=0');
//	return false;
//}

// PAGE MANAGEMENT
function addPage(selectedId) {
		window.location.href="ax.page.php?action=add&pageId="+selectedId;
}
function editPage(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a page");
	} else {
		window.location.href="ax.page.php?action=edit&pageId="+selectedId;
	}
}
function delPage(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a page");
	} else {
		if(confirm("Delete page - are you sure?") == true) {
			window.location.href="ax.page.php?action=del&pageId="+selectedId;
		}
	}
}
//function openPageWin(selectedId,action) {
//	winPage = 'ax.page.php?id='+selectedId+'&action='+action;
//	pageBox=dhtmlwindow.open('pageBox', 'iframe', winPage, 'Pages', 'width=650px,height=450px,left=120px,top=80px,resize=1,scrolling=0,center=0');
//	return false;
//}

// PRODUCT GROUPS
function addProductGroup(selectedId) {
		window.location.href="ax.productGroups.php?action=add&groupNumber="+selectedId;
}
function editProductGroup(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a product group");
	} else {
		window.location.href="ax.productGroups.php?action=edit&groupNumber="+selectedId;
	}
}
function delProductGroup(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a product group");
	} else {
		if(confirm("Delete product group - are you sure?") == true) {
			window.location.href="ax.productGroups.php?action=del&groupNumber="+selectedId;
		}
	}
}

// USER PRODUCT GROUPS
function editUserProductGroup(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a product group");
	} else {
		window.location.href="ax.user.productGroups.php?c="+country+"&action=edit&groupNumber="+selectedId;
	}
}

// PRODUCTS
function addProduct(country,selectedId) {
		window.location.href="ax.products.php?c="+country+"&action=add&productId="+selectedId;
}
function editProduct(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a product");
	} else {
		window.location.href="ax.products.php?c="+country+"&action=edit&productId="+selectedId;
	}
}
function delProduct(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a product");
	} else {
		if(confirm("Delete product - are you sure?") == true) {
			window.location.href="ax.products.php?c="+country+"&action=del&productId="+selectedId;
		}
	}
}

// USER PRODUCTS
function editUserProduct(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a product");
	} else {
		window.location.href="ax.user.products.php?c="+country+"&action=edit&productId="+selectedId;
	}
}

// PRODUCT LINKS TO PACKING
function addProductLinksToPacking(selectedId) {
		window.location.href="ax.productLinksToPacking.php?action=add&linksProductToPackingId="+selectedId;
}
function editProductLinksToPacking(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a row");
	} else {
		window.location.href="ax.productLinksToPacking.php?action=edit&linksProductToPackingId="+selectedId;
	}
}
function delProductLinksToPacking(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a row");
	} else {
		if(confirm("Delete link - are you sure?") == true) {
			window.location.href="ax.productLinksToPacking.php?action=del&linksProductToPackingId="+selectedId;
		}
	}
}

// PRODUCT PACKING
function addProductPacking(selectedId) {
		window.location.href="ax.productPacking.php?action=add&packingNumber="+selectedId;
}
function editProductPacking(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a packing");
	} else {
		window.location.href="ax.productPacking.php?action=edit&packingNumber="+selectedId;
	}
}
function delProductPacking(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a packing");
	} else {
		if(confirm("Delete packing - are you sure?") == true) {
			window.location.href="ax.productPacking.php?action=del&packingNumber="+selectedId;
		}
	}
}

// USER PRODUCT PACKING
function editUserProductPacking(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a packing");
	} else {
		window.location.href="ax.user.productPacking.php?c="+country+"&action=edit&packingNumber="+selectedId;
	}
}

// FIELDS OF APPLICATION
function addFieldsOfApplication(selectedId) {
		window.location.href="ax.fieldsOfApplication.php?action=add&fieldsOfApplicationId="+selectedId;
}
function editFieldsOfApplication(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a field of application");
	} else {
		window.location.href="ax.fieldsOfApplication.php?action=edit&fieldsOfApplicationId="+selectedId;
	}
}
function delFieldsOfApplication(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a field of application");
	} else {
		if(confirm("Delete field of application - are you sure?") == true) {
			window.location.href="ax.fieldsOfApplication.php?action=del&fieldsOfApplicationId="+selectedId;
		}
	}
}

// USER FIELDS OF APPLICATION
function editUserFieldsOfApplication(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a field of application");
	} else {
		window.location.href="ax.user.fieldsOfApplication.php?c="+country+"&action=edit&fieldsOfApplicationId="+selectedId;
	}
}

// SPECIFICATIONS
function addSpecification(selectedId) {
		window.location.href="ax.specifications.php?action=add&specificationId="+selectedId;
}
function editSpecification(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a specification");
	} else {
		window.location.href="ax.specifications.php?action=edit&specificationId="+selectedId;
	}
}
function delSpecification(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a specification");
	} else {
		if(confirm("Delete specification - are you sure?") == true) {
			window.location.href="ax.specifications.php?action=del&specificationId="+selectedId;
		}
	}
}
// USER SPECIFICATIONS
function editUserSpecification(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a specification");
	} else {
		window.location.href="ax.user.specifications.php?c="+country+"&action=edit&specificationDetailId="+selectedId;
	}
}


// SPECIFICATION GROUPS
function addSpecificationGroup(selectedId) {
		window.location.href="ax.specificationGroups.php?action=add&specificationGroupNumber="+selectedId;
}
function editSpecificationGroup(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a specification group");
	} else {
		window.location.href="ax.specificationGroups.php?action=edit&specificationGroupNumber="+selectedId;
	}
}
function delSpecificationGroup(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a specification group");
	} else {
		if(confirm("Delete specification group - are you sure?") == true) {
			window.location.href="ax.specificationGroups.php?action=del&specificationGroupNumber="+selectedId;
		}
	}
}
// USER SPECIFICATION GROUPS
function editUserSpecificationGroup(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a specification group");
	} else {
		window.location.href="ax.user.specificationGroups.php?c="+country+"&action=edit&specificationGroupId="+selectedId;
	}
}


// DOCUMENTS
function addDocument(country,selectedId) {
		window.location.href="ax.documents.php?c="+country+"&action=add&documentNumber="+selectedId;
}
function editDocument(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a document");
	} else {
		window.location.href="ax.documents.php?c="+country+"&action=edit&documentNumber="+selectedId;
	}
}
function delDocument(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a document");
	} else {
		if(confirm("Delete document - are you sure?") == true) {
			window.location.href="ax.documents.php?c="+country+"&action=del&documentNumber="+selectedId;
		}
	}
}

// USER DOCUMENTS
function editUserDocument(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a document");
	} else {
		window.location.href="ax.user.documents.php?c="+country+"&action=edit&documentId="+selectedId;
	}
}



// CONTACT WORLD CONTINENTS
function addContactWorldContinent(selectedId) {
		window.location.href="ax.contactWorldContinents.php?action=add&worldContactContinentNumber="+selectedId;
}
function editContactWorldContinent(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a continent");
	} else {
		window.location.href="ax.contactWorldContinents.php?action=edit&worldContactContinentNumber="+selectedId;
	}
}
function delContactWorldContinent(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a continent");
	} else {
		if(confirm("Delete continent - are you sure?") == true) {
			window.location.href="ax.contactWorldContinents.php?action=del&worldContactContinentNumber="+selectedId;
		}
	}
}
// USER CONTACT WORLD CONTINENT
function editUserContactWorldContinent(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a continent");
	} else {
		window.location.href="ax.user.contactWorldContinents.php?c="+country+"&action=edit&worldContactContinentNumber="+selectedId;
	}
}



// CONTACT WORLD COUNTRIES
function addContactWorldCountry(selectedId) {
		window.location.href="ax.contactWorldCountries.php?action=add&worldContactCountriesNumber="+selectedId;
}
function editContactWorldCountry(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a country");
	} else {
		window.location.href="ax.contactWorldCountries.php?action=edit&worldContactCountriesNumber="+selectedId;
	}
}
function delContactWorldCountry(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a country");
	} else {
		if(confirm("Delete country - are you sure?") == true) {
			window.location.href="ax.contactWorldCountries.php?action=del&worldContactCountriesNumber="+selectedId;
		}
	}
}
// USER CONTACT WORLD COUNTRIES
function editUserContactWorldCountry(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a country");
	} else {
		window.location.href="ax.user.contactWorldCountries.php?c="+country+"&action=edit&worldContactCountriesNumber="+selectedId;
	}
}






// CONTACT WORLD
function addContactWorld(selectedId) {
		window.location.href="ax.contactWorld.php?action=add&worldContactAddressId="+selectedId;
}
function editContactWorld(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact");
	} else {
		window.location.href="ax.contactWorld.php?action=edit&worldContactAddressId="+selectedId;
	}
}
function delContactWorld(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact");
	} else {
		if(confirm("Delete contact - are you sure?") == true) {
			window.location.href="ax.contactWorld.php?action=del&worldContactAddressId="+selectedId;
		}
	}
}
// USER CONTACT WORLD
function editUserContactWorld(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact");
	} else {
		window.location.href="ax.user.contactWorld.php?c="+country+"&action=edit&worldContactAddressId="+selectedId;
	}
}

// CONTACT AMERICA
function addContactAmerica(selectedId) {
		window.location.href="ax.contactAmerica.php?action=add&americaContactAddressId="+selectedId;
}
function editContactAmerica(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact");
	} else {
		window.location.href="ax.contactAmerica.php?action=edit&americaContactAddressId="+selectedId;
	}
}
function delContactAmerica(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact");
	} else {
		if(confirm("Delete contact - are you sure?") == true) {
			window.location.href="ax.contactAmerica.php?action=del&americaContactAddressId="+selectedId;
		}
	}
}


// CONTACT GERMANY
function addContactGermany(country,selectedId) {
		window.location.href="ax.contactGermany.php?c="+country+"&action=add&plzContactPersonId="+selectedId;
}
function editContactGermany(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact");
	} else {
		window.location.href="ax.contactGermany.php?c="+country+"&action=edit&plzContactPersonId="+selectedId;
	}
}
function delContactGermany(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact");
	} else {
		if(confirm("Delete contact - are you sure?") == true) {
			window.location.href="ax.contactGermany.php?c="+country+"&action=del&plzContactPersonId="+selectedId;
		}
	}
}
// USER CONTACT GERMANY
function editUserContactGermany(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact");
	} else {
		window.location.href="ax.user.contactGermany.php?c="+country+"&action=edit&plzContactPersonId="+selectedId;
	}
}

// CONTACT GERMANY PLZ
function addContactGermanyPLZ(selectedId) {
		if(selectedId == "0") { selectedId = ""; }
		window.location.href="ax.contactGermanyPLZ.php?action=add&fromto="+selectedId;
}
function editContactGermanyPLZ(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a row");
	} else {
		window.location.href="ax.contactGermanyPLZ.php?action=edit&fromto="+selectedId;
	}
}
function delContactGermanyPLZ(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a row");
	} else {
		if(confirm("Delete row - are you sure?") == true) {
			window.location.href="ax.contactGermanyPLZ.php?action=del&fromto="+selectedId;
		}
	}
}




// REFERENCES
function addReference(country,selectedId) {
		window.location.href="ax.references.php?c="+country+"&action=add&referencesId="+selectedId;
}
function editReference(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a reference");
	} else {
		window.location.href="ax.references.php?c="+country+"&action=edit&referencesId="+selectedId;
	}
}
function delReference(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a reference");
	} else {
		if(confirm("Delete reference - are you sure?") == true) {
			window.location.href="ax.references.php?c="+country+"&action=del&referencesId="+selectedId;
		}
	}
}

// NEWS
function addNews(country,selectedId) {
		window.location.href="ax.news.php?c="+country+"&action=add&newsId="+selectedId;
}
function editNews(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a news");
	} else {
		window.location.href="ax.news.php?c="+country+"&action=edit&newsId="+selectedId;
	}
}
function delNews(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a news");
	} else {
		if(confirm("Delete news - are you sure?") == true) {
			window.location.href="ax.news.php?c="+country+"&action=del&newsId="+selectedId;
		}
	}
}


// MESSAGES
function addMessage(country,selectedId) {
		window.location.href="ax.messages.php?c="+country+"&action=add&messageId="+selectedId;
}
function editMessage(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a message");
	} else {
		window.location.href="ax.messages.php?c="+country+"&action=edit&messageId="+selectedId;
	}
}
function delMessage(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a message");
	} else {
		if(confirm("Delete message - are you sure?") == true) {
			window.location.href="ax.messages.php?c="+country+"&action=del&messageId="+selectedId;
		}
	}
}


// GLOSSAR
function addGlossar(selectedId) {
		window.location.href="ax.glossar.php?action=add&glossarNumber="+selectedId;
}
function editGlossar(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a row");
	} else {
		window.location.href="ax.glossar.php?action=edit&glossarNumber="+selectedId;
	}
}
function delGlossar(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a row");
	} else {
		if(confirm("Delete row - are you sure?") == true) {
			window.location.href="ax.glossar.php?action=del&glossarNumber="+selectedId;
		}
	}
}
// USER GLOSSAR
function editUserGlossar(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a row");
	} else {
		window.location.href="ax.user.glossar.php?c="+country+"&action=edit&glossarId="+selectedId;
	}
}


// NEWS
function addSeminar(country,selectedId) {
		window.location.href="ax.seminars.php?c="+country+"&action=add&seminarId="+selectedId;
}
function editSeminar(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a seminar");
	} else {
		window.location.href="ax.seminars.php?c="+country+"&action=edit&seminarId="+selectedId;
	}
}
function delSeminar(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a seminar");
	} else {
		if(confirm("Delete seminar - are you sure?") == true) {
			window.location.href="ax.seminars.php?c="+country+"&action=del&seminarId="+selectedId;
		}
	}
}




// USER TRANSLATION
function editUserTranslation(country,selectedId) {
	if(selectedId <= 0) {
		alert("Please select a row");
	} else {
		window.location.href="ax.user.translation.php?c="+country+"&action=edit&allKeywordsId="+selectedId;
	}
}



// USER ADMIN
function addUser(selectedId) {
		window.location.href="ax.useradmin.php?action=add&id="+selectedId;
}

function editUser(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a user");
	} else {
		window.location.href="ax.useradmin.php?action=edit&id="+selectedId;
	}
}

function delUser(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a user");
	} else {
		if(confirm("Delete user - are you sure?") == true) {
			window.location.href="ax.useradmin.php?action=del&id="+selectedId;
		}
	}
}

// LOGGING PROTOCOL
function editLog(selectedId) {
	if(selectedId <= 0) {
		alert("Please select record");
	} else {
		window.location.href="ax.log.php?action=edit&logId="+selectedId;
	}
}

// CONTACT MAILS
function editContactmail(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact mail");
	} else {
		window.location.href="ax.contactmails.php?action=edit&id="+selectedId;
	}
}

function delContactmail(selectedId) {
	if(selectedId <= 0) {
		alert("Please select a contact mail");
	} else {
		if(confirm("Delete contact mail - are you sure?") == true) {
			window.location.href="ax.contactmails.php?action=del&id="+selectedId;
		}
	}
}

function delAllContactmail() {
		if(confirm("Delete all contact mails - are you sure?") == true) {
			window.location.href="ax.contactmails.php?action=delall";
		}
}


// OTHER

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "0";
}

function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}

function changeExternalURL (myStatus) {
	if(myStatus == true) {
		document.getElementById('languageFlagURL').readOnly = "readonly";
		document.getElementById('logoURL').readOnly = "readonly";
		document.getElementById('basedOn').disabled = true;
		document.getElementById('headerMetaDescription').readOnly = "readonly";
		document.getElementById('headerMetaKeywords').readOnly = "readonly";
		document.getElementById('headerTitle').readOnly = "readonly";	                   	
	} else {
		document.getElementById('languageFlagURL').readOnly = "";
		document.getElementById('logoURL').readOnly = "";
		document.getElementById('basedOn').disabled = false;
		document.getElementById('headerMetaDescription').readOnly = "";
		document.getElementById('headerMetaKeywords').readOnly = "";
		document.getElementById('headerTitle').readOnly = "";	
	}
}

function checkContactForm() {
	var isOK = 1;
	if ((document.getElementsByName("Phone")[0].value == "") && (document.getElementsByName("E-Mail")[0].value == "")   ) {
		document.getElementsByName("Phone")[0].select();
		document.getElementsByName("Phone")[0].focus();
		document.getElementsByName("Phone")[0].style.border = "2px solid #ff9999";
		document.getElementsByName("E-Mail")[0].style.border = "2px solid #ff9999";
		isOK = 0;
	} else {
		document.getElementsByName("Phone")[0].style.border = "1px solid #cccccc";
		document.getElementsByName("E-Mail")[0].style.border = "1px solid #cccccc";			    
	}

	if (document.getElementsByName("Country")[0].value == "")    {
		document.getElementsByName("Country")[0].select();
		document.getElementsByName("Country")[0].focus();
		document.getElementsByName("Country")[0].style.border = "2px solid #ff0000";
		isOK = 0;
	} else {
		document.getElementsByName("Country")[0].style.border = "1px solid #cccccc";		    
	}	    

	if (document.getElementsByName("City")[0].value == "")    {
		document.getElementsByName("City")[0].select();
		document.getElementsByName("City")[0].focus();
		document.getElementsByName("City")[0].style.border = "2px solid #ff0000";
		isOK = 0;
	} else {
		document.getElementsByName("City")[0].style.border = "1px solid #cccccc";		    
	}	
	    
	if (document.getElementsByName("Sur_name")[0].value == "")    {
		document.getElementsByName("Sur_name")[0].select();
		document.getElementsByName("Sur_name")[0].focus();
		document.getElementsByName("Sur_name")[0].style.border = "2px solid #ff0000";
		isOK = 0;
	} else {
		document.getElementsByName("Sur_name")[0].style.border = "1px solid #cccccc";		    
	}

	if (document.getElementsByName("First_name")[0].value == "")    {
		document.getElementsByName("First_name")[0].select();
		document.getElementsByName("First_name")[0].focus();
		document.getElementsByName("First_name")[0].style.border = "2px solid #ff0000";
		isOK = 0;
	} else {
		document.getElementsByName("First_name")[0].style.border = "1px solid #cccccc";		    
	}


	if(isOK == 0) { 
		return false;
	} else {
		document.getElementById('myContactForm').submit();
	}	  	
}





