
<!--
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2006 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 may be covered by U.S. and Foreign Patents,
* patents in process, 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.
**************************************************************************/
-->

function isDOMRequired() { 
  // return true.  This will insert the object into the design view.
  return false;
}

function isAsset() {
	return true;
}

function objectTag(assetArgs)
{
	var bDialogState = dw.getShowDialogsOnInsert();
	

	var theMovie = '';
	var isBlogSite = false;

	if (dw.appName == "Contribute")
	{

		if (arguments.length == 0)
		{
	    		prefsAccessibilityOption = dw.getAdminEnforceAccessibilityPref();
	    		var ok = true;	
	    		var dom = dw.getDocumentDOM();
            		if(dom)
            		{
            		    if(CCWorkspaceManager.getManager(dom))
            		    { 
            		        if(CCWorkspaceManager.getManager(dom).isBlogSite())        
            		            isBlogSite = true;
            		    }
            		}

			

			if (MM.InsertFlashType == "file")

			{
				var filter = new Array(dw.loadString("insert doc dialog/pdf doc desc") + " (*.pdf)|*.pdf|");

	
				if (MM.InsertFlashType == "file")
				{
					theMovie = dw.browseForFileURL("open", "", false, "", filter, "", "", "desktop");
					if (dw.isGreaterThanMaxDependentFileSize(theMovie))
					{
						return '';
					}
				}

			}
			else if (MM.InsertFlashType == "website")
			{

				
				theMovie = dw.browseForPDFOnWebsite ();   //gsrupdate hitch 

			}
			else if (MM.InsertFlashType == "internet")
						{
			
							theMovie = dw.BrowseToInternetPDF();
							if(theMovie.length == 0)
				           		 return; // No selection made
						   
							var retval = dw.validateMediaFile(theMovie);
							if(!retval)
								return;
			
			}

		}
	}
	else
	{
		
		theMovie = dw.browseForFileURL();
	}


	

	//block double byte ot high ascii filenames
	if (dw.appName == "Contribute") 
	{
		var fileName = dwscripts.getFileName(theMovie);

		if (hasDoubleByteChar(fileName))
		{
			alert(dw.loadString("file naming/doublebyte filename error"));
			return '';
		}
		else if (hasHighAsciiChar(fileName))
		{
			alert(dw.loadString("file naming/highascii filename error"));
			return '';
		}
	}




	if (theMovie != '')
	{
		theMovie = dw.doURLEncoding(theMovie);
	}

	if (assetArgs)
	{
		theMovie = assetArgs;
	}

	if ((theMovie == '') && bDialogState)
	{
		return '';
	}


	
	var rememberPrefs = true;
	var insertMode = [ "" ];
	var retStr = '';
	dw.runCommand("DropPDF.htm",theMovie,insertMode,rememberPrefs);	
	
	
	if(insertMode[0] == 'insert')
	{
		return insertPDF(theMovie);	
	}
	else if(insertMode[0] == 'link')
	{
		
		
		//if((theMovie.indexOf("http") != -1) || (theMovie.indexOf("../") != -1) )
		{
			
			var linkText = linkname(theMovie);
			
			
			retStr = '<a href="' + theMovie + '">' + linkText + '<\a>';
			
			return retStr;
		}
		/*else
		{
			
			dw.insertLinkToDocument(MMNotes.localURLToFilePath(dw.doURLDecoding(theMovie)));
			return '';
		}*/
	}
	return '';
}


