$slash_pos = location.href.lastIndexOf ("/");

if ($slash_pos >= 0) {
  $domain = location.href.substr (0, $slash_pos+1);
}
else {
  $domain = "";
}

if (screen.availWidth <= 1050) {
  location.href = $domain + "set_dim_800.php";
}
else if (screen.availWidth <= 1300) {
  location.href = $domain + "set_dim_1280.php";
}
else {
  location.href = $domain + "set_dim_1600.php";
}
