 
// FLEXITRON MICROSITE MOO1.11


// START WINDOW ONLOAD CONTENT
	
window.onload=function(){


// ASSETS LOADER

shadowblock = document.getElementsByClassName('shadow');
	shadowblock.each(function(el){
	el.style.opacity = '0';
	});


var busy = false, timer, loadedImages = [], shadow = $('shadow'), progress = $('progress'), bar = $E('#progress .bar'); 

var images = [ '../images/system/prev_hover.png','../images/system/thumbs_mask.gif','../images/system/3.jpg','../images/system/brochure3.jpg','../images/system/thumb_invisible.gif','../images/system/brochure7.jpg','../images/system/brochure8.jpg','../images/system/brochure6.jpg','../images/system/swoosh_big.jpg','../images/system/mid.gif','../images/system/ajax-loader.gif','../images/system/download.png','../images/system/next_hover.png','../images/system/brochure10.jpg','../images/system/back.gif','../images/system/swoosh_home.jpg','../images/system/brochure2.jpg','../images/system/numberstalkbutton.png','../images/system/rightbutton.gif','../images/system/brochure1.jpg','../images/system/next.png','../images/system/logo.gif','../images/system/ajax-loader_.gif','../images/system/brochure11.jpg','../images/system/4t.jpg','../images/system/close_hover.png','../images/system/x.gif','../images/system/brochure5.jpg','../images/system/brochure9.jpg','../images/system/4.jpg','../images/system/bottom.gif','../images/system/3t.jpg','../images/system/prev.png','../images/system/activebg.gif','../images/system/leftbutton.gif','../images/system/brochure4.jpg','../images/system/close.png','../images/system/x.gif' ];

function imageloader() {

		progress.setStyle('visibility', 'visible');
		new Asset.images(images, {
			onProgress: function(i) {

loadedImages[i] = this;
				var percent = ((i + 1) * progress.getStyle('width').toInt()) / images.length;
				bar.setStyle('width', percent);

			},
			onComplete: function() {
		
	progress.setStyle('display', 'none');
	
	var shadowfade = function(){
	
	var div = $('shadow').setStyles({
	display:'block',
	opacity: 0
	});
	
	new Fx.Style(div, 'opacity', {duration: 1500} ).start(1);
	
	}
	
	shadowfade();
	}
	
	});
	};

imageloader();


$$('#shadow #container #topmenu a').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
        color: '#333'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#6f6f6f'
    });
  });
});
$$('#shadow #container #topmenu a.active').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
        color: '#333'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#333'
    });
  });
});
				
$$('#shadow #container #content div.midhome a, #shadow #container #content div.midnumbers a, #shadow #container #content div.midaboutus a').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
          color: '#046738'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#bed638'
    });
  });
});
$$('#shadow #container #content div.midproduct a, #shadow #container #content div.midcontact a').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
        color: '#046738'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#fff'
    });
  });
});
$$('#shadow #footer div.footleft a').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
        color: '#85beda'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#666'
    });
  });
});
$$('#shadow #footer div.footright a').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
        color: '#85beda'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#11648b'
    });
  });
});


var rightfader = $$('.frontimg').setStyles({
	opacity: 0.4
	});
rightfader.each(function(element) {
 
	var fx = new Fx.Styles(element, {duration:300, wait:false});
 
	element.addEvent('mouseenter', function(){
		fx.start({
	
			opacity: '1'
		});
	});
 
	element.addEvent('mouseleave', function(){
		fx.start({
		
			opacity: '0.4'
		});
	});

 
});



//END HOVER FX



//LOAD HOME PAGE

if (document.referrer.indexOf('http://www.flexitron.amsterdamfiles.com') > -1){

var ref = document.referrer;

getstuff(ref,'content');

} else {

getstuff('../home/','content');

};



//START NESTED AJAX STUFF

}
function getstuff(url, div){

	var fadefx = new Fx.Styles(div, {wait: true, duration: 500, transition: Fx.Transitions.Back.easeInOut});
	fadefx.start({ 'opacity': [1, 0]});
    
	
//START AJAX INSIDE

function onrequesting() {
$('feedbackloader').setHTML('<div class="loading"><p class="loadingtxt"><img src="../images/system/ajax-loader.gif" alt="loading" /></p></div>');
}

function onfailing() {
$('feedbackloader').setHTML('<div class="loading"><p class="loadingtxt">Error - database unavailable!</p></div>');
}

function oncancelling() {
$('feedbackloader').setHTML('<div class="loading"><p class="loadingtxt">Request was cancelled by user</p></div>');
}

function displaypage() {

$('feedbackloader').setHTML('<div class="loading"></div>');

var fadefx = new Fx.Styles(div, {wait: false, duration: 1500, transition:Fx.Transitions.Back.easeInOut});

fadefx.start({ 'opacity': [0, 1]});


	
//START HOVER FX.



$$('#shadow #container #topmenu a').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
        color: '#333'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#6f6f6f'
    });
  });
});
$$('#shadow #container #topmenu a.active').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
        color: '#333'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#333'
    });
  });
});

$$('#shadow #container #content div.midhome a, #shadow #container #content div.midnumbers a, #shadow #container #content div.midaboutus a').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
          color: '#046738'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#bed638'
    });
  });
});
$$('#shadow #container #content div.midproduct a, #shadow #container #content div.midcontact a').each(function(el) {
  var menucolors = new Fx.Styles(el, {duration:200, transition: Fx.Transitions.Sine.easeIn, wait:false});

  el.addEvent('mouseenter', function(){
    menucolors.start({
        color: '#046738'
    });
  });
  el.addEvent('mouseleave', function(){
    menucolors.start({
        color: '#fff'
    });
  });
});

var tips = new Tips($$('.tips'), {

maxTitleChars: 60,
fixed: true,

	initialize:function(){
		this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
	},
	onShow: function(toolTip) {
		this.fx.start(1);
	},
	onHide: function(toolTip) {
		this.fx.start(0);
	}


});
// start loading external js for loaded html from section template

new Asset.javascript('../js/slide.js');
new Asset.javascript('../js/mediabox.js');
new Asset.javascript('../js/swfobject.js');
new Asset.javascript('../js/slimbox_vixed.js');
		

$$('#contentloader').each(function(el) {
	})	
	loader = document.getElementsByClassName('contentloader');		
	loader.each(function(el){
	el.style.display = 'block';
	}	
	);
	
$$('#entryloader').each(function(el) { 
	})	
	loaderblok = document.getElementsByClassName('entryloader');	
	loaderblok.each(function(el){
	el.style.display = 'none';
	}
	);


	}
	//end oncomplete routine
    
	
(function(){	

	var ajax = new Ajax(url, {

	onRequest: onrequesting,
	
	onFailure: onfailing,
	
	onComplete:displaypage,
	
		onCancel: oncancelling,
    
	method:'get', 
	evalScripts: true,
 // evalResponse: false,
	update:div
	}).request();
	}).delay(500);
	
	
// CLOSING WINDOW ONLOAD	
	};
	
	
//MEDIAPLAYERS CLOSE ON END OF MEDIAFILE

var currentState;

//INLINE PLAYER

function getUpdate(typ,pr1,pr2,pid) {
		

//CLOSE MEDIABOX OVERLAY
		
	if(pid != "null") {
if((typ == "state")&&(pr1 != undefined)) { 
	currentState = pr1; 
	if(currentState=="3") { document.location.href="javascript:parent.Mediabox.close(0);history.stop"; }
}
}
		
	};

// END OF FILE. and a moo moo here and a moo moo there
