/* *************************************************************************
*
*  File: common.js
*  Purpose: Commonly used functions
*
************************************************************************* */

/* *************************************************************************
*
*  Browser detection
*
************************************************************************* */

var agt = navigator.userAgent.toLowerCase ();
var is_major = parseInt (navigator.appVersion);
var is_minor = parseFloat (navigator.appVersion);

var is_safari = (agt.indexOf ('safari') != -1);

var is_nav  = ((agt.indexOf ('mozilla') != -1) && (agt.indexOf ('spoofer') == -1) && (agt.indexOf ('compatible') == -1) && (agt.indexOf ('opera') == -1) && (agt.indexOf ('webtv') == -1) && (agt.indexOf ('hotjava') == -1) && (agt.indexOf ('safari') == -1));

var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly = (is_nav && ((agt.indexOf (";nav") != -1) || (agt.indexOf ("; nav") != -1)));
var is_nav6 = (is_nav && (is_major == 5) && (agt.indexOf("netscape") != -1) && (agt.indexOf ("netscape/7") == -1));
var is_nav6up = ((is_nav && (is_major >= 5)) || (is_nav && (agt.indexOf ('netscape/7') != -1)));
var is_gecko = (agt.indexOf ('gecko') != -1);

var is_firefox = (agt.indexOf ('firefox') != -1);

var is_ie     = ((agt.indexOf ("msie") != -1) && (agt.indexOf ("opera") == -1) && (agt.indexOf ("safari") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf ("msie 4")!=-1) );
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf ("msie 5.0") != -1));
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf ("msie 5.5") != -1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf ("msie 6.") != -1));
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5 && !is_safari);

var is_opera = (agt.indexOf ("opera") != -1);
var is_opera2 = (agt.indexOf ("opera 2") != -1 || agt.indexOf ("opera/2") != -1);
var is_opera3 = (agt.indexOf ("opera 3") != -1 || agt.indexOf("opera/3") != -1);
var is_opera4 = (agt.indexOf ("opera 4") != -1 || agt.indexOf("opera/4") != -1);
var is_opera5 = (agt.indexOf ("opera 5") != -1 || agt.indexOf("opera/5") != -1);
var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5);
var is_opera7 = ((agt.indexOf ("opera/7.") != -1) || (agt.indexOf ("opera 7.") != -1));
var is_opera70 = ((agt.indexOf ("opera/7.0") != -1) || (agt.indexOf ("opera 7.0") != -1));
var is_opera7up = (((agt.indexOf ("opera/7.") != -1) || (agt.indexOf ("opera 7.") != -1)) && !((agt.indexOf ("opera/7.0") != -1) || (agt.indexOf ("opera 7.0") != -1)));
var is_opera8 = ((agt.indexOf ("opera/8.") != -1) || (agt.indexOf ("opera 8.") != -1));

var dom = ((document.getElementById) ? true : false);

var pageType = '';
var isTimerMenuSub = false;
var timerMenuSubID = null;

var pathRoot = '';

var urlRoot = '';
urlRoot = document.location.href.split ('/');
urlRoot.length--;
urlRoot = urlRoot.join ('/') + '/';

var imgCatRoot = '/webroot/delivery/img/content/catalog/';

/* *************************************************************************
*
*  function setInit (_pageType)
*
************************************************************************* */
 
function setInit (_pageType)
{
	pageType = _pageType;

	switch (pageType)
	{
		case 'index':
			break;

		case 'inner':
			break;

		case 'popup':
			break;

		default:
			break;	
	}

	setInitHeight ();
}

/* *************************************************************************
*
*  function setInitBrowsers ()
*
************************************************************************* */
 
