function ClearText(field, value) {
	if(field.value == value) {
		field.value = "";
	} else if(field.value == "") {
		field.value = value;
	}
}

var headPics= new Array("2DK0002_Balken.jpg","2DK0044_Balken.jpg","2DK0169_Balken.jpg","2DK0314_Balken.jpg","2DK0631_Balken.jpg","2DK0783_Balken.jpg","2DK0837_Balken.jpg","2DK1097_Balken.jpg","2DK1435_Balken.jpg","2DK1488_Balken.jpg","2DK1798_Balken.jpg","2DK1962_Balken.jpg","2DK9634_Balken.jpg","2DK9673_Balken.jpg","2DK9765_Balken.jpg","2DK9797_Balken.jpg","MG_2211_Balken.jpg","MG_3396_Balken.jpg","MG_3668_Balken.jpg");
function nextHeadPic() {
	var index = Math.floor(Math.random()*(headPics.length-1));
	document.headPic.src = "/fileadmin/Template_HIF/images/Header/" + headPics[index];
}



function showWebCam() {
	  $dialog = $('<div></div>')
			.html('<iframe src="/fileadmin/Template_HIF/image.html" frameborder="0" scrolling="no" width="380" height="280"/><iframe src="/fileadmin/Template_HIF/panel.html" frameborder="0" scrolling="no" width="380" height="35" />')
			.dialog({
				autoOpen: true,
				width: 430,
				height: 385,
				modal: true,
				title: 'Webcam'
			});
}

function camImage()
{
// Set the BaseURL to the URL of your camera
var BaseURL = "http://213.3.19.1:9900/";

// DisplayWidth & DisplayHeight specifies the displayed width & height of the image.
// You may change these numbers, the effect will be a stretched or a shrunk image
//var DisplayWidth = "352"; 
//var DisplayHeight = "288"; 

var DisplayWidth = "380";
var DisplayHeight = "280";

// This is the path to the image generating file inside the camera itself
var File = "axis-cgi/mjpg/video.cgi?resolution=CIF";
// No changes required below this point
var output = "";
if ((navigator.appName == "Microsoft Internet Explorer") &&
   (navigator.platform != "MacPPC") && (navigator.platform != "Mac68k"))
{
  // If Internet Explorer under Windows then use ActiveX 
  output  = '<div class="image"><OBJECT ID="Player" width='
  output += DisplayWidth;
  output += ' height=';
  output += DisplayHeight;
  output += ' CLASSID="CLSID:DE625294-70E6-45ED-B895-CFFA13AEB044" ';
  output += 'CODEBASE="';
  output += BaseURL;
  output += 'activex/AMC.cab#version=4,1,4,5">';
  output += '<PARAM NAME="MediaURL" VALUE="';
  output += BaseURL;
  output += File + '">';
  output += '<param name="MediaType" value="mjpeg-unicast">';
  output += '<param name="ShowStatusBar" value="0">';
  output += '<param name="ShowToolbar" value="0">';
  output += '<param name="AutoStart" value="1">';
  output += '<param name="StretchToFit" value="1">';
  // Remove the // for the ptz settings below to use the code for click-in-image. 
     //  output += '<param name="PTZControlURL" value="';
     //  output += BaseURL;
     //  output += '/axis-cgi/com/ptz.cgi?camera=1">';
     //  output += '<param name="UIMode" value="ptz-relative">'; // or "ptz-absolute"
  output += '<BR><B>Axis Media Control</B><BR>';
  output += 'The AXIS Media Control, which enables you ';
  output += 'to view live image streams in Microsoft Internet';
  output += ' Explorer, could not be registered on your computer.';
  output += '<BR></OBJECT></div>';
} else {
  // If not IE for Windows use the browser itself to display
  theDate = new Date();
  output  = '<div><IMG SRC="';
  output += BaseURL;
  output += File;
  output += '&dummy=' + theDate.getTime().toString(10);
  output += '" HEIGHT="';
  output += DisplayHeight;
  output += '" WIDTH="';
  output += DisplayWidth;
  output += '" ALT="Camera Image"></div>';
}
//return output;
document.write(output);
document.Player.ToolbarConfiguration = "play,+snapshot,+fullscreen"

// Remove the // below to use the code for Motion Detection. 
  // document.Player.UIMode = "MDConfig";
  // document.Player.MotionConfigURL = "/axis-cgi/operator/param.cgi?ImageSource=0"
  // document.Player.MotionDataURL = "/axis-cgi/motion/motiondata.cgi";
}
 

function camPanel()
{
	var BaseURL = "http://213.3.19.1:9900/";
	var camPanel= "";


    camPanel  = '<div class="panel"><IMG SRC="image/panelMin.gif" USEMAP="#panel2" border="0">'
	camPanel += '<MAP NAME="panel2">'
	camPanel += '<AREA SHAPE=rect COORDS="3,3,65,32" HREF="panelMax.html" target="right" ALT="Maximize">'
	camPanel += '<AREA SHAPE=rect COORDS="20,38,49,48" HREF="'
	camPanel += BaseURL;
	camPanel += 'axis-cgi/com/ptz.cgi?camera=1&move=up" onMouseOver="return showStatus(&#39;Move up&#39;)" onMouseOut="return showStatus(&#39;&#39;)" ALT="Move up">'
	camPanel += '<AREA SHAPE=rect COORDS="20,67,49,77" HREF="'
	camPanel += BaseURL;
	camPanel += 'axis-cgi/com/ptz.cgi?camera=1&move=down" onMouseOver="return showStatus(&#39;Step down&#39;)" onMouseOut="return showStatus(&#39;&#39;)" ALT="Move down">'
	camPanel += '<AREA SHAPE=rect COORDS="6,50,17,65" HREF="'
	camPanel += BaseURL;
	camPanel += 'axis-cgi/com/ptz.cgi?camera=1&move=left" onMouseOver="return showStatus(&#39;Move left&#39;)" onMouseOut="return showStatus(&#39;&#39;)" ALT="Move left"">'
	camPanel += '<AREA SHAPE=rect COORDS="51,50,62,65" HREF="'
	camPanel += BaseURL;
	camPanel += 'axis-cgi/com/ptz.cgi?camera=1&move=right" onMouseOver="return showStatus(&#39;Move right&#39;)" onMouseOut="return showStatus(&#39;&#39;)"  ALT="Move right">'
	camPanel += '<AREA SHAPE=rect COORDS="19,50,49,65" HREF="'
	camPanel += BaseURL;
	camPanel += 'axis-cgi/com/ptz.cgi?camera=1&move=home"  ALT="Home">'
	camPanel += '<AREA SHAPE=rect COORDS="3,82,32,111" HREF="'
	camPanel += BaseURL;
	camPanel += 'axis-cgi/com/ptz.cgi?camera=1&rzoom=2500"  ALT="Zoom In">'
	camPanel += '<AREA SHAPE=rect COORDS="36,82,65,111" HREF="'
	camPanel += BaseURL;
	camPanel += 'axis-cgi/com/ptz.cgi?camera=1&rzoom=-2500"  ALT="Zoom Out">'
	camPanel += '</MAP>'
	camPanel += '</div>'
 
    document.write(camPanel);
}