// JavaScript Document

//alle scripts voor de website

///////////////////////////////////////////////////////
////                                               ////
////           doorverwijzen vanuit form           ////
////                                               ////
///////////////////////////////////////////////////////

function verwijzen( object )
{
	window.location = object.options[object.selectedIndex].value;
}

///////////////////////////////////////////////////////
////                                               ////
////           alle checkboxes selecteren          ////
////                                               ////
///////////////////////////////////////////////////////

function check_alle_checkbox( element ) 
{
	var formulier = element.form;
	 
	for( i = 0; i < formulier.length; i++ )
	{
		if( formulier[i].type == 'checkbox' && formulier[i].name != 'hoofdbox' )
		{
			formulier[i].checked = element.checked;
		}
	}
}

///////////////////////////////////////////////////////
////                                               ////
////        smilie toevoegen aan textarea          ////
////                                               ////
///////////////////////////////////////////////////////

function smilie( veld, smile )
{
	if( document.selection )
  	{
		veld.focus();
		var selection = document.selection.createRange();
		selection.text = smile;
  	}
  	else if( veld.selectionStart || veld.selectionStart == '0' )
  	{
		var startPos = veld.selectionStart;
		var endPos = veld.selectionEnd;
 
		veld.value = veld.value.substring( 0, startPos )
		+ smile + veld.value.substring( endPos, veld.value.length );
  	}
  	else
  	{
		veld.value += smile;
  	}
}

///////////////////////////////////////////////////////
////                                               ////
////        BB-code toevoegen aan textarea         ////
////                                               ////
///////////////////////////////////////////////////////
 
function tag( veld, tag1, tag2 )
{
	//als tag2 niet opgegeven is wil dit zeggen dat ze dezelfde naam hebben
	//bijvoorbeeld [b] en [/b], [url=] en [/url] hebben dan weer niet dezelfde naam
	if( !tag2 )
	{
		tag2 = tag1;
	}
 
	if( document.selection )
	{
		veld.focus();
		var selection = document.selection.createRange();
 
		if( selection.text )
		{	
			selection.text = "["+tag1+"]"+selection.text+"[/"+tag2+"]";
		}
		else
		{
			veld.value += "["+tag1+"][/"+tag2+"]";
		}
	}
	else if( veld.selectionStart || veld.selectionStart == '0' )
	{
		var startPos = veld.selectionStart;
		var endPos = veld.selectionEnd;
 
		if( startPos != endPos )
		{
			veld.value = veld.value.substring( 0, startPos )
			+ "["+tag1+"]"
      			+ veld.value.substring( startPos, endPos )
			+ "[/"+tag2+"]"
			+ veld.value.substring( endPos, veld.value.length );
		}
		else
		{
			veld.value = veld.value.substring( 0, startPos )
			+ "["+tag1+"][/"+tag2+"]"
			+ veld.value.substring( endPos, veld.value.length );
		}
	}
}

///////////////////////////////////////////////////////
////                                               ////
////        Instellingen voor highslide            ////
////                                               ////
///////////////////////////////////////////////////////

hs.graphicsDir = '../afbeeldingen/highslide/';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'glossy-dark';
hs.wrapperClassName = 'dark';
hs.fadeInOut = true;
hs.dimmingOpacity = 0.5;

// Add the controlbar
if (hs.addSlideshow) hs.addSlideshow({
	//slideshowGroup: 'group1',
	interval: 5000,
	repeat: false,
	useControls: true,
	fixedControls: 'fit',
	overlayOptions: {
		opacity: .6,
		position: 'bottom center',
		hideOnMouseOut: true
	}
});
