window.onload=function() {

	//Load cookie with previously set style (styleswitcher.js for functions)
  	var cookie = readCookie("style");
  	var title = cookie ? cookie : getPreferredStyleSheet();
  	setActiveStyleSheet(title);

	//Check that txtContent exists
	var oTextarea = document.getElementById( 'txtContent' ) ;
	var bFound = new Boolean(true);
	
	if ( !oTextarea )
		oTextarea = document.getElementsByName( 'txtContent' )[0] ;
		
	if ( !oTextarea || oTextarea.tagName != 'TEXTAREA' )
	{
		bFound = false;
	}

	if (bFound){
		var oEditor = new FCKeditor('txtContent', 600, 350, 'Basic', '');
		oEditor.BasePath = "/script/fck-2.2/";
		oEditor.ReplaceTextarea();
	}

	//Check that txtContent exists
	var oTextarea = document.getElementById( 'txtContent2' ) ;
	var bFound = new Boolean(true);
	
	if ( !oTextarea )
		oTextarea = document.getElementsByName( 'txtContent2' )[0] ;
		
	if ( !oTextarea || oTextarea.tagName != 'TEXTAREA' )
	{
		bFound = false;
	}

	if (bFound){
		var oEditor = new FCKeditor('txtContent2', 600, 200, 'Basic', '');
		oEditor.BasePath = "/script/fck-2.2/";
		oEditor.ReplaceTextarea();
	}

}

function checkRemoveDocument ( id ){
	
	if ( confirm ( 'Are you sure you want to remove this document?' ) == false )
		return;
	else
		document.location = '/admin/text.php?cmd=del&did=' + id;
	
}

function checkDeleteField ( id, key ){
	if ( confirm ( 'Are you sure you want to delete this field?' ) == false )
		return;
	else
		document.location = '/admin/text.php?cmd=form&sub=delfield&fid=' + id + '&key=' + key;

}
function doLocationSearch ( type_id, value ){

	if ( value != '' ){
		var sUrl = new String ( '/developments.php?loc=' + value + '&type=' + type_id );
		document.location = sUrl;
	}
}