function setInitBrowsers ()
{
	if (is_opera)
	{
		document.body.className = 'browserOther browserOpera ' + document.body.className;

		if (is_opera70)
		{
			document.body.className = 'browserOpera70 ' + document.body.className;
		}

		if (is_opera7up)
		{
			document.body.className = 'browserOpera7Up ' + document.body.className;
		}
	}
	else if (is_nav && !is_firefox)
	{
		document.body.className = 'browserOther browserNetscape ' + document.body.className;
	}
	else if (is_firefox)
	{
		document.body.className = 'browserOther browserFirefox ' + document.body.className;
	}
	else if (is_ie)
	{
		document.body.className = 'browserIE ' + document.body.className;

		if (!is_ie6 && !is_ie6up)
		{
			document.body.className = 'browserIE5x ' + document.body.className;

			if (is_ie5)
			{
				document.body.className = 'browserIE50 ' + document.body.className;
			}
		}
	}

	if (is_nav)
	{
		document.body.className = 'browserOther browserGecko ' + document.body.className;
	}
}

/* *************************************************************************
*
*  function setInitHeight ()
*
************************************************************************* */
 
function setInitHeight ()
{
	if (!is_ie)
	{
		if (document.body.offsetHeight < window.innerHeight)
		{
			document.body.style.height = window.innerHeight - 15 + 'px';
		}
	}
}

/* *************************************************************************
*
*  function setInitSearchResults ()
*
************************************************************************* */
 
function setInitSearchResults ()
{

}

/* *************************************************************************
*
*  function getObj (_idElement, _objParent)
*
************************************************************************* */
 
function getObj (_idElement, _objParent) 
{
	var objElement = null;  

	if (!_objParent)
	{
		_objParent = document;
	}

	if (document.getElementById)
	{
		objElement = _objParent.getElementById (_idElement); 
	}
	
	return objElement;
}

/* *************************************************************************
*
*  function getX (_objElement)
*
************************************************************************* */

function getX (_objElement)
{
	var posX = 0;

	do
	{
		posX += _objElement.offsetLeft;
	}
	while ((_objElement = _objElement.offsetParent) != null);

	return posX;
}

/* *************************************************************************
*
*  function getY (_objElement)
*
************************************************************************* */

function getY (_objElement)
{
	var posY = 0;

	do
	{
		posY += _objElement.offsetTop;
	}
	while ((_objElement = _objElement.offsetParent) != null);

	return posY;
}

/* *************************************************************************
*
*  function getHeight (_objElement)
*
************************************************************************* */

function getHeight (_objElement)
{
	var posY = 0;

	if (typeof (_objElement) == 'object')
	{
		posY = _objElement.offsetHeight;
	}
	else
	{
		posY = document.getElementById (_objElement).clientHeight;
	}

	return posY;
}

/* *************************************************************************
*
*  function gotoURL (_url)
*
************************************************************************* */

function gotoURL (_url)
{
	if (_url)
	{
		document.location.href = _url;
	}
}

/* *************************************************************************
*
*  function makeTrim (_str)
*
************************************************************************* */

function makeTrim (_str)
{
	var strTrimmed = _str;

	while (strTrimmed.indexOf ('  ') != -1)
	{
		strTrimmed = strTrimmed.replace (/  /ig, ' ');
	}

	if (strTrimmed[0] == ' ')
	{
		strTrimmed = strTrimmed.substr (1, (strTrimmed.length - 1));
	}

	if (strTrimmed[strTrimmed.length - 1] == ' ')
	{
		strTrimmed = strTrimmed.substr (0, (strTrimmed.length - 1));
	}

	return strTrimmed;
}

/* *************************************************************************
*
*  function addClassName (_classNameSet, _newClassName)
*
************************************************************************* */

function addClassName (_classNameSet, _newClassName)
{
	var newClassNameSet = '';

	if (_classNameSet.length > 0)
	{
		if (_classNameSet.indexOf (_newClassName) == -1)
		{
			newClassNameSet = _classNameSet + ' ' + _newClassName;
		}
		else
		{
			newClassNameSet = _classNameSet;
		}
	}
	else
	{
		newClassNameSet = _newClassName;
	}

	newClassNameSet = makeTrim (newClassNameSet);

	return newClassNameSet;
}

