<!-- 
/***************************************************************
* PHP2B.COM Copyright 1999 
* .htaccess file generation script 
* Feel free to borrow and modify this javascript, you don't
* have to leave this credit in the source ;-) 
* http://www.php2b.com/
***************************************************************/

function make_404() {
	var e = document.htaccess_wizard.error404.value
	if (e.length<5){
		alert("Please enter the path to your custom error page");
		document.htaccess_wizard.error404.focus();
		return false
	}
	document.htaccess_wizard.htaccess_result.value += 'ErrorDocument 404 '+e+'\n';
	return true;
}

function make_hotlink(){
	if (document.htaccess_wizard.serverUrl.value.length < 2){
		alert("Please fill out the server url");
		document.htaccess_wizard.serverUrl.focus();
		return false
        }
        var hl = "RewriteEngine on\nRewriteCond %{HTTP_REFERER} !^http://"+document.htaccess_wizard.serverUrl.value+"\nRewriteCond %{HTTP_REFERER} !^http://www."+document.htaccess_wizard.serverUrl.value+"\nRewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www."+document.htaccess_wizard.serverUrl.value+"/empty.html [L]\n#"+document.htaccess_wizard.serverUrl.value+"/empty.html - your custom hotlinker page\n\n";
        document.htaccess_wizard.htaccess_result.value += hl;
        return true;
}

function make_different_index() {
	var f = document.htaccess_wizard.different_index_name.value
	if (f.length<5){
		alert("Please enter the filename");
		document.htaccess_wizard.different_index_name.focus();
		return false;
	}
	document.htaccess_wizard.htaccess_result.value += ('DirectoryIndex '+f+'\n')
	return true
}

function make_htaccess_file() {
	var p = document.htaccess_wizard.pass_path.value;
	var d = document.htaccess_wizard.pass_dialog.value;

	if (p == ''){
		alert("Please enter the Server Path to the password file");
		document.htaccess_wizard.pass_path.focus();
		return false;
        }

	if (d == ''){
		alert("Please enter the text you would like for the\nUsername and Password dialog box");
		document.htaccess_wizard.pass_dialog.focus();
		return false;
        } else {
        	document.htaccess_wizard.htaccess_result.value += ('AuthUserFile '+p+'.htpasswd\n "'+d+'"\nAuthType Basic\nrequire valid-user\n')
        }
	return true;
}

function make_cache_control(){
	var e_on = 'ExpiresActive on';
	var e_dt = 'ExpiresDefault ';
	var AccessMod = document.htaccess_wizard.cache_type.options[document.htaccess_wizard.cache_type.selectedIndex].value;
	var time = document.htaccess_wizard.cache_time.options[document.htaccess_wizard.cache_time.selectedIndex].value;
	document.htaccess_wizard.htaccess_result.value += e_on+'\n'+e_dt+''+AccessMod+''+time+'\n';
}

function select_all(){
	var h = document.htaccess_wizard.htaccess_result;
	if (h.value.length<5){
		alert('You need enter something in before you try to create the .htaccess');
		return false;
        }
	h.focus();
	h.select();
	return false;
}

function check_password_wizard_form(){
	var a = document.password_form.htuser;
	var b = document.password_form.htpassword;
	var c = document.password_form.chtpassword;
	if(a.value == ''){
		alert('Please enter the username!'); a.focus(); return false;
	}
	if(b.value == ''){
		alert('Please enter the password!'); b.focus(); return false;
	}
	if(c.value == ''){
		alert('Please confirm the password!'); c.focus(); return false;
	}
	if(c.value != b.value){
		alert('Passwords don\'t match!'); b.focus(); return false;
	}
	return true;
}

//-->