function showInlog(){
		new Ajax.Updater('cms_middle_sizeable','dynamic_items/login', { asynchronous:true, evalScripts:true});	
		openDynamicText();
	
}
function markEditables() {
	$$('.editable').each(function(obj) {
		obj.remove();
	});
	/* first scrolling to the top is nessecary */
	myScrollTo(document.body, 0);
	if(/MSIE/.test(navigator.userAgent) && !window.opera) myScrollTo('content', 0);
	
	$$('.dynamic').each(function(obj) {
		createClone(obj);
	});
}

function createClone(element) {
	var el = document.createElement('div');
	Position.clone(element, el);
	Element.addClassName(el, 'editable');
	el.id = element.id + "_clone";
	document.body.appendChild(el);
	Event.observe(el, 'click', function(event) { 
		
		// new Ajax.Updater('cms_middle_sizeable','dynamic_items/edit/'+element.id+'/', { asynchronous:true, evalScripts:true});	
		// Shadowbox.open({ 
		//                                 content:   '/dynamic_items/'+element.id+'/edit', 
		//                                 title:      "Tekst aanpassen",
		// 															player: "iframe",
		// 															options :   {
		// 																height:700,
		// 																width:700  
		// 															}
		//                      });
		    Shadowbox.open({
		        content:    '/dynamic_items/'+element.id.split("_")[1]+'/edit',
		        player:     "iframe",
		        title:      "Tekst aanpassen",
		        height:     600,
		        width:      500
		    });

		
		
	});
}

/* scrolls absolute everything you want */
function myScrollTo(container, y) {
	if (container == document.body) {
		window.scrollTo(0, y);
	} else {
		var container = $(container); 
		container.scrollTop= y-(document.all?0:container.offsetTop);
	}
}


function unMarkEditables() {
	$$('.editable').each(function(obj) {
		obj.remove();
	});
}

function openDynamicText(){
	Effect.BlindRight($('cms_top_center_sizeable'));
	Effect.BlindRight($('cms_middle_sizeable'));
	$('cms_top_right').style.backgroundImage = 'url(/images/dol_cms/cms_top_right_sizeable.png)';
	unMarkEditables();
	$('cms_top_center_sizeable').style.width ='620px';
	$('cms_middle_sizeable').style.width ='600px';	
	$('cms_top').style.width ='740px';
	$('cms_container').style.width ='750px';
}
function closeDynamicText(){
	Effect.BlindLeft($('cms_top_center_sizeable'));
	Effect.BlindLeft($('cms_middle_sizeable'));
	$('cms_top_center_sizeable').style.width ='10px';
	$('cms_top').style.width ='120px';
	$('cms_container').style.width ='120px';
	$('cms_middle_sizeable').style.width ='10px';
	$('cms_top_right').style.backgroundImage = 'url(/images/dol_cms/cms_top_right.png)';
	
}

function openModel(element){
	unMarkEditables();
	Effect.BlindRight($('cms_top_center_sizeable'));
	Effect.BlindRight($('cms_middle_sizeable'));
	$('cms_top_center_sizeable').style.width ='620px';
	$('cms_middle_sizeable').style.width ='600px';	
	$('cms_top').style.width ='740px';
	$('cms_container').style.width ='750px';	$('cms_top_right').style.backgroundImage = 'url(/images/dol_cms/cms_top_right_sizeable.png)';
	new Ajax.Updater('cms_middle_sizeable',''+element.id+'/index', { asynchronous:true, evalScripts:true});		
}