/* *************************************************************************
*
*  function replaceClassName (_classNameSet, _oldClassName, _newClassName)
*
************************************************************************* */

function replaceClassName (_classNameSet, _oldClassName, _newClassName)
{
	var newClassNameSet = '';

	newClassNameSet = _classNameSet.replace (new RegExp (_oldClassName, 'ig'), _newClassName);
	newClassNameSet = makeTrim (newClassNameSet);

	return newClassNameSet;
}

/* *************************************************************************
*
*  function addStyleSheet (_URL)
*
************************************************************************* */

function addStyleSheet (_URL)
{
	var strStyleSheet = '@import url(' + _URL + ');',
		objStyleSheet = null;

	if (document.createStyleSheet)
	{
		document.createStyleSheet (_URL);
	}
	else
	{
		objStyleSheet = document.createElement ('link');
		objStyleSheet.rel = 'stylesheet';
		objStyleSheet.type = 'text/css';
		objStyleSheet.href = _URL;
//		objStyleSheet.href = 'data:text/css,' + escape (strStyleSheet);

		document.getElementsByTagName ('head')[0].appendChild (objStyleSheet);
	}
}

/* *************************************************************************
*
*  function openPopup (_url, _name, _title, _width, _height, _posX, _posY)
*
************************************************************************* */

function openPopup (_url, _name, _title, _width, _height, _posX, _posY)
{
	var strParams = 0,
		idWindow = null;

	_posX = Math.round ((window.screen.availWidth / 2) - (_width / 2));

	if (window.screen.availHeight - 24 < _height)
	{
		_posY = 0;
		_width += 17;
		_height = window.screen.availHeight - 24;
	}
	else
	{
		_posY = Math.round ((window.screen.availHeight / 2) - (_height / 2 + 12));
	}

	strParams = "scrollbars=yes,status=yes,resizable=1,width=" + _width + ",height=" + _height + ",left=" + _posX + ",top=" + _posY;

	idWindow = window.open (_url, _name, strParams);

	return idWindow;
}

/* *************************************************************************
*
*  function isMouseOver (_obj, _event)
*
************************************************************************* */

function isMouseOver (_obj, _event)
{
	var toElement = null;

	if (_event == null)
	{
		_event = window.event;
	}

	toElement = (is_ie ? _event.toElement : _event.target);

	return (isChild (_obj, toElement) == null ? false : true);
}

/* *************************************************************************
*
*  function getChildren (_obj)
*
************************************************************************* */

function getChildren (_obj)
{
	var arrChildren = new Array ();

	for (var indexChildren = 0; indexChildren < _obj.childNodes.length; indexChildren++)
	{
		if (_obj.childNodes[indexChildren].innerHTML != null)
		{
			arrChildren[arrChildren.length] = _obj.childNodes[indexChildren];
		}
	}

	return arrChildren;
}

/* *************************************************************************
*
*  function isChild (_child, _parent)
*
************************************************************************* */

function isChild (_child, _parent)
{
	do
	{
		if (_child != _parent)
		{
			_child = _child.parentNode;
		}
		else
		{
			setID (_child);

			return _child;
		}
	} while (_child != null);

	return null;
}

/* *************************************************************************
*
*  function setID (_obj)
*
************************************************************************* */

function setID (_obj)
{
	if (!_obj.id && _obj)
	{
		_obj.id = _obj.uniqueID;
	}

	return _obj.id;
}

/* *************************************************************************
*
*  function clearInputDefault (_this, _default)
*
************************************************************************* */

function clearInputDefault (_this, _default)
{
	if (_this.value == _default)
	{
		_this.value = '';
	}
}

/* *************************************************************************
*
*  function restoreInputDefault (_this, _default)
*
************************************************************************* */

function restoreInputDefault (_this, _default)
{
	if (_this.value == '')
	{
		_this.value = _default;
	}
}

