	imageNumber = 1;
	cameraNumber = 1;
	channelNumber = 1;
	baseurl = "http://relay.doylestownsfrontporch.com";

  function handleError (err, url, line) {
    if (err.indexOf('is not defined') != -1) {
      alert('Oops, something is not defined.\n' +
             err + '\n' + url + '\nline no: ' + line);
      return true; // error is handled
    }
    else
      return false; // let the browser handle the error
  }
  window.onerror = handleError;


	// ================================================================================
	// **** General Page Properties for all video selections ****
	// ================================================================================
	
	cameraServerURL			= "http://relay.doylestownsfrontporch.com";
	updateImageAfterMove	= 0;
	useChannelDropDownBox 	= 1;	// If a Preset drop down menu will be used, set this value to 1.
	usePresetDropDownBox 	= 1;	// If a Preset drop down menu will be used, set this value to 1.
	useOptionDropDownBox 	= 1;	// If an Option drop down menu will be used, set this value to 1.
	useSnapPictureBar 		= 1;	// If a Snap Picture Bar will be used, set this value to 1.

	queuingEnabled   			= 0;  	// set to '1' if queueing is to be enabled. Make sure 
	framesPerStream   		= 0;  	// set 'framesPerStream = 0' for unlimited frames
	regulateBandwidth 		= 0;	// set to '1' to enable bandwidth management (makes all browsers client pull)
	maxFramesPerSecond		= 6;	// specify maximum frames per second to receive.  Use 0 to get maximum available.  
										// use decimal values to get seconds per frame.  Example:  .5 will get 1 frame every 2 seconds

	updateImageAfterMove 	= 0;	// a value of 1 will shows one frame at a time by default, then updates when the user moves the camera

			
	returnType = '';
	controlType = '';	
	channel = cameraNumber;
	baseurl = baseurl;
	if (baseurl == "undefined") baseurl = "";
	if (channel == "undefined") channel = "1";
	extension = new Date(); extension = extension.getTime();	
	
	


updateCount = 0;

extension = new Date(); extension = extension.getTime();	
count = framesPerStream;

function initPageTimer() {
	time=setTimeout("initPageScript();",2000);	
}


function initPage() {

	baseImagePath = baseurl + "/video/" + channel
	queueRequestURL = "/queue1.htm"

	singleImagePath = baseImagePath + '/1/' + 'fps=' + maxFramesPerSecond;
	multiImagePath  = baseImagePath + '/' + framesPerStream + '/fps=' + maxFramesPerSecond;



	alertflag = 0;
	window.status = "Live streaming video...";   // Sets status bar in browser


	// Make sure Variables are defined
	//script_doNotUseVideo = "" + parent.main.doNotUseVideo;


	//if (script_doNotUseVideo == "undefined") {
		//time=setTimeout("setPageProperties()",1000);
		firstImage();
	//} 


	if (updateImageAfterMove == 1) {
		document.mainimage.onload = "";
		document.mainimage.src =  baseImagePath + '/1/';
	}


}



// The update function is called by movecam after each movecam call is made and completed

function update(){
	updateCount ++;
	extension = new Date(); extension = extension.getTime();
	if (updateImageAfterMove == 1) {
		regulateBandwidth = 0;
		document.mainimage.onload = "";
		document.mainimage.src = baseImagePath + '/1/' + extension + updateCount;
		document.mainimage.src = document.mainimage.src;
	} else {
		document.mainimage.src = document.mainimage.src;
	}

}


// ================================================================================
//        Video Functions - Client Pull
// ================================================================================

function firstImage() {

	if (document.mainimage)
	{
		if (navigator.appName == 'Netscape' && regulateBandwidth != 1) {
			document.mainimage.onload = "";
			document.mainimage.src = multiImagePath + "/" + extension;
		} else {
		
		extension = new Date(); extension = extension.getTime();	
		document.mainimage.onload = pullTheImage;
		document.mainimage.src = singleImagePath; 
		}
	}
}

function pullTheImage() {
	
	if (maxFramesPerSecond != 0) {
		delay = Math.round((1 / maxFramesPerSecond) * 1000);
		//time=setTimeout("pullTheImageScript();",delay);		
		pullTheImageScript();
	} else {
		pullTheImageScript();
	}
}

function pullTheImageScript(){

   count--;
	//document.countform.count.value = count;


   extension = new Date(); extension = extension.getTime(); extension = extension + count;
	document.mainimage.src = singleImagePath + "/" + extension;



	if (count > 0) {
		//window.status = "Frames left in stream --> " + count;
		window.status = "Receiving Live Video...";
	} else {
		window.status = "Receiving unlimited frames...";
	}
	
	if (count < 0 && framesPerStream > 0) {
		window.status = "Video stream finished - Refresh screen to restart video";
		document.mainimage.onload = '';
		if (alertflag == 0) {
			alert("Video stream finished - Refresh screen to restart video");
			alertflag = 1;
		}
	}
}
