My dear, if you find the concept of cookies "complex" then I dare say that you better leave both PHP and Javascript well alone.
And the functions in PHP for accessing cookies is not complex as well. You obviously didn't even look.
PHP Code:
setcookie("TestCookie", $value, time()+3600);
echo $_COOKIE["TestCookie"];
And your x-1 example is a complicated version of the true/false mechanism 
PHP Code:
$true_or_false = $true_or_false ? False : True;
//slightly longer version of the above:
$true_or_false = ($true_or_false == true) ? False : True;
//Your version with x would look like this in shorthand:
$x = $x ? False : True;
//Or of you absolutely want to keep your zero and one values:
$x = $x ? 0 : 1;
//shorthand explanation:
$target_variable = (expression_to_be_validated) : variables_new_value_if_expression_is_true ? variables_new_value_if_expression_is_false;
This is the shorthand notation of
PHP Code:
if ($true_or_false == True) {
$true_or_false = False;
} else {
$true_or_false = True;
}
This exploits the fact that PHP treats the value zero (0) like the boolean false, while values different from zero or an empty string will be true. ( http://de2.php.net/manual/en/language.types.boolean.php )
And it has the advantage that you (or someone else) can look at it later and definitely see what is going on. The boolean variable type is intended for these kind of on/off-switches. With stuff like |x-1| you run the risk of having to think about it if you're looking at your own code, say, a year later.
If you treat such switches as booleans, you can simplify your conditions a bit. Let your variable "$show_navbar" be a boolean which determines whether you show the navbar or not. The next two code snippets do exactly the same:
PHP Code:
if($show_navbar == True) {
printf("Navbar status: %s", $show_navbar);
}
if($show_navbar) {
printf("Navbar status: %s", $show_navbar);
}