/* *************************************************************************
*
*  function setAutoFocus (_idInput)
*
************************************************************************* */

function setAutoFocus (_idInput)
{
	var objInput = (_idInput != null ? getObj (_idInput) : null),
		objInputTemp = null;

/*	if (objInput == null)
	{
		for (var indexForms = 0; indexForms < document.forms.length; indexForms++)
		{
			for (var indexInput = 0; indexInput < document.forms[indexForms].elements.length; indexInput++)
			{
				objInputTemp = document.forms[indexForms].elements[indexInput];

				if (objInputTemp.type != 'checkbox' && objInputTemp.type != 'radio' && objInputTemp.type != 'select' && objInputTemp.type != 'hidden' && objInputTemp.type != 'button' && objInputTemp.type != 'image' && objInputTemp.type != 'submit')
				{
					objInput = objInputTemp;

					break;
				}
			}

			if (objInput != null)
			{
				break;
			}
		}
	}*/

	if (objInput != null)
	{
		objInput.focus ();
	}
}

/* *************************************************************************
*
*  function getElementCollectionByName(_name, _tags)
*
************************************************************************* */
 
function getElementCollectionByName (_name, _tags)
{
	var count = 0,
		objCollection = new Array (),
		tagsCollection = new Array (),
		namesCollection;

	if (_tags != null)
	{
		tagsCollection = _tags.split (',');
	}
	else
	{
		return null;
	}

	for (var indexTags = 0; indexTags < tagsCollection.length; indexTags++)
	{
		namesCollection = document.getElementsByTagName (tagsCollection[indexTags]);

		for (var indexNames = 0; indexNames < namesCollection.length; indexNames++)
		{
			if (namesCollection[indexNames].name == _name)
			{
				objCollection[count++] = namesCollection[indexNames];
			}
		}
	}

	if (count > 0)
	{
		return objCollection;
	}

	return null;
}

/* *************************************************************************
*
*  function getFormElementCollectionByName(_name, _tags)
*
************************************************************************* */

function getFormElementCollectionByName (_name)
{
	var count = 0,
		objCollection = new Array ();

	for (var indexForms = 0; indexForms < document.forms.length; indexForms++)
	{
		for (var indexInput = 0; indexInput < document.forms[indexForms].elements.length; indexInput++)
		{
			if (document.forms[indexForms].elements[indexInput].name == _name)
			{
				objCollection[count++] = document.forms[indexForms].elements[indexInput];
			}
		}
	}

	if (count > 0)
	{
		return objCollection;
	}

	return null;
}

/* *************************************************************************
*
*  function setCheckboxes (_this, _nameGroup)
*
************************************************************************* */

function setCheckboxes (_this, _nameGroup)
{
	var elementsList = new Array ();

	elementsList = getFormElementCollectionByName (_nameGroup);

	for (var indexCheckboxes = 0; indexCheckboxes < elementsList.length; indexCheckboxes++)
	{
		elementsList[indexCheckboxes].checked = (_this.checked ? true : false);
	}
}

/* *************************************************************************
*
*  function loadSelectbox (_objSelectboxID, _arrValues)
*
************************************************************************* */

function loadSelectbox (_objSelectbox, _arrValues)
{
	_objSelectbox.options.length = 0;

	for (var indexValues = 0; indexValues < _arrValues.length; indexValues++)
	{
		_objSelectbox.options[indexValues] = new Option (_arrValues[indexValues][1], _arrValues[indexValues][0]);
	}
}

/* *************************************************************************
*
*  function closeWindow ()
*
************************************************************************* */

function closeWindow ()
{
	window.close ();
}

/* *************************************************************************
*
*  function switchFormType (_idGroupActive, _listIDGroupInactive, _idGroupInputFirst)
*
************************************************************************* */

