
 
$(document).ready(function(){
   runEqualHeights("#vt_right_col, #vt_body_col, #vt_nav_col");
	
   var footerBG = $('#vt_footer_bg');
   var footerContent = $('#vt_footer');
   var promoPodcast = $('#vt_promo_podcast');
   var prRule = $('#vt_pr_top HR');
   var nextPrRule = $('#vt_pr_content > HR');
   var headerUnit = $('DIV#vt_header_unit');
   
   if ($.browser.msie && $.browser.version <= 7){
		footerBG.css({'margin-top':'0','position':'relative'});
		footerContent.css('top','30px');
		promoPodcast.css('margin-top','0');
		prRule.css('height','1px');
		nextPrRule.css('height','1px');
		headerUnit.css({
			'height':'30px',
			'top':'auto',
			'bottom':'25px'		
		})
	} 
	
   // If there is no subnav, then change the color (as it looks strange without subnav)
   var contactNewsItem = $('#horizontal_main_nav > ul > li >a.vt_active:only-child');
   if(contactNewsItem.size()>0){
	   contactNewsItem.parent().parent().parent().css({'border-bottom':'0px solid #000000'});
	   contactNewsItem.css({'background':'#CDCCA1'});
   }
   
   var pathname = window.location.pathname;
   var ctype = $('meta[name=cms-ct]').attr('content');
   // getting date
   var meta_date = new Date($('meta[name=date]').attr('content'));
   var unparsed_date = $('meta[name=date]').attr('content');
   var split_d = unparsed_date.split(' ');
   
   // location of notices (so that only notices will show this text)
   var noticesLoc = '/notices/';
   if(ctype === "vtGeneric" && pathname.indexOf(noticesLoc)===0){
        var info = "<p>First issued on: " + split_d[0] + " " +split_d[1] + " " + split_d[2] + "</p>";
        $('#vt_body_col').append(info);
   }
   
    // add date to Image Gallery and Multimedia
    if(ctype === "vtMultimedia" || ctype === "vtImgGallery"){
         var info = "<p>First published on: " + split_d[0] + " " +split_d[1] + " " + split_d[2] + "</p>";
         $('#vt_body_col').append(info);
     }
 });
 
/*
 * Webcam script: Allows for a snapshot to be taken
 */
function SnapShot(ipaddress,imagewidth, imageheight)
{
	var width = imagewidth + 20;
	var height = imageheight + 70;
	var theDate = new Date();
	var windowname = "Snapshot" + theDate.getTime();
	var windowargs = "scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=" + width + ",height=" + height;
	var filepath = "http://"+ipaddress+"/axis-cgi/jpg/image.cgi?resolution=CIF?" + theDate.getTime();

	popupwindow = window.open("", windowname, windowargs);
	popupwindow.document.write("<html><head><title>Snapshot<\/title><\/head><body>");
	popupwindow.document.write("<center><h3>Right Click the image and choose &quot;Save As&quot;</h3>");
	popupwindow.document.write("<img src=" + filepath + " width=\""+imagewidth+"\" height=\""+imageheight+"\" >");
	popupwindow.document.write("</center></body></html>");
}
/*
 * Webcam script: given an ipaddress, width and height will attempt to use the default AXIS camera
 * script to connect to and display images from the webcam.
 */
function addWebcamByIP(ipaddress, width, height){
	// Set the BaseURL to the URL of your camera
	var BaseURL = "http://"+ipaddress+"/";
	
	// 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 = width;
	var DisplayHeight = height;
	
	// 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  = '<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=3,32,14,0">';
	  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">';
	  output += '<BR/><STRONG>Axis Media Control</STRONG><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>';
	  document.write(output);
	  document.Player.ToolbarConfiguration = "play,+snapshot,+fullscreen"
	} else {
	  // If not IE for Windows use the browser itself to display
	  theDate = new Date();
	  output  = '<IMG SRC="';
	  output += BaseURL;
	  output += File;
	  output += '&dummy=' + theDate.getTime().toString(10);
	  output += '" HEIGHT="';
	  output += DisplayHeight;
	  output += '" WIDTH="';
	  output += DisplayWidth;
	  output += '" ALT="Camera Image">';
	  document.write(output);
	}

}


