
// ------------  Browser detection ---------------------
if(document.all)myBorwser = 1; // Explorer
else if (document.getElementById&&!document.all) myBorwser = 2  ;// Netscape6
else myBorwser = 3; // Netscape4 and other
//------------------------------------------------------------

function getDateTime(gap)
      {
        var date = new Date;
        var tim, back;

        date.setTime(gap);
        var hour=date.getHours(), min=date.getMinutes();

        tim = min+60*hour;
        min = tim % 60;
        hour =(tim-min) / 60;

        if (hour < 10) {
            back="0";
            back+=hour.toString();
        }  else {
            back=hour.toString();
        }
        if (min < 10) {
            back+="0";
            back+=min.toString();
        }  else {
            back+=min.toString();
        }
        back += date.getDay().toString();

        return back;
      }
function timeDiff()
      {
      var string, dividerPos, hourDiff1, hourDiff2;
      var val1 = '270&India'; //document.world_clock.pulldown.options[document.world_clock.pulldown.selectedIndex].value;
      var val2 = document.world_clock.pulldown2.options[document.world_clock.pulldown2.selectedIndex].value;

      string = val1;
      dividerPos = string.indexOf("&");
      hourDiff1 = parseInt(string.substr(0,dividerPos));

      //if(document.world_clock.standard2[1].checked==true)
        hourDiff1+=60;

      string = val2;
      dividerPos = string.indexOf("&");
      hourDiff2 = parseInt(string.substr(0,dividerPos));

      //if(document.world_clock.standard3[1].checked==true)
        hourDiff2+=60;

      var date=new Date();
      var tim = date.getTime();
      var time1 = tim + hourDiff1*60000;
      var time2 = tim + hourDiff2*60000;
      var gap, x, y, z, minus;

      x = getDateTime(time1);
      y = getDateTime(time2);

        if (val1!="0&" && val2!="0&") {
          gap = time1-time2;

          if (gap < 0) {
            gap = -gap;
            minus = "-";
          } else {
            minus = "";
          }
          z = getDateTime(gap+date.getTimezoneOffset()*60000);
          document.world_clock.diffClockSum.value=minus + "" + z.substring(0,2) + ":" + z.substring(2,4);
          }
        else if (val1=="0&" || val2=="0&") {
          document.world_clock.diffClockSum.value="----";
        }
}


function updateDiffClocks(tableNum)  {
        if(tableNum==1){
           var string = '270&India'; //document.world_clock.pulldown.options[document.world_clock.pulldown.selectedIndex].value;
        }
        else if(tableNum==2){
          var string = document.world_clock.pulldown2.options[document.world_clock.pulldown2.selectedIndex].value;

        }
        var dividerPos = string.indexOf("&");
        var hourDiff = parseInt(string.substr(0,dividerPos)) + 60;

        //if(tableNum==1){
           //if(document.world_clock.standard2[1].checked==true)
          hourDiff+=60;
          //}
        //else if(tableNum==2){
          //if(document.world_clock.standard3[1].checked==true)
          //hourDiff+=60;
          //}

        var date = new Date();
        var msec = date.getTime();
        var time1 = msec + (date.getTimezoneOffset() + hourDiff)*60000;
        var tim = getDateTime(time1);

        if (string == "0&") {
          tim = "00009"
        }
        if(tableNum==1){
           document.world_clock.diffClock1.value=tim.substring(0,2)+ ':' + tim.substring(2,4);
        }
        else if(tableNum==2){
          document.world_clock.diffClock2.value=tim.substring(0,2)+ ':' + tim.substring(2,4);
        }

        timeDiff();
}




