// GALLERY
function changeImage(sTarget, sPath){
 	document.getElementById(sTarget).innerHTML = "<img src='" + sPath + "' />";
}

// REDIRECT
var sPath = window.location.pathname;

function redirectToIndex(){
	if(sPath=="" || sPath=="/" || sPath=="/index.php"){
		// do nothing
	}else{
		// redirect to index.php with the right anchor value for swfAddress
		if(FlashDetect.installed){
			if(sPath.charAt(sPath.length-1) == "/"){
				sPath = sPath.substr(0, sPath.length-1);
			}
			
			sHref= "/#";
			for(var i in aCategories){
				if(sPath.split("/")[1] == i){
					sHref += "/categorie";
					break;
				}
			}
			window.location.href = sHref + sPath;
		}
	}
}

// MINSIZE FOR IE
var defaultMinWidth = 996;
var defaultMinHeight = 550;
var currentMinWidth = defaultMinWidth;
var currentMinHeight = defaultMinHeight;

function checkWindowSize(){
	
	var currentWidth = 0;
	var currentHeight = 0;
	var divFlashContent = document.getElementById("flashcontent");
	
	if (window.innerWidth){
		currentWidth = window.innerWidth;
		currentHeight = window.innerHeight;
	}
	else if (document.body && document.body.offsetWidth){
		currentWidth = document.body.offsetWidth;
		currentHeight = document.body.offsetHeight;
	}
	
	if(currentWidth < currentMinWidth){
		divFlashContent.style.width = currentMinWidth + "px";
	}else{
		divFlashContent.style.width = "100%";
	}
	
	if(currentHeight < currentMinHeight){
		divFlashContent.style.height = currentMinHeight + "px";
	}else{
		divFlashContent.style.height = "100%";
	}
}

function changeMinWidth(newMinWidth){
	currentMinWidth = newMinWidth ? newMinWidth : defaultMinWidth;
	checkWindowSize();
}
function changeMinHeight(newMinHeight){
	currentMinHeight = newMinHeight ? newMinHeight : defaultMinHeight;
	checkWindowSize();
}

window.onresize = checkWindowSize;

