function d( sId ) {
	return document.getElementById(sId);
}

/*
// 2005-12-08
// Copyright (c) Art. Lebedev | http://www.artlebedev.ru/
// Author - Vladimir Tokmakov
*/


function cmnRemove_class( eOn, sClass_name ){
	cmnSet_class( eOn, "", sClass_name );
}

function cmnSet_class( eOn, sClass_name, sInstead ){
	if( eOn ){
		sClass_name = ( sClass_name.length ) ? sClass_name.replace( /(^\s+|\s+$)/, "" ) : "";
		if( eOn.className.length ){
			var sOld = sClass_name;
			if( sInstead && sInstead.length ){
				sInstead = sInstead.replace( /\s+(\S)/g, "|$1" );
				if( sOld ){
					sOld += "|";
				}
				sOld += sInstead;
			}
			eOn.className = eOn.className.replace( new RegExp("(^|\\s+)(" + sOld +")($|\\s+)", "g"), "$1" );
		}
		eOn.className += ( eOn.className.length && sClass_name ? " " : "" ) + sClass_name;
	}
}

function cmnMatch_class( eOn, sClass_name ){
	return ( sClass_name && eOn.className && eOn.className.length && eOn.className.match( new RegExp("(^|\\s+)(" + sClass_name +")($|\\s+)") ) );
}

function getAbsoluteCoords(oElement) {
	var oResult = {
		iTop  : 0,
		iLeft : 0
		};
	while(oElement) {
		oResult.iTop += oElement.offsetTop;
		oResult.iLeft += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return oResult;
}

function cmnSet_cookie( sName, vValue, dExpires ){
   document.cookie = sName + "=" + escape( vValue )
	   + ( dExpires == null ? "" : ( "; expires=" + dExpires.toGMTString() ) )
	   + "; path=/";
}

function cmnGet_cookie( sName ){
	return cmnPairs_string_get_value( document.cookie, sName );
}

function cmnPairs_string_get_value( sText, sName, sFrom, sBefore ){
	var sValue = "";
	if( sText ){
		if( !sFrom ) sFrom = "=";
		if( !sBefore ) sBefore = ";";
		sText = sText.replace( new RegExp( "(" + sBefore + ")\\s+", "g" ), "$1" );
		var iStart = sText.indexOf( sBefore + sName + sFrom );
		if( iStart >= 0 ){
			iStart += ( sBefore.length + sName.length + sFrom.length );
		}else{
			iStart = sText.indexOf( sName + sFrom );
			if( iStart == 0 ){
				iStart += ( sName.length + sFrom.length );
			}else{
				iStart = -1;
			}
		}
		if( iStart >= 0 ){
			var iEnd = sText.indexOf( sBefore, iStart );
			if( iEnd < 0 ){
				iEnd = sText.length;
			}
			sValue = sText.substring( iStart, iEnd );
		}
	}
	return sValue;
}

/*
// 2005-12-08
// Copyright (c) Art. Lebedev | http://www.artlebedev.ru/
// Author - Vladimir Tokmakov
// the end. spasiba :)
*/

function javascript_to_flash(v) {
	if( thisMovie("topmoto") )
		var textfromflash = thisMovie("topmoto").asFunc(v);
	return(true);
}
function thisMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	var oMovie = (isIE) ? window[movieName] : document[movieName];
	var oResult = ( typeof(oMovie) == 'undefined' ) ? false : oMovie;
	return oResult;
}

function goMoped2() {
	javascript_to_flash(3);
}

function goMoped2(oElem) {
	if(!cmnMatch_class( oElem, 'disabled' )) {
		javascript_to_flash(3);
	}
}

function TimeLine() {
	var oNow = new Date();
	var iNowMscnds = oNow.getTime() + (60*60*10*1000);
	oNow.setTime(iNowMscnds);
	cmnSet_cookie( 'time-line', '1', oNow );
}



function SetHoverParstyColor( oElem ) {
	if( cmnMatch_class( oElem, 'pseudolink' ) ) {
		cmnSet_class( oElem, 'pseudolink_hover', 'pseudolink' );
	}
}

function SetParstyColor( oElem ) {
	if( cmnMatch_class( oElem, 'pseudolink_hover' ) ) {
		cmnSet_class( oElem, 'pseudolink', 'pseudolink_hover' );
	}
}

function SetHoverHelpColor( oElem ) {
	if( cmnMatch_class( oElem, 'pseudolink_yellow' ) ) {
		cmnSet_class( oElem, 'pseudolink_yellow_hover', 'pseudolink_yellow' );
	}
}

function SetHelpColor( oElem ) {
	if( cmnMatch_class( oElem, 'pseudolink_yellow_hover' ) ) {
		cmnSet_class( oElem, 'pseudolink_yellow', 'pseudolink_yellow_hover' );
	}
}
