//<!-- GLOBAL JAVASCRIPTS -->
//<script language="JavaScript" type="text/javascript"><!--

function launch(url) {
  var w = 480, h = 340;

  if (document.all) {
    /* the following is only available after onLoad */
    w = document.body.clientWidth;
    h = document.body.clientHeight;
  }
  else if (document.layers) {
    w = window.innerWidth;
    h = window.innerHeight;
  }

  var popW = 465, popH = 570;
  var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  self.name = "opener";
  remote = open(url, 'helpWin', "resizable,scrollbars,status,width=" + popW + ",height="+popH+",left="+leftPos+",top="+topPos+"");
}

function openPopUp(thePage, theName, theWidth, theHeight)
{
  var someFeatures = 'scrollbars=yes,toolbar=0,location=no,directories=0,status=0,menubar=0,resizable=1,width=' + theWidth + ',height=' + theHeight;
  var aPopUpWin = window.open(thePage, theName, someFeatures);

  if (navigator.appName == "Netscape") {
    aPopUpWin.focus();
  }
}

function showStatus(msg)
{
  window.status = msg
  return true
}
// -->
//</script><script language="JavaScript">
//<!--
function CSS ()
{
  if ((navigator.appVersion.indexOf("Mac") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
    document.write('<link rel="stylesheet" href="/css/mac_ns.css" type="text/css">');

  } else if ((navigator.appVersion.indexOf("Mac") != -1) && (navigator.appName.indexOf("Microsoft Internet Explorer") != -1)) {
    document.write('<link rel="stylesheet" href="/css/mac_ie.css" type="text/css">');

  } else if ((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Netscape") != -1)) {
    document.write('<link rel="stylesheet" href="/css/win_ns.css" type="text/css">');

  } else if ((navigator.appVersion.indexOf("Win") != -1) && (navigator.appName.indexOf("Microsoft Internet Explorer") != -1)) {
    document.write('<link rel="stylesheet" href="/css/win_ie.css" type="text/css">');

  } else if (navigator.appName.indexOf("Netscape") != -1) {
    // Unix or other system
    document.write('<link rel="stylesheet" href="/css/win_ns.css" type="text/css">');
  } else {         
    document.write('<link rel="stylesheet" href="/css/other.css" type="text/css">');
  }

  // Wrapper for old browsers which can't handle getElementById
  if(!document.getElementById) {
     document.getElementById = function(element)
     {
       return eval("document.all." + element);
     }
  }
}
// -->
//</script>
//<script language="JavaScript" type="text/javascript"><!--
//CSS ();
// -->
//</script>

//<script language="JavaScript" type="text/javascript">
//<!--
function SubmitForm()
{
  document.WizardForm.submit();
}
// -->
//</script>

//<!-- END GLOBAL JAVASCRIPTS --><!-- $root_Properties_PTZ_PTZ = yes -->



if ((navigator.appName == "Microsoft Internet Explorer") &&
    (navigator.platform != "MacPPC") &&
    (navigator.platform != "Mac68k")) {
  var browser = "IE"
} else {
  var browser = "Netscape"
}

function drawBoxHeader(title)
{
  var args = drawBoxHeader.arguments;
  var fill = (args.length >= 2 ? args[1] : false);

  /*document.write('' +
'<td' + (fill ? ' width="100%"' : '') + '>' +
'  <table width="100%" height="46" cellpadding=0 cellspacing=0 border=0>' +
'    <tr>' +
'      <td colspan=2 width=5 background="/pics/gray_corner_lt_5x50px.gif"><img src="/pics/blank.gif" width=5 height=5 border=0 alt=""></td>' +
'      <td valign="top" align="center" width="100%" background="/pics/gray_t_5x50px.gif" height="5" class="funcText" nowrap>' + title + '</td>' +
'      <td colspan=2 width=5  background="/pics/gray_corner_rt_5x50px.gif"><img src="/pics/blank.gif" width=5 height=5 border=0 alt=""></td>' +
'    </tr>' +
'    <tr>' +
'      <td width=1 class="lineBg"><img src="/pics/blank.gif" width=1 height=5 alt=""></td>' +
'      <td width=4><img src="/pics/blank.gif" width=4 height=5 alt=""></td>' +
'      <td valign="middle" align="center" width="100%">' +
'        <table cellpadding=0 cellspacing=0 border=0>' +
'          <tr>');*/
}

function drawBoxFooter()
{
  /*document.write('' +
'          </tr>' +
'        </table>' +
'      </td>' +
'      <td width=4><img src="/pics/blank.gif" width=4 height=5 alt=""></td>' +
'      <td width=1 class="lineBg"><img src="/pics/blank.gif" width=1 height=5 alt=""></td>' +
'    </tr>' +
'    <tr>' +
'      <td colspan=2 width=5 height=5><img src="/pics/line_corner_lb_5x5px.gif" width=5 height=5 border=0 alt=""></td>' +
'      <td width="100%" height=5 background="/pics/line_b_100x5px.gif"><img src="/pics/blank.gif" width=1 height=5 alt=""></td>' +
'      <td colspan=2 width=5 height=5><img src="/pics/line_corner_rb_5x5px.gif" width=5 height=5 border=0 alt=""></td>' +
'    </tr>' +
'  </table>' +
'</td>');*/
}

function drawBoxButton(pic, title)
{
  var args = drawBoxButton.arguments;
  var url =      (args.length >= 3 ? args[2] : null);
  var name =     (args.length >= 4 ? args[3] : null);
  var pressed =  (args.length >= 5 ? args[4] : null);
  var on_click = (args.length >= 6 ? args[5] : null);
  var width =    (args.length >= 7 ? args[6] : 27);
  var height =   (args.length >= 8 ? args[7] : 27);

  if (url) {
    if (name) {
      document.write('<td valign="middle" align="left">' +
                     '<a href="' + url + '" target="Temp"' +
                     (on_click ? ' onClick="' + on_click+ '"' : '') +
                     ' onMouseDown="movepic(\'' + name + '\', \'' + pressed + '\')"' +
                     ' onMouseUp="movepic(\'' + name + '\', \'' + pic + '\')"' +
                     '>' +
                     '<img name="' + name + '" src="' + pic + '" ' +
                     'width=' + width + ' height=' + height + ' border=0 ' +
                     (title ? ' title="' + title + '" alt="' + title + '"' : '') +
                     '>' +
                     '</a>' +
                     '</td>');
    } else {
      document.write('<td valign="middle" align="left">' +
                     '<a href="' + url + '" target="_self"' +
                     (on_click ? ' onClick="' + on_click+ '"' : '') +
                     '>' +
                     '<img src="' + pic + '" ' +
                     'width=' + width + ' height=' + height + ' border=0 ' +
                     (title ? ' title="' + title + '" alt="' + title + '"' : '') +
                     '>' +
                     '</a>' +
                     '</td>');
    }
  } else {
    document.write('<td valign="middle" align="left">' +
                   '<img src="' + pic + '" ' +
                   'width=' + width + ' height=' + height + ' border=0' +
                   (title ? ' title="' + title + '" alt="' + title + '"' : '') +
                   '>' +
                   '</td>');
  }
}

function drawBoxSpacer()
{
  document.write('<td width=5><img src="/pics/blank.gif" width=5 height=5 alt=""></td>');
}


function listVideoSources()
{
  var formInt = document.listFormInt
  var formExt = document.listFormExt
  var presetForm = document.listFormPreset;
  var form = document.WizardForm
  var imageType = '/mjpg/';
  var imageSource = 'video.mjpg';

  if ((1 > 1) ||
      ext_sources
     ) {
    document.write('<select name="videoList" onChange="selectView()" >');

    if ((1 == 1) &&
        !ext_sources
       ) {
      document.write('<option class="gray" value="no_change">&nbsp;----------------</option>');
    } else {
      for (i = 0; i < 1; i++) {
        var camera_nice_nbr = i + 1;
        document.write('<option value="' + imageType + '' + imageSource + '"');
        if (imageType + '' + imageSource == '/mjpg/video.mjpg' ||
            '/jpg/image.jpg' == '/mjpg/video.mjpg') {
          document.write(' selected');
        }

        document.write('>' + formInt['root_ImageSource_I' + i + '_Name'].value + '</option>');
      }
    }
var viewAppletIE = "no";
var viewAppletOther = "no";
// Don't show external sources while using Java applet as Default Viewer. An unsigned applet doesn't have permission to access remote hosts.
if (((browser == "IE") && (viewAppletIE == "no")) || ((browser != "IE") && (viewAppletOther == "no"))) {
    if (formExt.elements.length > 0) {
      for (i = 0; i < formExt.elements.length; i += 3) {
        var aTempString = formExt.elements[i].name
        var videoNr = aTempString.substring(20, aTempString.lastIndexOf('_'))
        var external = escape(formExt['root_ExternalVideo_E' + videoNr + '_ImagePath'].value);

          document.write('<option value="' + external + '"');
          if (formExt['root_ExternalVideo_E' + videoNr + '_ImagePath'].value == '/mjpg/video.mjpg')
            document.write(' selected');
          document.write('>' + formExt['root_ExternalVideo_E' + videoNr + '_Name'].value + '</option>');
      }
    }
}
    document.write('</select>');
//} else {
//  document.write(formInt.root_ImageSource_I0_Name.value);
  }
}

function zoom(size)
{
  var url = document.URL;

  if (url.indexOf("?") == -1) {
    url += "?size=" + size
  } else if (url.indexOf("size=") == -1) {
    url += "&size=" + size
  } else {
    var searchStr = "size=1"
    var replaceStr = "size=" + size
    var re = new RegExp(searchStr , "g")
    url = url.replace(re, replaceStr)
  }

  document.location = url;
}

var aNewImagePath;

function reloadPage()
{
  document.location = aNewImagePath;
}

function selectView()
{
  var form = document.WizardForm;
  var source = form.videoList.options[form.videoList.selectedIndex].value;
  var params = source.split('&');
  var newCamera = null;
  var presetName = null;

  if ((params[1] != null) && ("no" == "no")) {
    newCamera = (params[1].split('='))[1];
    presetName = unescape((params[2].split('='))[1]);
    changeView(params[0], newCamera, presetName);
  } else {
    if (source == "no_change") {
      return;
    } else {
      changeView(source, newCamera, presetName);
    }
  }
}

function changeView(imagePath)
{
  var args = changeView.arguments;
  var newCamera  = (args.length >= 2 ? args[1] : null);
  var presetName = (args.length >= 3 ? args[2] : null);
  var newSize    = (args.length >= 4 ? args[3] : null);
  var other      = (args.length >= 5 ? args[4] : null);

  // Go to correct preset when coming from an external video source
  if ((presetName == null) && (imagePath.indexOf("gotopresetname=") != -1)) {
    presetName = imagePath.slice(imagePath.indexOf("gotopresetname=") + 15)
    if (presetName.indexOf("&") != -1)
      presetName = presetName.substring(0, presetName.indexOf("&"))
  }
  if ((newCamera == null) && (imagePath.indexOf("camera=") != -1)) {
    newCamera = imagePath.slice(imagePath.indexOf("camera=") + 7)
    if (newCamera.indexOf("&") != -1)
      newCamera = newCamera.substring(0, newCamera.indexOf("&"))
  } 

  var reload = false;
  // the whole Live View design is built on page reload >-(
  // must reload initial sequence mode view to toggle buttons etc
  reload = (other != null && other.search("seq=yes"));
  var delay = 0;

  reload |= (imagePath != '/mjpg/video.mjpg');
  if (reload) {
    var size = newSize;

    if (size == null) {
      size = 1;
    }
    if (size != null) {
      size = '&size=' + size;
    }
    //aNewImagePath = 'http://62.117.117.68:162/view/view.shtml?id=737&imagePath=' + imagePath + size;
	aNewImagePath = 'http://cameras.mvk.ru/camera/player.php?id=9&imagePath=' + imagePath + size;
    if (other != null)
      aNewImagePath += other;
    setTimeout("reloadPage()", delay);
  }
}

var seqNext = null;

function doSequence(size) {
  var formSeq = document.listFormSeq;
  var formExt = document.listFormExt;
  var presetForm = document.listFormPreset;
  var seqSources = new Array();
  var seqNumbers = new Array();
  var seqTimes = new Array();
  var cameraNbr;
  var presetName = null;
  var imagePath;
  var next;

  for (var i = 0; i < formSeq['root_Sequence_S0_NbrOfSources'].value; i++) {
    seqSources[i] = formSeq['root_Sequence_S0_Source_S' + i + '_Type'].value;
    seqNumbers[i] = formSeq['root_Sequence_S0_Source_S' + i + '_Number'].value;
    seqTimes[i] = formSeq['root_Sequence_S0_Source_S' + i + '_Time'].value;
  }

  if (seqNext != null) {
    next = seqNext;
  } else {
    next = 0;
  }

  imagePath = "";
  if (seqSources[next] == 'Ext') {
    imagePath = formExt['root_ExternalVideo_E' + seqNumbers[next] + '_ImagePath'].value;
  }
  else if (seqSources[next] == 'Quad') {
    cameraNbr = 'quad';
  } else {
    cameraNbr = parseInt(seqNumbers[next]) + 1;
  }

  if (imagePath == "") {
      imagePath = '/mjpg/' + cameraNbr + '/video.mjpg';
  }

  var nextNext;
  if (formSeq['root_Sequence_S0_RandomEnabled'].value == "yes")
    nextNext = Math.floor(Math.random() * formSeq['root_Sequence_S0_NbrOfSources'].value);
  else
    nextNext = next + 1;
  if (nextNext >= formSeq['root_Sequence_S0_NbrOfSources'].value)
    nextNext = 0;

  seqNext = nextNext;
  	imagePath = escape(imagePath);
    changeView(imagePath, cameraNbr, presetName, size, '&seq=yes&next=' + nextNext + '&sequencetime=' + seqTimes[next]);

    t1 = setTimeout("doSequence(size)", 1000 * seqTimes[next]);
}


function snapshot(imagepath)
{
  var no = document.WizardForm.amount.value++
  var picturepath = imagepath.replace(/video/, "image")
  if (imagepath.indexOf("mpeg4") != -1)
  {
    picturepath = picturepath.replace(/rtsp/, "http")
    picturepath = picturepath.replace(/mpeg4/g, "jpg")
    picturepath = picturepath.replace(/media.amp/g, "image.jpg")
  } else {
    picturepath = picturepath.replace(/mjpg/g, "jpg")
  }
  var page = 'snapshot.shtml?picturepath=' + picturepath
  var time = new Date()
  var timestamp = time.getTime()

  page += '&timestamp=' + timestamp + '&width=' + 640
  openPopUp(page, 'Take_snapshot' + [no] + '', 640 + 45, 480 + 75 )
}
function movepic(img_name, img_src)
{
  document[img_name].src = img_src;
}

function auto(Path)
{
  parent.frames[1].location = Path
}

function AbsoluteOrRelative(form)
{
  var url = document.URL;
  if (form.AbsOrRel.selectedIndex == 0)
    var relative = "no";
  else
    var relative = "yes_no_cross";
  if (url.indexOf("?") == -1) {
    url += "?relative=" + relative;
  } else if (url.indexOf("relative=") == -1) {
    url += "&relative=" + relative;
  } else {
    var searchStr = "relative=";
    var replaceStr = "relative=" + relative;
    var re = new RegExp(searchStr , "g");
    url = url.replace(re, replaceStr);
  }
  document.location = url;
}  

function video(imagepath)
{
  var resolution = 0
  var width = 0
  var height = 0

  if (imagepath.indexOf("resolution=") != -1) {
    var resStart = imagepath.indexOf("resolution=")
    var resStop = imagepath.indexOf("&", resStart)
    if (resStop == -1) resStop = imagepath.length
    resolution = imagepath.substring(resStart + 11, resStop);
    width = parseInt(resolution.substring(0, resolution.indexOf('x')));
    height = parseInt(resolution.slice((resolution.indexOf('x') + 1)));
  } else if (imagepath.indexOf("mpeg4") != -1) {
    width = 416;//640;
    height = 312;//480;
    resolution = width + 'x' + height;
  } else {
    width = 416;//640;
    height = 312;//480;
    resolution = width + 'x' + height;
  }

  if ((imagepath.indexOf("rotation=90") != -1) || (imagepath.indexOf("rotation=270") != -1)) {
    var aTempWidth = width;
    width = height;
    height = aTempWidth;
    resolution = width + 'x' + height;
  }

  if ('1' != '1') {
    width = width * 1
    height = height * 1
  }
  var width_height = 'width="' + width + '" height="' + height + '"';
  var use_activex = 0;
  var use_java = 0;
  var use_spush = 0;
  var use_flash = 0;
  var use_still = 0;
  var viewer = "still";
  var use_quicktime = 0;

  if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k")) {
    viewer = "activex";
  } else {
    viewer = "spush";
  }

  if (viewer.indexOf("activex") != -1) {
    use_activex = 1;
  }
  if (viewer.indexOf("spush") != -1) {
    use_spush = 1;
  }
  if (viewer.indexOf("flash") != -1) {
    use_flash = 1;
  }
  if (viewer.indexOf("quicktime") != -1) {
    use_quicktime = 1;
  }
  if (imagepath.indexOf("mpeg4") != -1) {
    if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k")) {
        use_quicktime = 0;
        use_activex = 1;
    } else {
      use_quicktime = 1;
      use_spush = 0;
      use_still = 0;
    }
  } else {
    if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k")) {
        use_quicktime = 0;
        use_activex = 1;
    } else {
      use_quicktime = 0;
      use_spush = 1;
      use_still = 0;
    }
  }
  if (viewer.indexOf("java") != -1) {
    if (imagepath.indexOf("mpeg4") == -1) {
      use_java = 1;
      use_activex = 0;
      use_spush = 0;
      use_flash = 0;
      use_still = 0;
      use_quicktime = 0;
    }
  }
  if ((viewer.indexOf("still") != -1) || !(use_activex || use_spush || use_flash || use_java || use_quicktime)) {
    if (imagepath.indexOf("mpeg4") == -1) {
      use_still = 1;
      use_quicktime = 0;
      use_spush = 0;
      use_activex = 0;
    } else {
      if ((navigator.appName == "Microsoft Internet Explorer") && (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k")) {
        use_activex = 1;
      } else {
        use_quicktime = 1;
      }
    }
  }
  var agent = navigator.userAgent.toLowerCase();
  if (agent.indexOf("applewebkit/") != -1) {
    var pos = agent.indexOf("applewebkit/") + 12
    var webKitVersion = parseInt(agent.substring(pos, agent.indexOf(" ", pos)))
    if ((use_spush) && (webKitVersion < 416)) {
      use_java = 1;
      use_spush = 0;
    }
  }
  var textCameraHtml = '';
  if (use_activex) {
    height = height + 54
    var notAuthorizedText = "The installation of the MPEG-4 Decoder has been disabled. Contact the Administrator of this AXIS 211 Network Camera.";
    var authorizedText = "Click here to install or upgrade the MPEG-4 Decoder.";
    var installDecoderText1 = "<b>MPEG-4 Decoder</b>, which enables streaming video in Microsoft Internet Explorer, has not been installed or could not be registered on this computer.";
    var installDecoderText2 = "To <a href=\"javascript:launch('/incl/license.shtml')\">install or upgrade</a> the MPEG-4 Decoder, you must have Administration rights on this computer and you must answer Yes <br>when asked if you wish to allow the installation. AXIS 211 Network Camera can also be configured to show still images.";
    var notAuthorizedAacText = "The installation of the AAC Decoder has been disabled. Contact the Administrator of this AXIS 211 Network Camera.";
    var authorizedAacText = "Click here to install or upgrade the AAC Decoder.";
    var installAacDecoderText1 = "<b>AAC Decoder</b>, which enables streaming AAC audio in Microsoft Internet Explorer, has not been installed or could not be registered on this computer.";
    var installAacDecoderText2 = "To <a href=\"javascript:launch('/incl/aac_license.shtml')\">install or upgrade</a> the AAC Decoder, you must have Administration rights on this computer and you must answer Yes <br>when asked if you wish to allow the installation.";

    var installText1 = "which enables streaming"; 
    var videoText = "video";
    var audioText = "audio";
    var installText2 = "in Microsoft Internet Explorer, has not been installed or could not be registered on this computer.";
    var installText3 = "To install or upgrade the";
    var installText4 = ", you must have Administration rights on this computer and you must answer Yes <br>when asked if you wish to allow the installation. AXIS 211 Network Camera can also be configured to show still images.";
    DrawAMC("AXIS 211", "AXIS Media Control", height, width, imagepath, "DE625294-70E6-45ED-B895-CFFA13AEB044", "AMC.cab", "4,1,4,0", "yes", "", "", "1", "", "", "", "no", "no", "554", "no", installText1, videoText, installText2, installText3, installText4, "0", "", "");
    //jQuery('#camera_image_div').html(textCameraHtml2);
	if (imagepath.indexOf("mpeg4") != -1) {
	  //textCameraHtml += 
      InstallDecoder("AXIS 211", "MPEG-4 Decoder", "c32fe9f1-a857-48b0-b7bf-065b5792f28d", "NotFound.cab", "1,1,0,13", "yes", notAuthorizedText, authorizedText, installDecoderText1, installDecoderText2);
      InstallFilter("AXIS 211", "MPEG RTP Reader", "67B1A88A-B5D2-48B1-BF93-EB74D6FCB077", "1,6,3,0", "AMC.cab", installText1, videoText, installText2, installText3, installText4);
      InstallFilter("AXIS 211", "Image Notify Component", "0173EEF5-1FDE-479C-9F24-34C3CB0B3243", "1,2,1,0", "AMC.cab", installText1, videoText, installText2, installText3, installText4);
    }

    textCameraHtml += "<br>";
  }

  if (use_spush) {
    textCameraHtml += '<table cellspacing=0 cellpadding=0 border=0><tr><td colspan=3 align="center">';
      var output = '<img id="stream" SRC="' + imagepath + '" ' + width_height;
      var view_NoImageTxt = "If no image is displayed, there might be too many viewers, or the browser configuration may have to be changed. See help for detailed instructions on how to do this."
      output += ' border=0 ALT="' + view_NoImageTxt + '">';
    output += '<br>';
    textCameraHtml += output;
	if( document.stream != undefined && document.stream.src != undefined ){
    var fullImagePath = document.stream.src
	}
    var stillImagePath = "/jpg/image.jpg"
    if (imagepath.indexOf("/axis-cgi/mjpg/video.cgi") != -1) {
      var searchStr = "/axis-cgi/mjpg/video.cgi"
      var replaceStr = "/jpg/image.jpg"
      var re = new RegExp(searchStr , "g")
      stillImagePath = imagepath.replace(re, replaceStr)
    }

    textCameraHtml += '</td></tr>';
    /*document.write('<tr><td colspan=3 align="center" nowrap class="usedBoxStyle">');
    document.write('<table cellspacing=2 cellpadding=2 border=0 width="100%">');
    document.write('<tr height="32" id="videoItems" class="shownItems">');
    document.write("<td align=\"right\" width=\"40\"><a href=\"javascript:void(0)\" onClick=\"stopStartStream('" + stillImagePath + "')\"><img src=\"/pics/stop_button_27x27px.gif\" width=\"27\" height=\"27\" alt=\"Stop stream\" title=\"Stop stream\" border=\"0\"></a></td>");
    document.write("<td width=\"27\"><a href=\"javascript:void(0)\" onClick=\"stopStartStream('" + fullImagePath + "')\"><img src=\"/pics/play_button_27x27px.gif\" width=\"27\" height=\"27\" alt=\"Start stream\" title=\"Start stream\" border=\"0\"></a></td>");
    document.write("<td>&nbsp;</td></tr>");*/
    //document.write('</table></td></tr></table>');
	textCameraHtml += '</table>';
  }

  if (use_quicktime) {
    textCameraHtml += "QuickTime does not support the current MPEG-4 setting.<br>Go to Setup->Video&Image->Advanced->MPEG-4 and set Video object type to 'Simple' for QuickTime to work.";
  }

  if (use_flash) {
    var view_NeedFlashPluginTxt = "You need a Shockwave Flash plugin, get it from:"
    textCameraHtml += '<EMBED src="http://62.117.117.68:162/axis-cgi/mjpg/video.swf?resolution=' + resolution +'&camera=1" ' +
    'quality=high bgcolor=#000000 ' + width_height +
    ' TYPE="application/x-shockwave-flash" swLiveConnect=TRUE' +
    ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">' +
    '</EMBED>' +
    '<NOEMBED>' + view_NeedFlashPluginTxt +
    '<a href="http://www.macromedia.com/shockwave/download/">Macromedia</a>.' +
    '</NOEMBED><br>';
  }

  if (use_java) {
    var playerWidth = 640
    var playerHeight = 480 + 105
    if (playerWidth < 300)
      playerWidth = 300

    if (imagepath.indexOf("http") != -1) {
      var addrEnd = imagepath.indexOf("/", 8)
      var addr = imagepath.substring(0, addrEnd)
    } else {
      var addr = ""
    }

    textCameraHtml += '<APPLET archive="ama.jar" codeBase="/java/ama" code="ama.MediaApplet" width="' + playerWidth + '" height="' + playerHeight + '">';
    textCameraHtml += '<PARAM NAME="code" VALUE="ama.MediaApplet">';
    textCameraHtml += '<PARAM NAME="archive" VALUE="ama.jar">';
    textCameraHtml += '<PARAM NAME="codebase" VALUE="/java/ama">';
    textCameraHtml += '<PARAM NAME="ama_cgi-path" VALUE="axis-cgi">';
    textCameraHtml += '<PARAM NAME="cache_archive" VALUE="ama.jar">';
    textCameraHtml += '<PARAM NAME="cache_version" VALUE="1.1.0.0">';
    textCameraHtml += '<PARAM NAME="ama_plugins" VALUE="">';
    textCameraHtml += '<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">';
    textCameraHtml += '<PARAM NAME="ama_url" VALUE="' + addr +
    'http://62.117.117.68:162/axis-cgi/mjpg/video.cgi?camera=1&resolution=640x480">';
    textCameraHtml += "Your browser does not support Java"
    textCameraHtml += "</APPLET><br>";
  }

  if (use_still) {
    var picturepath = imagepath.replace(/video/, "image")
    picturepath = picturepath.replace(/mjpg/g, "jpg")
    picturepath = picturepath.replace(/rtsp/, "http")
    picturepath = picturepath.replace(/mpeg4/g, "jpg")
    picturepath = picturepath.replace(/media.amp/g, "image.jpg")

    textCameraHtml += '<img SRC="' + picturepath + '" border=0 ' + width_height +' /><br />';
  }
  document.write(textCameraHtml);
  return textCameraHtml;
}

