// ***************************************************************************
//                          boxNavigationPictures.js  -  description
//                             -------------------
//    begin                : Fri Dec 9 2005
//    copyright            : (C) 2005 by Andrei Gavrila
//    email                : andrei.gavrila@gmail.com
// ***************************************************************************
//
// ***************************************************************************
// *                                                                         *
// *   This program is free software; you can redistribute it and/or modify  *
// *   it under the terms of the GNU General Public License as published by  *
// *   the Free Software Foundation; either version 2 of the License, or     *
// *   (at your option) any later version.                                   *
// *                                                                         *
// ***************************************************************************

var boxNavigationPicturesMaxItems = 20;

var boxNavigationPicturesNumber               = Array();
var boxNavigationPicturesFrameBackgroundColor = Array();
var boxNavigationPicturesFrameSpacing         = Array();

var boxNavigationPicturesFontColor            = Array();
var boxNavigationPicturesFontHColor           = Array();
var boxNavigationPicturesFontFamily           = Array();
var boxNavigationPicturesFontSize             = Array();
var boxNavigationPicturesFontBold             = Array();
var boxNavigationPicturesFontItalic           = Array();
var boxNavigationPicturesHAlign               = Array();
var boxNavigationPicturesVAlign               = Array();

function boxNavigationPictures(x, y, w, h, number, frameBackground, space, fontColor, fontHColor, fontFamily, fontSize, fontBold, fontItalic, hAlign, vAlign)
{
	if ((wmWindowPageActive != 2) && (wmWindowPageActive != 3) && (wmWindowPageActive != 4)) {
		alert(wmMessage(1703));

		return;
	}

	boxNavigationPicturesNumber[wmWindowIndex]               = number;
	boxNavigationPicturesFrameBackgroundColor[wmWindowIndex] = frameBackground;
	boxNavigationPicturesFrameSpacing[wmWindowIndex]         = space;

	boxNavigationPicturesFontColor[wmWindowIndex]            = fontColor;
	boxNavigationPicturesFontHColor[wmWindowIndex]           = fontHColor;
	boxNavigationPicturesFontFamily[wmWindowIndex]           = fontFamily;
	boxNavigationPicturesFontSize[wmWindowIndex]             = fontSize;
	boxNavigationPicturesFontBold[wmWindowIndex]             = fontBold;
	boxNavigationPicturesFontItalic[wmWindowIndex]           = fontItalic;
	boxNavigationPicturesHAlign[wmWindowIndex]               = hAlign;
	boxNavigationPicturesVAlign[wmWindowIndex]               = vAlign;

	var setup   = ' \
<div class="wmWindowSetupItem" id="boxNavigationPictures_' + wmWindowIndex + '_SetupBox_2"> \
<b>' + wmText(3600) + '</b> \
<br /> \
<br /> \
<b>' + wmText(3601) + '</b> <br /> \
<select id="wmWindow_' + wmWindowIndex + '_Setup11" class="wmSetupSelect" onChange="javascript: boxNavigationPicturesSetupNumber(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup11\', this, wmMessage(3601));" /> \
';

	for (i = 1 ; i <= boxNavigationPicturesMaxItems; i++) {
		setup += '<option value="' + i + '"';
		if (i == number)
			setup += ' selected';
		setup += '>' + i + '</option>';
	}

	setup += ' \
</select> \
<br /> \
<br /> \
<b>' + wmText(3602) + '</b> <br /> \
#<input type="text" id="wmWindow_' + wmWindowIndex + '_Setup12" class="wmSetupInputColor" size="6" value="' + boxNavigationPicturesFrameBackgroundColor[wmWindowIndex] + '" onChange="javascript: boxNavigationPicturesSetupFrameBackgroundColor(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup12\', this, wmMessage(3602));" /> \
<a href="javascript: wmColorPicker(\'wmWindow_' + wmWindowIndex + '_Setup12\', mouse_x, mouse_y, \'boxNavigationPicturesSetupFrameBackgroundColor(' + wmWindowIndex + ', src);\');"><img border="0" width="15" height="15" src="images/colorpicker.gif" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup12_0\', this, wmMessage(10000));" /></a> \
<br /> \
<b>' + wmText(3603) + '</b> <br /> \
<input type="text" id="wmWindow_' + wmWindowIndex + '_Setup13" class="wmSetupInputWidth" size="2" value="' + boxNavigationPicturesFrameSpacing[wmWindowIndex] + '" onChange="javascript: boxNavigationPicturesSetupFrameSpacing(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup13\', this, wmMessage(3603));" /> ' + wmText(0) + ' \
<br /> \
</div> \
<div class="wmWindowSetupItem" id="boxNavigationPictures_' + wmWindowIndex + '_SetupBox_3"> \
<b>' + wmText(3604) + '</b> \
<br /> \
<br /> \
<b>' + wmText(3605) + '</b> <br /> \
#<input type="text" id="wmWindow_' + wmWindowIndex + '_Setup14" class="wmSetupInputColor" size="6" value="' + boxNavigationPicturesFontColor[wmWindowIndex] + '" onChange="javascript: boxNavigationPicturesSetupFontColor(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup14\', this, wmMessage(3604));" /> \
<a href="javascript: wmColorPicker(\'wmWindow_' + wmWindowIndex + '_Setup14\', mouse_x, mouse_y, \'boxNavigationPicturesSetupFontColor(' + wmWindowIndex + ', src);\');"><img border="0" width="15" height="15" src="images/colorpicker.gif" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup14_0\', this, wmMessage(10000));" /></a> \
<br /> \
<b>' + wmText(3606) + '</b> <br /> \
#<input type="text" id="wmWindow_' + wmWindowIndex + '_Setup15" class="wmSetupInputColor" size="6" value="' + boxNavigationPicturesFontHColor[wmWindowIndex] + '" onChange="javascript: boxNavigationPicturesSetupFontHColor(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup15\', this, wmMessage(3605));" /> \
<a href="javascript: wmColorPicker(\'wmWindow_' + wmWindowIndex + '_Setup15\', mouse_x, mouse_y, \'boxNavigationPicturesSetupFontHColor(' + wmWindowIndex + ', src);\');"><img border="0" width="15" height="15" src="images/colorpicker.gif" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup15_0\', this, wmMessage(10000));" /></a> \
<br /> \
<br /> \
<b>' + wmText(3607) + '</b> <br /> \
<input type="text" id="wmWindow_' + wmWindowIndex + '_Setup16" class="wmSetupInputFont" size="12" value="' + boxNavigationPicturesFontFamily[wmWindowIndex] + '" onChange="javascript: boxNavigationPicturesSetupFontFamily(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup16\', this, wmMessage(3606));" /> \
<br /> \
<b>' + wmText(3608) + '</b> <br /> \
<input type="text" id="wmWindow_' + wmWindowIndex + '_Setup17" class="wmSetupInputSize" size="2" value="' + boxNavigationPicturesFontSize[wmWindowIndex] + '" onChange="javascript: boxNavigationPicturesSetupFontSize(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup17\', this, wmMessage(3607));" /> ' + wmText(0) + ' \
<br /> \
<b>' + wmText(3609) + '</b> <br /> \
' + wmText(1) + ' <input type="checkbox" id="wmWindow_' + wmWindowIndex + '_Setup18" ' + (boxNavigationPicturesFontBold[wmWindowIndex] == 1 ? 'checked' : '') + ' class="wmSetupInputCheckbox" onChange="javascript: boxNavigationPicturesSetupFontBold(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup18\', this, wmMessage(3608));" /> \
<br /> \
' + wmText(2) + ' <input type="checkbox" id="wmWindow_' + wmWindowIndex + '_Setup19" ' + (boxNavigationPicturesFontItalic[wmWindowIndex] == 1 ? 'checked' : '') + ' class="wmSetupInputCheckbox" onChange="javascript: boxNavigationPicturesSetupFontItalic(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup19\', this, wmMessage(3609));" /> \
<br /> \
<br /> \
<b>' + wmText(3610) + '</b> <br /> \
<select id="wmWindow_' + wmWindowIndex + '_Setup20" class="wmSetupSelect" onChange="javascript: boxNavigationPicturesSetupHAlign(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup20\', this, wmMessage(3610));" /> \
';

	if (boxNavigationPicturesHAlign[wmWindowIndex] == 'left')
		setup += '<option value="left" selected>' + wmText(3) + '</option>';
	else
		setup += '<option value="left">' + wmText(3) + '</option>';

	if (boxNavigationPicturesHAlign[wmWindowIndex] == 'center')
		setup += '<option value="center" selected>' + wmText(4) + '</option>';
	else
		setup += '<option value="center">' + wmText(4) + '</option>';

	if (boxNavigationPicturesHAlign[wmWindowIndex] == 'right')
		setup += '<option value="right" selected>' + wmText(5) + '</option>';
	else
		setup += '<option value="right">' + wmText(5) + '</option>';

        setup += ' \
</select> \
<br /> \
<b>' + wmText(3611) + '</b> <br /> \
<select id="wmWindow_' + wmWindowIndex + '_Setup21" class="wmSetupSelect" onChange="javascript: boxNavigationPicturesSetupVAlign(' + wmWindowIndex + ', this.value);" onMouseMove = "javascript: wmToolTipQuick(\'wmWindow_' + wmWindowIndex + '_Setup21\', this, wmMessage(3611));" /> \
';

	if (boxNavigationPicturesVAlign[wmWindowIndex] == 'top')
		setup += '<option value="top" selected>' + wmText(6) + '</option>';
	else
		setup += '<option value="top">' + wmText(6) + '</option>';

	if (boxNavigationPicturesVAlign[wmWindowIndex] == 'bottom')
		setup += '<option value="bottom" selected>' + wmText(8) + '</option>';
	else
		setup += '<option value="bottom">' + wmText(8) + '</option>';

        setup += ' \
</select> \
<br /> \
</div> \
';
	var content = '';

	var headers = Array();

	headers[0] = '';
	headers[1] = 'boxNavigationPictures_' + wmWindowIndex + '_SetupBox_2';
	headers[2] = 'boxNavigationPictures_' + wmWindowIndex + '_SetupBox_3';

	wmWindow(x, y, w, h, 'navigationPictures', setup, content, headers);

	boxNavigationPicturesGenerate(wmWindowIndex - 1);
}

