function switchlang(now, next) {
var myURL = window.location.href;
var myURL = findandreplace(myURL,""+now+"",""+next+"");
var myURL = findandreplace(myURL,"lang="+now,"lang="+next);
window.location.href = myURL;
}

function findandreplace(source, searchstring, replacement)
{   
    if ((source == null) || (searchstring == null))           { return null; }
    if ((source.length == 0) || (searchstring.length == 0))   { return source; }
    if ((replacement == null) || (replacement.length == 0))    { replacement = ""; }
    var pos = source.indexOf(searchstring, 0);
    while (pos >= 0)
    {
         source = source.substring(0, pos) + replacement + source.substring(pos + searchstring.length);
         pos = source.indexOf(searchstring, pos + replacement.length);
    }
    return source;
}
