var vars = {
		phpDir:'get/',
		getter:'/format/xml',
		xmlDir:'',
		xmlFile:'project',
		location:this.location };

if( activation != false ) {
	vars['activation'] = activation;
} else {
	vars['activation'] = '';
}
if( finished != false ) {
	vars['finished'] = true;
} else {
	vars['finished'] = false;
}

var params = {
		bgcolor:'#000000',
		scale:'noScale',
		salign:'lt',
		menu:'true',
		allowScriptAccess: 'always' };

var attributes = { 
		id:'flashContainer', 
		name:'flashContainer' }; // give an id to the flash object

swfobject.embedSWF("swf/FactorInfinitum.swf", "flashContent", "100%", "100%", "9.0.0", "swf/expressInstall.swf", vars, params, attributes );
if( swfmacmousewheel ){ swfmacmousewheel.registerObject( attributes.id ) };

function createInstance( value ) {
	new AjaxUpload('#flashContainer', {
		  action: 'http://localhost/factorInfinitum/php-development/public/upload/',
		  name: 'Filedata',
		  data: { timestamp: value + "_estampa" },
		  autoSubmit: true,
		  responseType: false,
			  onSubmit : function(file , ext){
			  if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
				  // extension is not allowed
				  alert('Error: invalid file extension');
				  // cancel upload
				  return false;
			  }
		  },
		  onComplete: function(file, response) {
			  document.id('flashContainer').notify("UPLOAD_FINISHED");
		  }
	});
	activate( false );
}
var test = false;
function setTimestamp( value ) {
	if( this.test ) {
		//AjaxUpload.destroy();
	}
	this.test = true;
	createInstance( value );
}
function activate( value ) {
	if( value == true ) {
		document.id('selectfile').style.visibility = "visible";
	} else {
		document.id('selectfile').style.visibility = "hidden";
	}
}
function setFocus() {
	document.id('flashContainer').focus();
}
function setScroll( value ) {
	var className = 'flashNoScroll';
	var bodyClassName = 'hideScroll';
	
	switch( value ) {
		case "width":
			className = 'flashWidthScroll';
			bodyClassName = 'showScroll';
		break;
		case "height":
			className = 'flashHeightScroll';
			bodyClassName = 'showScroll';
		break;
		case "both":
			className = 'flashScroll';
			bodyClassName = 'showScroll';
		break;
	}
/*	document.body.className = bodyClassName;
	document.id('flashContainer').className = className;*/
}
var currheight;
window.onresize = function(){
	if(currheight != document.documentElement.clientHeight)
	{
		document.id('flashContainer').viewportResize( document.width, document.height );
	}
	currheight = document.documentElement.clientHeight;
}