function boxNavigationPicturesGenerate(index)
{
	var content = '';

	if (boxNavigationPicturesVAlign[index] == 'top') {
		content += '<div style="text-align: ' +  boxNavigationPicturesHAlign[index] + ';"><a href="#" \
style="color: #' + boxNavigationPicturesFontColor[index] + '; font-family: ' + boxNavigationPicturesFontFamily[index] + '; font-size: ' + boxNavigationPicturesFontSize[index] + 'px; text-decoration: none;';

		if (boxNavigationPicturesFontBold[index] == 1)
			content += ' font-weight: bold;';
		if (boxNavigationPicturesFontItalic[index] == 1)
			content += ' font-style: italic;';

		content += ' \
" \
onMouseOver = "this.style.textDecoration = \'underline\'; this.style.color = \'#' + boxNavigationPicturesFontHColor[index] + '\';" \
onMouseOut  = "this.style.textDecoration = \'none\'; this.style.color = \'#' + boxNavigationPicturesFontColor[index] + '\';" \
>&lt; &lt; prev</a> <a href="#" \
style="color: #' + boxNavigationPicturesFontColor[index] + '; font-family: ' + boxNavigationPicturesFontFamily[index] + '; font-size: ' + boxNavigationPicturesFontSize[index] + 'px; text-decoration: none;';

		if (boxNavigationPicturesFontBold[index] == 1)
			content += ' font-weight: bold;';
		if (boxNavigationPicturesFontItalic[index] == 1)
			content += ' font-style: italic;';

		content += ' \
" \
onMouseOver = "this.style.textDecoration = \'underline\'; this.style.color = \'#' + boxNavigationPicturesFontHColor[index] + '\';" \
onMouseOut  = "this.style.textDecoration = \'none\'; this.style.color = \'#' + boxNavigationPicturesFontColor[index] + '\';" \
>next &gt; &gt;</a></div>';
	}

	for (i = 0; i < boxNavigationPicturesNumber[index]; i++)
		content += ' \
<div class="boxNavigationPictures_Picture" style="margin: ' + boxNavigationPicturesFrameSpacing[index] + 'px;"> \
<table width="100" height="100" cellspacing="0" cellpadding="0" border="0"> \
<tr> \
<td valign="middle" align="center" bgcolor="#' + boxNavigationPicturesFrameBackgroundColor[index] + '"> \
<img src="images/pictures/navigation/' + i + '.jpg" /> \
</td> \
</tr> \
</table> \
</div> \
';

	if (boxNavigationPicturesVAlign[index] == 'bottom') {
		content += '<div style="clear: both;"></div><div style="text-align: ' +  boxNavigationPicturesHAlign[index] + ';"><a href="#" \
style="color: #' + boxNavigationPicturesFontColor[index] + '; font-family: ' + boxNavigationPicturesFontFamily[index] + '; font-size: ' + boxNavigationPicturesFontSize[index] + 'px; text-decoration: none;';

		if (boxNavigationPicturesFontBold[index] == 1)
			content += ' font-weight: bold;';
		if (boxNavigationPicturesFontItalic[index] == 1)
			content += ' font-style: italic;';

		content += ' \
" \
onMouseOver = "this.style.textDecoration = \'underline\'; this.style.color = \'#' + boxNavigationPicturesFontHColor[index] + '\';" \
onMouseOut  = "this.style.textDecoration = \'none\'; this.style.color = \'#' + boxNavigationPicturesFontColor[index] + '\';" \
>&lt; &lt; prev</a> <a href="#" \
style="color: #' + boxNavigationPicturesFontColor[index] + '; font-family: ' + boxNavigationPicturesFontFamily[index] + '; font-size: ' + boxNavigationPicturesFontSize[index] + 'px; text-decoration: none;';

		if (boxNavigationPicturesFontBold[index] == 1)
			content += ' font-weight: bold;';
		if (boxNavigationPicturesFontItalic[index] == 1)
			content += ' font-style: italic;';

		content += ' \
" \
onMouseOver = "this.style.textDecoration = \'underline\'; this.style.color = \'#' + boxNavigationPicturesFontHColor[index] + '\';" \
onMouseOut  = "this.style.textDecoration = \'none\'; this.style.color = \'#' + boxNavigationPicturesFontColor[index] + '\';" \
>next &gt; &gt;</a></div>';
	}

	wmGetElementById('wmWindow_' + index + '_Content').innerHTML = content;
}

