<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 124;
// -----------------------------------------------------------------------------
// -->

//	----------------
//	Width and Height for SwfObject
//	----------------

function getWidth () {
	if (typeof( window.innerWidth) == 'number') {
		//Non-IE
		myWidth = window.innerWidth;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}

function getHeight () {
	if (typeof( window.innerWidth) == 'number') {
		//Non-IE
		myHeight = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

//	----------------
//	Set focus on SWF
//	----------------

function setFocus() {
	document.getElementById('Fertilizer2010').focus();
}

function setTitle(newTitle) {
	document.title = newTitle;
}


function loadPopup(url, width, height) {
	if (width == 'undefined') width = 750;
	if (height == 'undefined') height = 500;
	var left = (screen.width  - width) / 2 ;
	var top  = (screen.height - height) / 2 ;
	settings = "toolbar=no,status=no,resizable=no";
	//if (scrollbars) {
		settings += ",scrollbars=yes";
	//} else {
	//	settings += ",scrollbars=no";
	//}
	settings += ",width=" + width;
	settings += ",height=" + height;
	settings += ",left=" + left;
	settings += ",top=" + top;
	var popup_window = window.open(url, 'Fertilizer2010', settings );
	if (!popup_window) {
		showPopupAlert();
	}
}

function loadImageBrowser(variables) {
	var url = '../htmlComponents/FCKeditor2010/image_browser/popup.php' + variables;
	var width = 800;
	var height = 500;
	var left = (screen.width  - width) / 2 ;
	var top  = (screen.height - height) / 2 ;
	settings = "toolbar=no,status=no,resizable=no";
	//if (scrollbars) {
		settings += ",scrollbars=yes";
	//} else {
	//	settings += ",scrollbars=no";
	//}
	settings += ",width=" + width;
	settings += ",height=" + height;
	settings += ",left=" + left;
	settings += ",top=" + top;
	var popup_window = window.open(url, 'Fertilizer2010', settings );
	if (!popup_window) {
		showPopupAlert();
	}
}


var editorContent;
var newwindow = '';
function loadEditor(variables, value) {
	var url = '../htmlComponents/FCKeditor2010/popup.php' + variables;
	editorContent = value;
	//var width = screen.width * 0.75;
	//var height = screen.height * 0.75;
	var width = 800;
	var height = 500;
	var left = (screen.width  - width) / 2 ;
	var top  = (screen.height - height) / 2 ;
	settings = '';
	settings += 'toolbar=no';
	settings += ',location=yes';
	settings += ',status=no';
	settings += ',resizable=no';
	settings += ',width=' + width;
	settings += ',height=' + height;
	settings += ',left=' + left;
	settings += ',top=' + top;
	newwindow = window.open(url,'Fertilizer2010',settings);
	if (newwindow) {
		if (window.focus) {
			newwindow.focus();
		}
	} else {
		showPopupAlert();
	}
	return false;
}

function showPopupAlert() {
	alert("Het is niet gelukt een popup te openen. Pas de instellingen van uw pop-up blocker aan.");
}

function addMapLocation(x, y, zoom, functionCode) {
	var functionString = 'flexApp.addMapLocation'+ functionCode +'(x, y, zoom)';
	var flexApp = getFlexApp('Fertilizer2010');
	eval(functionString);
}

function removeMapLocation(x, y, functionCode) {
	var functionString = 'flexApp.removeMapLocation'+ functionCode +'(x, y)';
	var flexApp = getFlexApp('Fertilizer2010');
	eval(functionString);
}

function removeAllMapLocations(functionCode) {
	var functionString = 'flexApp.removeAllMapLocations'+ functionCode +'()';
	var flexApp = getFlexApp('Fertilizer2010');
	eval(functionString);
}

function setFlexUrl (url, functionCode) {
	var functionString = 'flexApp.setFlexUrl'+ functionCode +'(url)';
	var flexApp = getFlexApp('Fertilizer2010');
	eval(functionString);
}

function getFlexApp(appName) {
	if (navigator.appName.indexOf ("Microsoft") !=-1) {
		return window[appName];
	} else {
		return document[appName];
	}
}

function setItemProperty(functionCode, value) {
	var flexApp = getFlexApp('Fertilizer2010');
	var functionString = 'flexApp.setItemProperty'+ functionCode +'(value)';
	eval(functionString);
}

//	----------------
//	Google Analytics
//	----------------

function openGoogleAnalytics () {
	var width = 900;
	var height = 800;
	var left = (screen.width  - width) / 2 ;
	var top  = (screen.height - height) / 2 ;
	settings = "toolbar=no,status=no,scrollbars=yes,resizable=yes";
	settings += ",width=" + width;
	settings += ",height=" + height;
	settings += ",left=" + left;
	settings += ",top=" + top;
	newwindow = window.open('http://www.google.com/analytics/', 'Fertilizer2010', settings);
	if (newwindow) {
		if (window.focus) {
			newwindow.focus();
		}
	} else {
		showPopupAlert();
	}
}

//	----------------
//	Close confirm functions
//	----------------
/*
var checkClose = false;

function setCheckClose(bool) {
	checkClose = bool;
}

function confirmExit() {
	if (checkClose) {
		return "Weet u zeker dat u de Fertilizer wilt verlaten?";
	}
}

window.onbeforeunload = confirmExit;
*/