function switchFormType (_idGroupActive, _listIDGroupInactive, _idGroupInputFirst)
{
	var arrIDGroupInactive = new Array (),
		objGroupActive = getObj (_idGroupActive),
		objGroupInputFirst = null;

	if (_listIDGroupInactive != null)
	{
		arrIDGroupInactive = _listIDGroupInactive.split (',');
	}

	for (var indexGroup = 0; indexGroup < arrIDGroupInactive.length; indexGroup++)
	{
		getObj (arrIDGroupInactive[indexGroup]).style.display = 'none';
	}

	objGroupActive.style.display = '';

	if (_idGroupInputFirst != null)
	{
		objGroupInputFirst = getObj (_idGroupInputFirst);

		objGroupInputFirst.focus ();
	}
}

/* *************************************************************************
*
*  function switchFormTypeQuick (_listIDGroupActive, _listIDGroupInactive, _idGroupInputFirst)
*
************************************************************************* */

function switchFormTypeQuick (_listIDGroupActive, _listIDGroupInactive, _idGroupInputFirst)
{
	var arrIDGroupActive = new Array (),
		arrIDGroupInactive = new Array (),
		objGroupInputFirst = null;

	if (_listIDGroupActive != null && _listIDGroupActive != '')
	{
		arrIDGroupActive = _listIDGroupActive.split (',');

		for (var indexGroup = 0; indexGroup < arrIDGroupActive.length; indexGroup++)
		{
			getObj (arrIDGroupActive[indexGroup]).style.display = '';
		}
	}

	if (_listIDGroupInactive != null && _listIDGroupInactive != '')
	{
		arrIDGroupInactive = _listIDGroupInactive.split (',');

		for (indexGroup = 0; indexGroup < arrIDGroupInactive.length; indexGroup++)
		{
			getObj (arrIDGroupInactive[indexGroup]).style.display = 'none';
		}
	}

	if (_idGroupInputFirst != null)
	{
		objGroupInputFirst = getObj (_idGroupInputFirst);

		objGroupInputFirst.focus ();
	}
}

/* *************************************************************************
*
*  function highlightRow (_this)
*
************************************************************************* */

function highlightRow (_this)
{
	if (_this.className.indexOf ('rwFocus') == -1)
	{
		if (_this.className == '')
		{
			_this.className = 'rwFocus';
		}
		else
		{
			_this.className = _this.className + ' rwFocus';
		}
	}
}

/* *************************************************************************
*
*  function unhighlightRow (_this)
*
************************************************************************* */

function unhighlightRow (_this)
{
	if (_this.className.indexOf ('rwFocus') != -1)
	{
		if (_this.className == 'rwFocus')
		{
			_this.className = '';
		}
		else
		{
			_this.className = _this.className.replace (/ rwFocus/ig, '');
		}
	}
}

/* *************************************************************************
*
*  function loadListContent (_this, _idListRecipient)
*
************************************************************************* */

function loadListContent (_this, _objListRecipientID, _objFrameID)
{
	var strListContent = '';

	getListContent (_objFrameID, _this.value, _objListRecipientID);
}

/* *************************************************************************
*
*  function getListContent (_objFrameID, _loaderURL)
*
************************************************************************* */
 
function getListContent (_objFrameID, _loaderURL, _objListRecipientID)
{
	var objFrame = getObj (_objFrameID);

	window.frames[_objFrameID].window.location = _loaderURL;
}

/* *************************************************************************
*
*  function loadPhoto (_arrPhoto, _objContainerID, _objThumbName, _direction, _indexPhoto)
*
************************************************************************* */

