<?

//Get the full string in the url including variables
$CurrentURIplusQS = $_SERVER['REQUEST_URI'];

//echo($CurrentURIplusQS);

//take out the current language settings completely for the purposes of generating these links
$newURIplusQS = str_replace("L=1", "", $CurrentURIplusQS);
$newURIplusQS2 = str_replace("L=0", "", $newURIplusQS);

//check for query
$pos = strrpos($newURIplusQS2, "?");
if ($pos === false) { // note: three equal signs
$queryNeeded = "?";
}

//if no query then print one too


//print the links with the language vars removed so we can start again by adding the QS each time
echo '<a href="'.$newURIplusQS2.$queryNeeded.'&L=0">English</a> | <a href="'.$newURIplusQS2.$queryNeeded.'&L=1">Spanish</a>';
//echo '<a href="http://www.peacebrigades.net/383.html?&L=0">English</a> | <a href="http://www.peacebrigades.net/383.html?&L=1">Castellano</a>';

?>