

var plugin;
var version = 8;
var flashinstalled = false;

// Определяем сразу, есть ли у пользователя флэш
if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash"]) {
        plugin = navigator.plugins["Shockwave Flash"].description;
		flashinstalled = (plugin.match(/\d{1,2}/) >= version);
	} else {
        if ((navigator.userAgent.indexOf('MSIE') != -1)
            && (navigator.userAgent.indexOf('Win') != -1))
        {
            document.write('<'+'script language="vbscript"'+'>\n');
			document.write('on error resume next\n');
			document.write('flashinstalled=( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + version + '")))\n');
			document.write('</'+'script'+'>');
        }
    }
	//alert(flashinstalled);
}
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   interger  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */

//-->
function showDetails(elem, num) {	
	// display принимает значение table-row и block
	var obj1 = eval('document.getElementById("tr1' + num + '")');
	if (obj1.style.display == 'none') {
		obj1.style.display = elem;
	} else {
		obj1.style.display = 'none';
	}
}



function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3
    if (currentColor.indexOf("rgb") >= 0) 
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
    }
    // 4.1.2 Current color is the pointer one
    else {
		if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
	}
 
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


function setPointerCell(theCell, theAction, theDefaultColor, thePointerColor)
{
	var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    if (typeof(window.opera) == 'undefined'
        && typeof(theCell.getAttribute) != 'undefined') {
        currentColor = theCell.getAttribute('bgcolor');
        domDetect    = true;
    }
    else {
        currentColor = theCell.style.backgroundColor;
        domDetect    = false;
    } // end 3

	if (theAction == 'out') {
    	newColor              = theDefaultColor;
    } else {
		newColor              = thePointerColor;
	}
	if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            theCell.setAttribute('bgcolor', newColor, 0);
			//theCell.setAttribute('color', '#000000', 0);
        }
        // 5.2 ... with other browsers
        else {
            theCell.style.backgroundColor = newColor;
			//theCell.style.color = '#000000';
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


function header_top_ny(domain, member) {
document.write('<tr>');
document.write('<td colspan="2" style="padding-top:3px;">');	

document.write('<table>');
document.write('<tr>');
	document.write('<td width="198" height="68" valign="bottom"><a href="'+domain+'" title="NERS.ru - Недвижимость России"><img src="http://dev.ners.ru/assets/_img/ny/ny1.gif" width="198" height="68" border="0" alt="NERS.ru - Недвижимость России"></a></td>');
	document.write('<td>');

	document.write('<table>');
	document.write('<tr>');
	
	document.write('<td colspan="3">');
		document.write('<table><tr>');
		document.write('<td height="52"><img src="http://dev.ners.ru/assets/_img/ny/ny2.gif" width="613" height="52" border="0"></td>');
		document.write('<td class="oc1"></td>');
		document.write('</tr></table>');
	document.write('</td>');

	document.write('</tr>');
	
	document.write('<tr>');
		document.write('<td width="120" class="ny3">Личный&nbsp;офис&nbsp;&nbsp;&nbsp;</td> ');
		document.write('<td width="40%" class="tdVOhm">'+member+'&nbsp;</td>');
		document.write('<td width="55%" class="oc2"></td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</td>');
document.write('</tr>');
document.write('</table>');

document.write('</td>');
document.write('</tr>');
}

function header_top(domain, member) {
document.write('<tr>');
document.write('<td colspan="2" style="padding-top:3px;">');	
document.write('<table>');
document.write('<tr>');
document.write('<td width="198" height="62" valign="bottom"><a href="'+domain+'" title="UA.NERS.ru - Недвижимость Украины"><img src="assets/_img/logo_ners.gif" width="198" height="62" border="0" alt="NERS.ru - Недвижимость России"></a></td>');
document.write('<td>');
document.write('<table>');
document.write('<tr>');
document.write('<td colspan="3">');
document.write('<table><tr>');
document.write('<td height="46"><a href="'+domain+'" title="Недвижимость Украины"><img src="assets/_img/ners_name.gif" width="481" height="45" border="0" alt="NERS.ru - Недвижимость Украины"></a></td>');
document.write('<td class="rffi1"></td>');
document.write('</tr></table>');
document.write('</td>');
document.write('<td rowspan="2" valign="bottom"></td>');
document.write('<td></td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td width="5%" class="tdVOhl">Личный&nbsp;офис&nbsp;&nbsp;&nbsp;</td> ');
document.write('<td width="40%" class="tdVOhm">'+member+'&nbsp;</td>');
document.write('<td width="55%" class="rffi2"></td>');
document.write('<td width="10" class="tdVOhm1">&nbsp;</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
}
function header_vo_form(current_date) {
document.write('<tr>');
document.write('<td colspan="2">');
document.write('<table>');
document.write('<form name="login_form" method="post">');
document.write('<tr>');
document.write('<td class="logl">Логин&nbsp;');
document.write('<INPUT class="hvoform" size=15 name="login_name" onBlur="login_form.login_pwd.focus();">');
document.write('&nbsp;Пароль&nbsp;<INPUT class="hvoform" type="password" size=15 name="login_pwd">&nbsp;&nbsp;&nbsp;</td>');
document.write('<td class="logr">');
document.write('<SELECT class="hvoform" name="back_url">');
document.write('<OPTION value="new_subscr_notes/" selected>Новые объявления</OPTION> ');
document.write('<OPTION value="my_elite/">Избранное</OPTION>');
document.write('<OPTION value="add_my_notes/">Подать объявление</OPTION>');
document.write('<OPTION value="my_notes/">Свои объявления</OPTION>');
document.write('<OPTION value="realty_demand/">Заявки</OPTION>');
document.write('<OPTION value="user_info/">Контактная информация</OPTION> ');
document.write('<OPTION value="subscription/">Подписка</OPTION>');
document.write('</SELECT>');
document.write('&nbsp;&nbsp;<INPUT class="textm" onclick="return check_form(\'login_name\', \'login_pwd\');" type="image" height=20 width=20 src="assets/_img/go.gif" align="absMiddle" border=0 name="log_on">');
document.write('&nbsp;&nbsp;<a href="myoffice_pwd_recover/">забыли&nbsp;пароль?</a>&nbsp;|&nbsp;<a href="myoffice_info/">что&nbsp;это?</a>&nbsp;|&nbsp;<a href="myoffice_reg/">регистрация</a>');
document.write('</td>');
document.write('<td class="currentDate">'+current_date+'</td>');
document.write('</tr>');
document.write('</form>');
document.write('</table>');
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td height="1" colspan="2" align="left" bgcolor="#999999"><img src="assets/_img/null.gif" width="1" height="1"></td>');
document.write('</tr>');
}

function showHideRegion (id) {
	var obj1 = eval('document.getElementById("' + id + '")');
	if (obj1.style.visibility == 'visible') {
		obj1.style.visibility = 'hidden';
	} else {
		obj1.style.visibility = 'visible';
	}
}
function Dlist (id) {
	var obj1 = eval('document.getElementById("' + id + '")');
	if (obj1.style.visibility == 'visible') {
		obj1.style.visibility = 'hidden';
	} else {
		obj1.style.visibility = 'visible';		
	}
}

function showBlock (id) {
	//alert('!!!');
		var obj1 = eval('document.getElementById("' + id + '")');
		obj1.style.visibility = 'visible';
		//document.all[id].style.visibility = 'visible';
}
function hideBlock (id) {
		//alert('???');
		var obj1 = eval('document.getElementById("' + id + '")');
		obj1.style.visibility = 'hidden';
		//document.all[id].style.visibility = 'hidden';
}

/* вызывается при изменении содержимого окна body */
function UC(taobj, length_info, id) {
	if (!id) {
		id = 'counter';	
	}
	var left = length_info - taobj.value.length;
	var counter = document.getElementById(id);
	counter.innerText = left;
	counter.innerHTML = left;
}
function BC(taobj, length_info, id) {
	if (!id) {
		id = 'counter';	
	}
	var left = length_info - taobj.value.length;
	var counter = document.getElementById(id);
	if(left<0) {
		alert('Количество знаков в объявлении превышает допустимое!')
		taobj.focus();
		return false;
	}
}
function trim(str)  { 
	var re1 = /^\s*/; 
	var re2 = /\s*$/; 
	return str.replace(re1, "").replace(re2, ""); 
} 

function ShowBanner(id_banner, flash_name, img_name, width, height, img_title) {
	var domain = "http://visa.ners.ru/";
	//var domain = "http://visa.ners.local/";
	if (flashinstalled && flash_name)  {
		show_flash = true;
	} else if (img_name) {
		show_flash = false;
		// для растяжки
	} else {
		show_flash = true;
	}
	if (show_flash)  {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="bs" align="middle">'+
	'<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="movie" value="'+domain+flash_name+'?url='+domain+'bsc/?bsid='+id_banner+'" />'+
	'<param name="menu" value="false" />'+
	'<param name="wmode" value="opaque" />'+
	'<param name="quality" value="high" />'+
	'<embed src="'+domain+flash_name+'?url='+domain+'bsc/?bsid='+id_banner+'" wmode="opaque" menu="false" quality="high" width="'+width+'" height="'+height+'" name="bs" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
	'</object>');
	} else {
	document.write('<a href="'+domain+'bsc/?bsid='+id_banner+'" target="_blank" title="'+img_title+'"><img src="'+domain+img_name+'" width="'+width+'" height="'+height+'" border="0" alt="'+img_title+'"></a>');
	}
}