function loadPhoto (_arrPhoto, _objContainerID, _objCommentContainerID, _objThumbName, _direction, _indexPhoto)
{
	var objContainer = getObj (_objContainerID),
		objCommentContainer = getObj (_objCommentContainerID);

	switch (_direction)
	{
		case -1:
			if (objContainer.name > 0)
			{
				_indexPhoto = parseInt (objContainer.name) - 1;
			}
			break;

		case 1:
			if (objContainer.name < (_arrPhoto.length - 1))
			{
				_indexPhoto = parseInt (objContainer.name) + 1;
			}
			break;

		case 0:
		default:
			break;
	}

	if (_indexPhoto != null)
	{
		objContainer.src = _arrPhoto[_indexPhoto][0];
		objContainer.name = _indexPhoto;
		objCommentContainer.innerHTML = _arrPhoto[_indexPhoto][2];

		setPhotoThumb (_arrPhoto, _objThumbName, _direction, _indexPhoto)
	}
}

/* *************************************************************************
*
*  function setPhotoThumb (_arrPhotoThumb, _objThumbName, _direction, _idThumb)
*
************************************************************************* */
 
function setPhotoThumb (_arrPhotoThumb, _objThumbName, _direction, _idThumb)
{
	var arrThumbContainer = new Array ();

	arrThumbContainer = getElementCollectionByName (_objThumbName, 'img');

	for (var indexThumb = 0; indexThumb < arrThumbContainer.length; indexThumb++)
	{
		arrThumbContainer[indexThumb].parentNode.parentNode.className = arrThumbContainer[indexThumb].parentNode.parentNode.className.replace (/textIllustrationThis/ig, '');
	}

	arrThumbContainer[_idThumb].parentNode.parentNode.className += ' textIllustrationThis';
}

/* *************************************************************************
*
*  function scrollPhotoThumb (_arrPhotoThumb, _objThumbName, _direction, _indexPhoto)
*
************************************************************************* */
 
function scrollPhotoThumb (_arrPhotoThumb, _objThumbName, _direction, _indexPhoto)
{
	var arrThumbContainer = new Array (),
		indexPhotoStart = -1,
		maxList = 4;

	arrThumbContainer = getElementCollectionByName (_objThumbName, 'img');

	for (var indexThumb = 0; indexThumb < arrThumbContainer.length; indexThumb++)
	{
		if ((arrThumbContainer[indexThumb].parentNode.parentNode.style.display != 'none') && (indexPhotoStart == -1))
		{
			indexPhotoStart = indexThumb;
		}

		arrThumbContainer[indexThumb].parentNode.parentNode.style.display = 'none';
		arrThumbContainer[indexThumb].parentNode.parentNode.className = arrThumbContainer[indexThumb].parentNode.parentNode.className.replace (/ textIllustrationLast/ig, '');
	}

	switch (_direction)
	{
		case -1:
			if (indexPhotoStart > 0)
			{
				indexPhotoStart = indexPhotoStart - 1;
			}
			break;

		case 1:
			if (indexPhotoStart < (arrThumbContainer.length - maxList))
			{
				indexPhotoStart = indexPhotoStart + 1;
			}
			break;

		case 0:
		default:
			break;
	}

	for (indexThumb = indexPhotoStart; indexThumb < (indexPhotoStart + maxList); indexThumb++)
	{
		arrThumbContainer[indexThumb].parentNode.parentNode.style.display = '';
	}

	arrThumbContainer[indexThumb - 1].parentNode.parentNode.className += ' textIllustrationLast';
}

/* *************************************************************************
*
*  function getRandom (_maxNumber, _isArray)
*
************************************************************************* */

function getRandom (_maxNumber, _isArray)
{
	var iRandom = Math.round (Math.random (2) * 10);

	while (iRandom > _maxNumber)
	{
		iRandom = Math.round (iRandom / 2);
	}

	if (_isArray && iRandom > 0)
	{
		iRandom -= 1;
	}

	return iRandom;
}

/* *************************************************************************
*
*  function showFieldAdditional (_this, _objFieldAdditionalID, _triggerValue)
*
************************************************************************* */

function showFieldAdditional (_this, _objFieldAdditionalID, _triggerValue)
{
	var objFieldAdditional = getObj (_objFieldAdditionalID);

	if (_this.value == _triggerValue)
	{
		enableFieldText (_objFieldAdditionalID);

		objFieldAdditional.focus ();
	}
	else
	{
		disableFieldText (_objFieldAdditionalID);
	}
}