function boxNavigationPicturesSetupNumber(index, src)
{
	boxNavigationPicturesNumber[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupFrameBackgroundColor(index, src)
{
	boxNavigationPicturesFrameBackgroundColor[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupFrameSpacing(index, src)
{
	boxNavigationPicturesFrameSpacing[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupFontColor(index, src)
{
	boxNavigationPicturesFontColor[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupFontHColor(index, src)
{
	boxNavigationPicturesFontHColor[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupFontFamily(index, src)
{
	boxNavigationPicturesFontFamily[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupFontSize(index, src)
{
	boxNavigationPicturesFontSize[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupFontBold(index, src)
{
	boxNavigationPicturesFontBold[index] = (boxNavigationPicturesFontBold[index] == 0 ? 1 : 0);

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupFontItalic(index, src)
{
	boxNavigationPicturesFontItalic[index] = (boxNavigationPicturesFontItalic[index] == 0 ? 1 : 0);

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupHAlign(index, src)
{
	boxNavigationPicturesHAlign[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSetupVAlign(index, src)
{
	boxNavigationPicturesVAlign[index] = src;

	wmWindowSaved = false;

	boxNavigationPicturesGenerate(index);
}

function boxNavigationPicturesSave(index)
{
	var content = '';

	content += '<input type="hidden" name="box_' + index + '_picturesNumber"                 value="' + escape(boxNavigationPicturesNumber[index])               + '" />\n';

	content += '<input type="hidden" name="box_' + index + '_picturesFrameBackgroundColor"   value="' + escape(boxNavigationPicturesFrameBackgroundColor[index]) + '" />\n';
	content += '<input type="hidden" name="box_' + index + '_picturesFrameSpacing"           value="' + escape(boxNavigationPicturesFrameSpacing[index])         + '" />\n';

	content += '<input type="hidden" name="box_' + index + '_linkColor"      value="' + escape(boxNavigationPicturesFontColor[index])  + '" />\n';
	content += '<input type="hidden" name="box_' + index + '_linkHColor"     value="' + escape(boxNavigationPicturesFontHColor[index]) + '" />\n';
	content += '<input type="hidden" name="box_' + index + '_linkFontFamily" value="' + escape(boxNavigationPicturesFontFamily[index]) + '" />\n';
	content += '<input type="hidden" name="box_' + index + '_linkFontSize"   value="' + escape(boxNavigationPicturesFontSize[index])   + '" />\n';
	content += '<input type="hidden" name="box_' + index + '_linkFontBold"   value="' + escape(boxNavigationPicturesFontBold[index])   + '" />\n';
	content += '<input type="hidden" name="box_' + index + '_linkFontItalic" value="' + escape(boxNavigationPicturesFontItalic[index]) + '" />\n';

	content += '<input type="hidden" name="box_' + index + '_linkHAlign" value="' + escape(boxNavigationPicturesHAlign[index]) + '" />\n';
	content += '<input type="hidden" name="box_' + index + '_linkVAlign" value="' + escape(boxNavigationPicturesVAlign[index]) + '" />\n';

	return content;
}