function stopStartStream(path)
{
  theDate = new Date();
  if (path.indexOf("?") != -1)
    path += "&"
  else
    path += "?"
  path += "timestamp=" + theDate.getTime()
  document.stream.src = path
}

function goto_camera(cam)
{
  cam = '';

  var imagePath;
    imagePath = '/mjpg/' + cam + 'video.mjpg';
  changeView(imagePath);
}

function loadCamera(idport){
	//var camArray = 
	/*jQuery('#camera_image_div').empty();
	jQuery('#camera_image_div').css('display', 'none');
	//video("http://192.168.1.162/mjpg/video.mjpg");
	if(idport==164){
		idport="164";
	}else if(idport==162){
		idport="162";
	}else if(idport==163){
		idport="163";
	}else if(idport==169){
		idport="169";
	}else if(idport==170){
		idport="170";
	}
	else if(idport==176){
		idport="176";
	}

	if( (idport==164) || (idport==162) || (idport==163) || (idport==169) || (idport==1170) ){
	txtC = video("http://192.168.1."+idport+"/mjpg/video.mjpg");
	//txtC = 'sdfgsdfgsdfgdfnhgjkjsdfgjdofshnfgnh';
	//alert(txtC);
	jQuery('#camera_image_div').append(txtC);
	jQuery('#camera_image_div').slideToggle();
	}*/
	if(idport==162){
		jQuery('#camera_image_div1').slideToggle();
		jQuery('#camera_image_div2').css('display', 'none');
		jQuery('#camera_image_div3').css('display', 'none');
		jQuery('#camera_image_div4').css('display', 'none');
		jQuery('#camera_image_div5').css('display', 'none');
		jQuery('#camera_image_div6').css('display', 'none');
		jQuery('#camera_image_div7').css('display', 'none');
	}else if(idport==163){
		jQuery('#camera_image_div1').css('display', 'none');
		jQuery('#camera_image_div2').slideToggle();
		jQuery('#camera_image_div3').css('display', 'none');
		jQuery('#camera_image_div4').css('display', 'none');
		jQuery('#camera_image_div5').css('display', 'none');
		jQuery('#camera_image_div6').css('display', 'none');
		jQuery('#camera_image_div7').css('display', 'none');
	}else if(idport==169){
		jQuery('#camera_image_div1').css('display', 'none');
		jQuery('#camera_image_div2').css('display', 'none');
		jQuery('#camera_image_div3').slideToggle();
		jQuery('#camera_image_div4').css('display', 'none');
		jQuery('#camera_image_div5').css('display', 'none');
		jQuery('#camera_image_div6').css('display', 'none');
		jQuery('#camera_image_div7').css('display', 'none');
	}else if(idport==170){
		jQuery('#camera_image_div1').css('display', 'none');
		jQuery('#camera_image_div2').css('display', 'none');
		jQuery('#camera_image_div3').css('display', 'none');
		jQuery('#camera_image_div4').slideToggle();
		jQuery('#camera_image_div5').css('display', 'none');
		jQuery('#camera_image_div6').css('display', 'none');
		jQuery('#camera_image_div7').css('display', 'none');
	}else if(idport==164){
		jQuery('#camera_image_div1').css('display', 'none');
		jQuery('#camera_image_div2').css('display', 'none');
		jQuery('#camera_image_div3').css('display', 'none');
		jQuery('#camera_image_div4').css('display', 'none');
		jQuery('#camera_image_div5').slideToggle();
		jQuery('#camera_image_div6').css('display', 'none');
		jQuery('#camera_image_div7').css('display', 'none');
	}else if(idport==194){
		jQuery('#camera_image_div1').css('display', 'none');
		jQuery('#camera_image_div2').css('display', 'none');
		jQuery('#camera_image_div3').css('display', 'none');
		jQuery('#camera_image_div4').css('display', 'none');
		jQuery('#camera_image_div5').css('display', 'none');
		jQuery('#camera_image_div6').slideToggle();
		jQuery('#camera_image_div7').css('display', 'none');
	}else if(idport==176){
		jQuery('#camera_image_div1').css('display', 'none');
		jQuery('#camera_image_div2').css('display', 'none');
		jQuery('#camera_image_div3').css('display', 'none');
		jQuery('#camera_image_div4').css('display', 'none');
		jQuery('#camera_image_div5').css('display', 'none');
		jQuery('#camera_image_div6').css('display', 'none');
		jQuery('#camera_image_div7').slideToggle();
	}


	
	return false;
}