/* *************************************************************************
*
*  function enableFieldText (_objFieldAdditionalID)
*
************************************************************************* */

function enableFieldText (_objFieldAdditionalID)
{
	var objFieldAdditional = getObj (_objFieldAdditionalID);

	objFieldAdditional.disabled = false;

	objFieldAdditional.className = replaceClassName (objFieldAdditional.className, 'textfieldDisabled', '');
}

/* *************************************************************************
*
*  function disableFieldText (_objFieldAdditionalID)
*
************************************************************************* */

function disableFieldText (_objFieldAdditionalID)
{
	var objFieldAdditional = getObj (_objFieldAdditionalID);

	objFieldAdditional.disabled = true;

	objFieldAdditional.className = addClassName (objFieldAdditional.className, 'textfieldDisabled');
}

/* *************************************************************************
*
*  function overSplashItem (_this, _objImageID, _objImageSrc)
*
************************************************************************* */

function overSplashItem (_this, _objImageID, _objImageSrc)
{
	var objContainer = _this.parentNode.parentNode.parentNode;

	objContainer.className = addClassName (objContainer.className, 'listItemHover');
	overImage (_objImageID, _objImageSrc);
}

/* *************************************************************************
*
*  function outSplashItem (_this, _objImageID, _objImageSrc)
*
************************************************************************* */

function outSplashItem (_this, _objImageID, _objImageSrc)
{
	var objContainer = _this.parentNode.parentNode.parentNode;

	objContainer.className = replaceClassName (objContainer.className, 'listItemHover', '');
	outImage (_objImageID, _objImageSrc);
}

/* *************************************************************************
*
*  function overSolutionsItem (_this, _imgBGSrc)
*
************************************************************************* */

function overSolutionsItem (_this, _imgBGSrc)
{
	var objContainer = _this.parentNode.parentNode.parentNode;

	objContainer.style.backgroundImage = 'url(' + _imgBGSrc + ')';
	
	objSolImg = document.getElementById('solutions_img');
	if(_imgBGSrc=='/webroot/delivery/images/content/splash/bg-solutions-bytype.gif') objSolImg.src = '/webroot/delivery/images/content/splash/solutions_01.gif';
	if(_imgBGSrc=='/webroot/delivery/images/content/splash/bg-solutions-byarea.gif') objSolImg.src = '/webroot/delivery/images/content/splash/solutions_02.gif';
	if(_imgBGSrc=='/webroot/delivery/images/content/splash/bg-solutions-byclient.gif') objSolImg.src = '/webroot/delivery/images/content/splash/solutions_03.gif';
	if(_imgBGSrc=='/webroot/delivery/images/content/splash/bg-solutions-byhistory.gif') objSolImg.src = '/webroot/delivery/images/content/splash/solutions_04.gif';
}

/* *************************************************************************
*
*  function outSolutionsItem (_this, _imgBGSrc)
*
************************************************************************* */

function outSolutionsItem (_this, _imgBGSrc)
{
	var objContainer = _this.parentNode.parentNode.parentNode;

	objContainer.style.backgroundImage = 'url(' + _imgBGSrc + ')';
	objSolImg = document.getElementById('solutions_img');
	objSolImg.src = '/webroot/delivery/images/content/splash/solutions.gif';
}

/* *************************************************************************
*
*  function overImage (_objImageID, _objImageSrc)
*
************************************************************************* */

function overImage (_objImageID, _objImageSrc)
{
	var objImage = getObj (_objImageID),
		strBackground = objImage.style.backgroundImage,
		strSrc = objImage.src;

	objImage.src = _objImageSrc;
}

/* *************************************************************************
*
*  function outImage (_objImageID, _objImageSrc)
*
************************************************************************* */

