// AJAX CALLS
function do_ajax_HTML(options) {
	// options.method='get';
	// options.complete=do_onComplete;
	if (options['cache']!=true) {
		var i=options['url'].indexOf('?',0)+options['url'].indexOf('&',0); // komt er een & of ? voor?
		if (i>-2){
			options['url']=options['url']+'&';
		} else options['url']=options['url']+'?';
		options['url']=options['url']+'randcachevar='+(new Date()).getTime();
		options.url
	}
	var myHTMLRequest = new Request.HTML(options);
	myHTMLRequest.setHeader('X-Request','text/xhtml');
	myHTMLRequest.get();
}

function do_ajax_HTML_post(options,formID) {
	var myHTMLRequest = new Request.HTML(options);
	myHTMLRequest.post($(formID));
}



function simulation(url) {
	newwindow=window.open(url,'Simulation','height=690,width=920');
	if (window.focus) {newwindow.focus()}

}

function demo(url) {
	newwindow=window.open(url,'Demo','height=510,width=900');
	if (window.focus) {newwindow.focus()}

}



window.addEvent("domready", function(){
	/* Set Global Styles */
	var thetimeout=null;
	var theopenedslide=null;

	try {


		$$('.slide').each(function(item){
			item.addEvents({
				'mouseenter': function(){
				//	alert('test');
					clearTimeout(thetimeout);

				},
				'mouseleave': function(el){
//					var theslide=$('slide'+item.get('rel'));
					thetimeout=setTimeout(function() {

						theopenedslide.tween('top','-120px');
					},1500);

				}
			});
		});


		$$('.trigger-slide').each(function(item){
			item.addEvents({
				'mouseenter': function(){

					if (theopenedslide!=null)
					{
						theopenedslide.tween('top','-120px');
					}
					if (thetimeout!=null)
					{
						clearTimeout(thetimeout);
						thetimeout=null;
					}
					theopenedslide=$('slide'+item.get('rel'));
					theopenedslide.tween('top','45px');
				},
				'mouseleave': function(el){
					var theslide=$('slide'+item.get('rel'));

					thetimeout=setTimeout(function() {

						theslide.tween('top','-120px');
					},1500);

				}
			});
		});
	}
	catch (err) {
	}



	try {
		$$('.fMI').each(function(item){
			item.addEvents({
				'click': function(){
					$$('.fMITC').tween('height','0px')
					$('fMITC'+item.get('rel')).tween('height',$('fMIT'+item.get('rel')).getStyle('height'));
				}
			});
		});
	}
	catch (err) {
	}




	try {
	$$('.accTrigger').each(function(item){
		item.addEvents({
			'click': function(){
			if($('accContainer'+item.get('rel')).getStyle('height')!='0px') {
			$$('.accContainer').tween('height','0px');

			} else {
			$$('.accContainer').tween('height','0px');
			$('accContainer'+item.get('rel')).tween('height',$('accText'+item.get('rel')).getStyle('height'));
			}
			}
			});
		});
	}
	catch (err) {}

});



