// Variables Globales

var Gbl_IPAddr="213.97.21.247"; 							// Dirección IP de la cámara
var Gbl_Port=8085; 														// Puerto TCP del servidor web de la cámara
var Gbl_UserName="webviewer"; 								// Nombre de usuario
var Gbl_Password="hij52~mno"; 										// Contraseña

var Gbl_FrameRate=1; 													// Número de imágenes por segundo a visualizar
var Gbl_ResolutionH=384; 											// Resolución horizontal
var Gbl_ResolutionV=288; 											// Resolución vertical
var Gbl_PageTitle="Parque Santiago"						// Título de la página

var Gbl_ButtonText1="Cam 1";									//
var Gbl_ButtonText2="Cam 2";									//
var Gbl_ButtonText3="Cam 3";									//	Textos de los botones a mostrar en la página
var Gbl_ButtonText4="Cam 4";									//	
var Gbl_ButtonText5="Cam 5";;									//
var Gbl_ButtonText6="Cam 6";;									//

var Gbl_Preset1="ZONA1";											//
var Gbl_Preset2="ZONA2";											//
var Gbl_Preset3="ZONA3";											//	Nombres de los presets almacenados en la cámara
var Gbl_Preset4="ZONA4";											//	
var Gbl_Preset5="ZONA5";											//
var Gbl_Preset6="ZONA6";											//
//var Gbl_ControlURL="http://mikelmartin.homedns.org/mikel/camweb/AMC.CAB";
var Gbl_ControlURL="http://www.parquesantiago.com/webcam/AMC.CAB";	// URL del control de visualización																					
var Gbl_ControlVersion="3,32,14,0";

// Funciones
	function SetupAMC()
		{
		var URL;
		if (navigator.appName == "Microsoft Internet Explorer" && navigator.platform != "MacPPC" && navigator.platform != "Mac68k")
			{
			document.write('<OBJECT id=Player style="LEFT: 0px; TOP: 0px" height=240 width=320 border=1 classid="CLSID:DE625294-70E6-45ED-B895-CFFA13AEB044" codebase="' + Gbl_ControlURL + '#version=' + Gbl_ControlVersion + '">');
			document.write('<PARAM NAME="_ExtentX" VALUE="8467">');
			document.write('<PARAM NAME="_ExtentY" VALUE="6350">');
			document.write('</OBJECT>');
			}
		else
			{		
			URL="http://" + Gbl_UserName + ":" + Gbl_Password + "@" + Gbl_IPAddr + ":" + Gbl_Port + "/axis-cgi/mjpg/video.cgi?fps=" + Gbl_FrameRate + "&resolution=" + Gbl_ResolutionH + "x" + Gbl_ResolutionH;
			document.write('<img width=' + Gbl_ResolutionH + ' height=' + Gbl_ResolutionV + ' src="' + URL + '">');
			Stretch();
			}
		}



	function StartPlayFunc()
		{
		Player.MediaURL="http://" + Gbl_IPAddr + ":" + Gbl_Port + "/axis-cgi/mjpg/video.cgi?fps=" + Gbl_FrameRate + "&resolution=" + Gbl_ResolutionH + "x" + Gbl_ResolutionH;
		Player.MediaUsername=Gbl_UserName;
		Player.MediaPassword=Gbl_Password;
		Player.MediaType="mjpeg-unicast";
		Player.StretchToFit=true;
		Player.Play();
		Stretch();
		}
	function Stretch()
		{
		if (navigator.appName == "Microsoft Internet Explorer" && navigator.platform != "MacPPC" && navigator.platform != "Mac68k")
			{
			Player.height=Gbl_ResolutionV;
			Player.width=Gbl_ResolutionH;
			}
		window.resizeTo(Gbl_ResolutionH+40,Gbl_ResolutionV+210);
		parent.resizeTo(Gbl_ResolutionH+40,Gbl_ResolutionV+210);
		}
	function PlayAtStartup()
		{
		if (navigator.appName == "Microsoft Internet Explorer" && navigator.platform != "MacPPC" && navigator.platform != "Mac68k")
			StartPlayFunc();
		}

	function DrawButtons()
		{
		document.write('<div id="buttons" style="position:absolute;left:11px;top:' + (Gbl_ResolutionV + 20) + 'px;width:' + Gbl_ResolutionH + 'px;visibility:visible;z-index:15">');
		document.write('<table width=320 border=0 cellpadding=0>');
		for (i=0;i<3;i++)
		{
			document.write('<tr style="height:40px">');
			document.write('<td width=50% align=center><img src="button.gif"></td>');
			document.write('<td width=50% align=center><img src="button.gif"></td>');
			document.write('</tr>');
		}
		document.write('</table>');
		document.write('</div>');
		document.write('<div id="buttons" style="position:absolute;left:11px;top:' + (Gbl_ResolutionV + 20) + 'px;width:' + Gbl_ResolutionH + 'px;visibility:visible;z-index:15">');
		document.write('<table width=320 border=0 cellpadding=0>');
		document.write('<tr style="height:40px">');
		document.write('<td width=50% class="preset" align=center onclick="parent.Dummy.location.href=\'http://' + 
				Gbl_IPAddr + ':' + Gbl_Port + '/local/viewer/gotopreset.cgi?' + Gbl_Preset1 + '\'">' + Gbl_ButtonText1 + '</td>');
		document.write('<td width=50% class="preset" align=center onclick="parent.Dummy.location.href=\'http://' + 
				Gbl_IPAddr + ':' + Gbl_Port + '/local/viewer/gotopreset.cgi?' + Gbl_Preset2 + '\'">' + Gbl_ButtonText2 + '</td>');
		document.write('</tr>');
		document.write('<tr style="height:40px">');
		document.write('<td width=50% class="preset" align=center onclick="parent.Dummy.location.href=\'http://' + 
				Gbl_IPAddr + ':' + Gbl_Port + '/local/viewer/gotopreset.cgi?' + Gbl_Preset3 + '\'">' + Gbl_ButtonText3 + '</td>');
		document.write('<td width=50% class="preset" align=center onclick="parent.Dummy.location.href=\'http://' + 
				Gbl_IPAddr + ':' + Gbl_Port + '/local/viewer/gotopreset.cgi?' + Gbl_Preset4 + '\'">' + Gbl_ButtonText4 + '</td>');
		document.write('</tr>');
		document.write('<tr style="height:40px">');
		document.write('<td width=50% class="preset" align=center onclick="parent.Dummy.location.href=\'http://' + 
				Gbl_IPAddr + ':' + Gbl_Port + '/local/viewer/gotopreset.cgi?' + Gbl_Preset5 + '\'">' + Gbl_ButtonText5 + '</td>');
		document.write('<td width=50% class="preset" align=center onclick="parent.Dummy.location.href=\'http://' + 
				Gbl_IPAddr + ':' + Gbl_Port + '/local/viewer/gotopreset.cgi?' + Gbl_Preset6 + '\'">' + Gbl_ButtonText6 + '</td>');
		document.write('</tr>');
		document.write('</table>');
		document.write('</div>');
		}