function outImage (_objImageID, _objImageSrc)
{
	var objImage = getObj (_objImageID),
		strBackground = objImage.style.backgroundImage,
		strSrc = objImage.src;

	objImage.src = _objImageSrc;
}


function $(id){
	return document.getElementById(id);
}					

function printPages(){
	var this_offset = Math.round(framesize/2);
	if(framesize==9) this_offset--;
	var framestart=active-this_offset;
	
	if (framestart<1) framestart=1;
	var frameend=framestart+framesize-1;
	if (frameend>allcount) frameend=allcount;
	var tcode='<span class="title"><img src="/webroot/delivery/images/content/titles/frame.gif" width="35" height="14" alt="Кадр" title="Кадр"><span>Кадр: </span></span>';
	if (active>1) tcode+='<span class="nav"><a href="#" onclick="gotoPage('+(active-1)+'); return false"><img src="/webroot/delivery/img/nav/arrow-previous.gif" width="10" height="10" alt="Предыдущий кадр" title="Предыдущий кадр"></a></span>';
	tcode+='<span class="div"> </span>';
	if (framestart>1) tcode+='<span class="item"><a href="#" title="'+titles[1]+'" onclick="gotoPage(1); return false">1</a></span><span class="div"> </span>';
	if (framestart>2) tcode+='<span class="item"><a href="#" title="'+titles[framestart-1]+'" onclick="gotoPage('+(framestart-1)+'); return false">...</a></span><span class="div"> </span>';
	
	for (i=framestart; i<=frameend; i++)
		if (i==active) tcode+='<span class="item itemThis" title="'+titles[i]+'">'+i+'</span><span class="div"> </span>';
		else tcode+='<span class="item"><a href="#" title="'+titles[i]+'" onclick="gotoPage('+i+'); return false">'+i+'</a></span><span class="div"> </span>';

	if (frameend<allcount-1) tcode+='<span class="item"><a href="#" title="'+titles[frameend+1]+'" onclick="gotoPage('+(frameend+1)+'); return false">...</a></span><span class="div"> </span>';	
	if (frameend<allcount) tcode+='<span class="item"><a href="#" title="'+titles[allcount]+'" onclick="gotoPage('+allcount+'); return false">'+allcount+'</a></span><span class="div"> </span>';
	if (active<allcount) tcode+='<span class="nav"><a href="#" onclick="gotoPage('+(active+1)+');return false"><img src="/webroot/delivery/img/nav/arrow-next.gif" width="10" height="10" alt="Следующий кадр" title="Следующий кадр"></a></span>';
	$('pages').innerHTML=tcode;
	
	$('picture_title').innerHTML=titles[active];
	$('picture').src=images[active];
	$('picture').alt=titles[active];
	$('picture').title=titles[active];
}

function gotoPage(n){
	active=n;
	printPages();
	
}

function gotoSolutionPage(name){
	if(name!=activepage){
		$("page_"+activepage).style.display="none";
		$("loContent").className="loContent contentSolutions contentSolutionsItem";
		$("pic_"+activepage).src=innermenu[activepage].src;
		$("pic_"+activepage+"_num").src=innermenu[$("pic_"+activepage+"_num").alt].src;
		activepage=name;
		
		$("pic_"+activepage+"_num").src=innermenu[$("pic_"+activepage+"_num").alt+"A"].src;
		$("pic_"+activepage).src=innermenu[activepage+"A"].src;
		$("page_"+activepage).style.display="block";
		if(activepage=="general") $("loContent").className="loContent contentSolutions contentSolutionsItem contentSolutionsItemDescription";
		if(activepage=="case") $("loContent").className="loContent contentSolutions contentSolutionsItem contentSolutionsItemCase";
	}
}

function printSolutionPages(){
	temps='';
	for (var i=0; i<innermenustr.length; i++)
		temps+=innermenustr[i];
	if($('innerMenu')) $('innerMenu').innerHTML=temps;
}