function setScroll()
{
	try
	{
		frameCheck();

		var spacerDiv = findObjectInParent('spacediv');
			
		var frameheight = document.body.scrollHeight;
		frameheight += 115;
		
		spacerDiv.style.height = frameheight + 'px';
		
		window.top.frames['contentFrame'].scrollTo(0,0);
	}
	catch(e)
	{
		var source = findoutSource();
		var newLoc = 'http://www.fleurenhorecamakelaars.nl/';
		if (source != '')
			newLoc = newLoc + '' + source;

		window.open(newLoc,'_top');
		return false;
	}
}

function calculateScroller()
{
	try
	{
		frameCheck();

		var spacerDiv = findObjectInParent('spacediv');
			
		var frameheight = document.body.scrollHeight;
		frameheight += 115;
		
		spacerDiv.style.height = frameheight + 'px';
	}
	catch(e)
	{
		var source = findoutSource();
		var newLoc = 'http://www.fleurenhorecamakelaars.nl/';
		if (source != '')
			newLoc = newLoc + '' + source;

		window.open(newLoc,'_top');
		return false;
	}
}

function resetScroller()
{
	try
	{
		var spacerDiv = findObjectInParent('spacediv');
		spacerDiv.style.height = '1px';
	}
	catch(e)
	{
	}
}


function frameCheck()
{
	if (window.parent.frames.length != 1)
	{
		var source = findoutSource();
		var newLoc = 'http://www.fleurenhorecamakelaars.nl';
		if (source != '')
			newLoc = newLoc + '' + source;
		
		window.open(newLoc,'_top');
		return false;
	}
	
	
	if (window.parent.document.location.href.replace(window.parent.document.location.search,"") != 'http://www.fleurenhorecamakelaars.nl/main.php')
	{	
		window.open('http://www.fleurenhorecamakelaars.nl/','_top');
		return false;
	}
	
	return true;
}


function findoutSource()
{
	try
	{
		var qs = document.location.search;
		var myLoc = document.location.href;		
		var newLoc = myLoc.replace(qs,'');
		newLoc = newLoc.replace('.php','');
		
		var locAry = newLoc.split('/');
		newLoc = locAry[locAry.length-1];
		
		var myQs = qs.replace('id',newLoc);
		return myQs;
	}
	catch(e)
	{
		return '';
	}
	
	
	
}


function findObjectInParent(objectId)
{
    if(window.parent.document.getElementById && window.parent.document.getElementById(objectId))
		return window.parent.document.getElementById(objectId);
    else if (window.parent.document.all && window.parent.document.all(objectId))
		return window.parent.document.all(objectId);
    else if (window.parent.document.layers && window.parent.document.layers[objectId])
		return window.parent.document.layers[objectId];
    else
		return false;
}

function findObject(objectId)
{
    if(document.getElementById && document.getElementById(objectId))
		return document.getElementById(objectId);
    else if (document.all && document.all(objectId))
		return document.all(objectId);
    else if (document.layers && document.layers[objectId])
		return document.layers[objectId];
    else
		return false;
}

function selectSub(sub)
{
	if (selectedSub != null)
	{
		var oldsubItem = findObject('sub'+selectedSub);
		var oldsubLink = findObject('sublink'+selectedSub);
		
		oldsubItem.innerHTML = '&nbsp;';
		oldsubLink.className = 'submenulink';
	}
	
	var subItem = findObject('sub'+sub);
	var subLink = findObject('sublink'+sub);
	
	subItem.innerHTML = '<img src="imgs/indicator.gif">';	
	subLink.className = 'submenulinkselect';
	
	selectedSub = sub;
	window.top.frames['contentFrame'].scrollTo(0,0);
}


function pageOptions(type, info, id)
{
	if (type == "print")
		window.print();
	else if (type == "bookmark")
		window.external.AddFavorite('http://www.fleurenhorecamakelaars.nl/?company=' + id,info)
	else if (type == "bookmarkbab")
		window.external.AddFavorite('http://www.fleurenhorecamakelaars.nl/?bab=' + id,info)
	else if (type == "reageer")
		window.open('/form.php?id=9&sitedata=' + info,"_self");
}



function openPage(url)
{
	window.open(url,'_self');
	window.top.frames['contentFrame'].scrollTo(0,0);
}


function showLargePicture(url, width, height)
{

	if (url == '' || width == '' || height == '')
	{
		alert('Geen extra foto beschikbaar');
		return false;
	}
	LeftPosition=(screen.width)?(screen.width-width)/2:100;
	TopPosition=(screen.height)?(screen.height-height)/2:100;
	settings='width='+width+',height='+height+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	window.open('images.php?image='+url,'foto'+width+height,settings);

}

function showCompanyVideo(video)
{
	if (video == '')
	{
		alert('Geen video beschikbaar');
		return false;
	}
	var width = 935;
	var height = 630;
	
	LeftPosition=(screen.width)?(screen.width-width)/2:100;
	TopPosition=(screen.height)?(screen.height-height)/2:100;
	settings='width='+width+',height='+height+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	window.open('video/?id=' + video,'video'+width+height,settings);
}
