/*************************************************************************

*

* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2012 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/

// ---- Object API ---

function isDOMRequired() { 
	return true;
}

function objectTag()
{
   var strOut = '<video' + " " ;
   if( getDocType() == "XHTML")
   		strOut = strOut + 'controls="controls"';
	else
		strOut = strOut + 'controls';
    
   strOut = strOut + '>' + '</video>';
   
   // log the required event for head light tracking
   dw.logEvent(UT_HTML5_VIDEO, UT_HTML5_VIDEO_INSERT);
   
   var dom = dw.getDocumentDOM('document');
   if( dom )
   {
		//check if the whole document is selected if so don't replace
		var theSel = dom.getSelection();			
		if(theSel && theSel[0]>-1 && theSel[1]>=theSel[0])
		{
			var bodyOffsets = dom.nodeToOffsets(dom.body) ;
			if(bodyOffsets && theSel[0]<=bodyOffsets[0] && theSel[1]>=bodyOffsets[1])
			{
				//selection contains the whole body hence insert
				dom.insertHTML(strOut, false);
				return;
			}
		}			
		dom.insertHTML(strOut, true);
   }
   return; 
   
}

