//--not for batch--
// Copyright (c) 2000 Macromedia. All rights reserved.

// Run the webLayer function
webLayer = GetWebLayer();

var message;
var tmp  = (Files.getLanguageDirectory()).split("/");
var lang = ((tmp[tmp.length-1]).substr(0,2)).toLowerCase();

switch (lang)
{
	// German
	case "de":
	case "ge":
		message = "Es wurden keine Segmente oder Hotspots mit leeren ALT-Text gefunden.";
		break;

	// French
	case "fr":
		message = "Aucune découpe ou référence comportant des texte ALT vides n’a été trouvée.";
		break;

	// Italian
	case "it":
		message = "Non sono stati reperiti punti attivi o porzioni con testo Alt vuoti.";
		break;

	// Spanish
	case "es":
	case "sp":
		message = "No se han encontrado divisiones ni zonas interactivas con texto ALT vacíos.";
		break;

	// Japanese
	case "ja":
		message = "空の ALT テキストを含んだスライスまたはホットスポットが見つかりません。";
		break;

	// Chinese (Simplified)
	case "si":
		message = "未找到具有空白 ALT 文字的切片或热点。";
		break;

	// Chinese (Traditional)
	case "tr":
		message = "找不到具有空白替代文字的分割或連結區。";
		break;

	// Korean
	case "ko":
		message = "빈 대체 텍스트를 가진 슬라이스 또는 핫스팟을 찾을 수 없습니다.";
		break;

	// English
	case "en":
	default:
		message = "No slices or hotspots with blank ALT text were found.";
		break;
}

// Check to make that the webLayer has objects on it
if(webLayer != null) {
	// Check to see if there are blank alt tags
	if(!ContainsBlankWebObjects(webLayer)) {
		alert(message);
	}
	else {
		// Create an array to hold the new selection.
		var newSelection = new Array();

		// Put the blank alt tags into the array
		for (i in theWebLayer.elements) {
			oldAltTag = theWebLayer.elements[i].altText;
				// check for both null and the empty string ""
				if(oldAltTag == null || oldAltTag == "")
					newSelection[newSelection.length] = theWebLayer.elements[i];
		}

		// Have Fireworks select the objects in the new array
		fw.selection = newSelection;
	}
}


// -----------------------------------------------------------
function GetWebLayer()
{
	theWebLayer = null;

	// Get the layers list
	layers = fw.getDocumentDOM().layers;
	for (layerIndex in layers) {
		if (layers[layerIndex].layerType == "web"){
			theWebLayer = fw.getDocumentDOM().frames[0].layers[layerIndex];

			break;
		}
	}

	return theWebLayer;
}

// -----------------------------------------------------------
function ContainsBlankWebObjects(aLayer) {

	if(aLayer != null) {

		for (i in aLayer.elements) {
			// Firworks sometimes returns NULL, and sometimes the empty string ""
			if(aLayer.elements[i].altText == null || aLayer.elements[i].altText == "")
				return(true);
		}
	}

	// No blank objects found
	return(false);
}

// -----------------------------------------------------------