//////////////////////////////////////////////////////////////////////////////////////
// Deze js wordt gebruikt voor scripts die voor beide roottemplates gebruikt worden //
//////////////////////////////////////////////////////////////////////////////////////



function hideContBlocks() {
	// Wide
	divwide = $$('div.wide');
	divwide.each(function(obj) {
		if(obj.innerHTML == '')	{
			obj.hide();
		}
	});
	
	// Left Right
	divleftright = $$('div.left_right');
	divleftright.each(function(obj) {
		left = obj.down(0);
		right = obj.down(0).next(0);
		if(left.innerHTML == '' && right.innerHTML == '')	{
			obj.hide();
		}
	});
}



function changeBow(action) {
if($('menu_top_bow').className == 'menu_top_bow_true') {
	}else{
		if(action == true) {
			$('menu_top_bow').className='menu_top_bow_hover';
		}else{
			$('menu_top_bow').className='menu_top_bow_false';
		}
	}
}


function lightview() {
	sPath = PGX.Prefix + PGX.Path.replace(' ','%20');
	if (location.href.replace(sPath, '').empty() || location.href.replace(sPath, '') == '/' ) {
		Lightview.show({
			href: PGX.Path + '/lightview.html?step=1',
			rel: 'iframe', 
			options: {
				topclose: true,
				width: 627,
				height: 474,
				scrolling: false
			}
		});
	}
}

document.observe("dom:loaded", function() {
	// Hide niet gevulde contentblokken
	hideContBlocks();
	
	lightview.delay(0.5);
});

function changeExternalLinks(){	
	//Externe links openen in lightview
	links = $$('a');
	links.each(function(obj) {
		
		aExternal.each(function(external) {
			if (obj.href.indexOf(external) != -1 && obj.href.indexOf('@') == -1) {	
				obj.onclick = function() {
					Lightview.show({ href: obj.href, title: obj.href, rel: 'iframe', options: { fullscreen:true }});
					
					return false;
				}
			}
		});
	});
}
swfobject.addDomLoadEvent(changeExternalLinks);

document.observe('lightview:opened', function(event) {
	elms = $$('div.lv_Title');
	elm = elms[0];
	elm = $(elm).up(1);
	if ($(elm).down(0).next(1)) {
		$(elm).down(0).next(1).remove();
	}
	width = $(elm).getWidth(); 
	width = (width - 325);
	html = '<div id="lv_Custom" style="position:absolute; width:390px; left:' + width + 'px; float:right; display:block; padding-top:3px; cursor:pointer;" onclick="Lightview.hide();">Klik hier om terug te gaan naar de Ricoh Document Center website</div>';
	$(elm).insert(html);
} );


function ytLightview(video) {
	Lightview.show({
  	href: video,
  	rel: 'flash'
	});
}

function showDD(element) {
	$(element).down(0).next(0).show();
}

function hideDD(element) {
	$(element).down(0).next(0).hide();
}

function changeDDValue(element) {
	$('ddvalue').innerHTML = $(element).innerHTML;
	$('dd_catpop').hide();
}