var currentClass;
var currentButtonClass;
var currentTarget='_self';
var currentWindowPopup;
var currentFormPopup;

function redirectPageHome() {
   	window.location = "/index.html";
}
function redirectPageLogin() {
   	window.location = "/administration/login.faces";
}
function submitPageLink(index) {
	return oamSubmitForm('currentPage:page','currentPage:page:tables:'+index+':tablesLink');
}
function removePageLink(index) {
	return oamSubmitForm('currentPage:page','currentPage:page:tablesSelected:'+index+':tablesLink');	
}
function submitInnerLink(link) {	
	return oamSubmitForm('currentPage:page','currentPage:page:'+link);	
}
function submitFormPageLink(table,tablesLink, index) {	
	return oamSubmitForm('currentPage:page','currentPage:page:'+table+':'+index+':'+tablesLink);
}
function submitFormTextField(submitButton) {
	if (event.keyCode == 13){
		document.getElementById('currentPage:page:'+submitButton).click();
		return false;
	}
	return true;
}
function submitIntroductionLink() {
	clear_page();
	document.forms['page'].elements['page:_link_hidden_'].value='page:introductionLink';
	if(document.forms['page'].onsubmit){
		var result=document.forms['page'].onsubmit();
		if( (typeof result == 'undefined') || result ) {
			document.forms['page'].submit();
		}
	}else{
		document.forms['page'].submit();
	}
	return false;	
}
function submitMenuCategory(link) {
	return oamSubmitForm('menu:menuForm','menu:menuForm:'+link+'Link');
}
function changeFormTargetFromButton () {
	document.forms['currentPage:page'].target=currentTarget;
	
}

function changeFormActionFromButton(action) {
	document.forms['currentPage:page'].action=action;
	return true;
}
function changeFormTargetFromButtonAndReset() {
	changeFormTargetFromButton();
	currentTarget='_self';	
}

function changeFormTarget(dest) {
	currentTarget=dest;
}
function mouseOverRowsClass(currentElement, currentStyle) {
	currentClass = currentStyle;
	changeClass(currentElement, currentClass);
}
function mouseOutRowsClass(currentElement) {
	changeClass(currentElement, currentClass);
}
function buttonMouseOver(currentElement) {
	changeClass(currentElement, 'buttonMouseOver');
}
function buttonMouseOut (currentElement) {
	changeClass(currentElement, 'buttonMouseOut');
}

function changeImageSource(selectedImage) {
	var currentSrc=selectedImage.src;
	var pictureZoom = getElementFactory("announcePictureZoom");
	var oldSrc=pictureZoom.src;
	selectedImage.src=oldSrc;
	pictureZoom.src=currentSrc;
}
//formName represents the hidden form id
//target represents the other window name
function showWindowPopup(height, width, formName, target, action, currentValue) {
	window.open("/administration/protected/searchZipCode.faces","fenetre1","width=310,height=400,left=0,top=0");
	/*
	currentFormPopup = action.form.id;
	var currentForm = document.forms[formName];
	currentForm[formName+':'+target].value=formName+':'+target;
	currentForm[form+":currentValue"].value = currentValue;
	currentForm.submit();*/
}
function updateCurrentValue(currentValue) {
	currentWindowPopup.close();
}
function activFlash() {
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}