home *** CD-ROM | disk | FTP | other *** search
- //
- // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
- // ----------------------------------------------------
- //
- // Accessibility.js
- //
- // This command adds
- //
- //
- // Version 1.0
- // Added functions...
- // ----------------------------------------------------
-
-
- var globalFormItem;
- var returnTag='';
- var helpDoc = MM.HELP_objImageAccessOptions;
-
- function commandButtons() {
- return new Array(MM.BTN_OK, "setImageStr();window.close()",
- MM.BTN_Cancel, "window.close()",
- MM.BTN_Help, "displayHelp()" );
-
-
- }
-
- function isDOMRequired() {
- // Return false, indicating that this object is available in code view.
- return false;
- }
-
- function setFormItem(formItem) {
- globalFormItem = formItem;
- returnTag = globalFormItem;
- }
-
- function setImageStr()
- {
- var rtnStr='';
-
- rtnStr= globalFormItem;
-
-
- ////////////////////////////////////////////////////////////////
- // Attributes: Compose rtnStr with the attributes that have a value
- // Possible attributes are: alt and longdesc
-
-
- // if 'alt attribute' has a value, apply it to the initStr
-
- altIndexSelected = document.forms[0].alt.selectedIndex;
- altText = document.forms[0].alt.editText;
-
- if( altText == null || altIndexSelected == 0){}
- else {
-
- var dom = dw.getDocumentDOM();
- var encoding = "";
- if( dom )
- encoding = dom.getCharSet();
- if (encoding.toLowerCase() == "iso-8859-1" )
- {
- altText = dwscripts_minEntityNameEncode(altText);
- altText = entityNameEncode(altText);
- }
- else
- {
- altText = dwscripts_minEntityNameEncode(altText);
- }
-
- rtnStr= addAttribute("alt", altText, rtnStr);
- }
-
- // if 'longdesc attribute' has a value, apply it to the initStr
-
- longdescValue=document.forms[0].longdesc.value;
-
- if( (longdescValue == null) || (longdescValue == "") || (longdescValue == "http://") ){}
- else {
- rtnStr= addAttribute("longdesc", longdescValue, rtnStr);
- }
-
-
- returnTag= rtnStr;
- }
-
- function returnAccessibilityStr () {
-
- return returnTag;
- }
-
- ///////////////////////////////////////////////////////////////
- // other functions
- //////////////////////////////////////////////////////////////
- function initUI(){
- document.forms[0].alt.focus();
- }
-
- function addAttribute(tagName, tagVal, initStr){
-
- arrayElem= initStr.split(">");
- rtnStr= arrayElem[0] + " " + tagName + "=" + '\"' + tagVal + '\"' + ">" + arrayElem[1];
-
- return rtnStr;
- }
-
-
- function getImageSrc(tagStr){
-
- arrayElements= tagStr.split("src=\"");
- arrayStrings= arrayElements[1].split("\"");
- src= arrayStrings[0];
- return src;
- }
-
- function browseForURL(){
- var urlField = document.forms[0].browseBtn.value;
- var url = dw.browseForFileURL('select');
- if (url != ""){
- document.longdesc.value = url;
- document.longdesc.focus();
- }
- }
-