function link(source)
{
	if (source == "income")
	{
		link6 = "http://www.incom-realty.ru/sale-realty/newbuild/?id=518412&sr=8&p=1&cbR=1&tbl=0";
		link7 = "http://www.incom-realty.ru/sale-realty/newbuild/?id=518413&sr=8&p=1&cbR=1&tbl=0";
		link9 = "http://www.incom-realty.ru/sale-realty/newbuild/?id=519235&sr=8&p=1&cbR=1&tbl=0";
		site  = "www.incom-realty.ru";
	}
	if (source == "azbuka")
	{
		link6 = "http://www.azbuka-novostr.ru/homes.php?SECTION_ID=670&is=2";
		link7 = "http://www.azbuka-novostr.ru/homes.php?SECTION_ID=671&is=2";
		link9 = "http://www.azbuka-novostr.ru/homes.php?SECTION_ID=672&is=2";
		site  = "www.azbuka-novostr.ru";		
	}
	if (source == "pservice")
	{
		link6 = "http://www.proektservis.ru/realty/newbuild/view/381/";
		link7 = "http://www.proektservis.ru/realty/newbuild/view/382/";
		link9 = "http://www.proektservis.ru/realty/newbuild/view/383/";
		site = "www.proektservis.ru";
	}
	var scroll = "no";
	var top=0, left=0;
	width = 200;
	height = 230;
	top = Math.floor(screen.height/2 - 100);
	left = Math.floor(screen.width/2 - 100);
	var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
	wnd.document.write(
		"<html><head>"+
		"<title>Переход на сайт Инкома</title></head>"+
		"<body topmargin=\"10\" leftmargin=\"10\" marginwidth=\"10\" marginheight=\"10\">Вы хотите посмотреть этот объект на сайте <b>" + site + "</b>, выберите интересующий корпус:<br><br><a href=\"" + link6 + "\" target=\"blank\">Корпус 6</a><br><a href=\"" + link7 + "\" target=\"blank\">Корпус 7</a><br><a href=\"" + link9 + "\" target=\"blank\">Корпус 9</a><br><br><a href=\"#\" onclick=\"window.close()\">Закрыть</a></body></html>"
	);
	wnd.document.close();
}


// Location of this script:
// http://www.qiksearch.com/javascripts/blinking_text20.htm
//*********************************************
//* Blinking Text 2.0                         *
//* Blinks a text                             *
//* v 2.0 works on IE/NS4/NS6                 *
//* Modified 07 May 2002                      *
//* (c) Premshree Pillai,                     *
//* http://www.qiksearch.com                  *
//* E-mail : premshree@hotmail.com            *
//* Use the script freely as long as this     *
//* message is intact                         *
//*********************************************
<!-- hide from old browsers
ie4 = (document.all)? true:false
function showit() {
	if (ie4) {blinking.style.visibility = "visible"}
	setTimeout("hideit()",1000)
}

function hideit() {
	if (ie4) {blinking.style.visibility = "hidden"}
	setTimeout("showit()",1000)
}

//-->

function ImgShw(ID, width, height, alt)
{
	var scroll = "no";
	var top=0, left=0;
	if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
	if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
	if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
	width = Math.min(width, screen.width-10);
	height = Math.min(height, screen.height-28);
	var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
	wnd.document.write(
		"<html><head>"+
		"<title>"+(alt == ""? "Фотка":alt)+"</title></head>"+
		"<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onClick=\"window.close()\">"+
		"<img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\" />"+
		"</body></html>"
	);
	wnd.document.close();
}

function show_calc(){
	var scroll = "no";
	var top=0, left=0;
	width = 270;
	height = 270;
	top = Math.floor(screen.height/2 - 100);
	left = Math.floor(screen.width/2 - 100);
	
	if(!window.popups) window.popups=[];
	var wnd=window.popups["calc"];
	if(wnd && !wnd.closed){
		wnd.focus();
	}else{
		wnd = window.open("/i/calc.htm","calc","scrollbars="+scroll+",resizable=no,width="+width+",height="+height+",left="+left+",top="+top);
		window.popups["calc"]=wnd;
		wnd.focus();
	}
}

function decode(s){
var s1=unescape(s.substr(0,s.length-1)); var t='';
for(i=0;i<s1.length;i++)t+=String.fromCharCode(s1.charCodeAt(i)-s.substr(s.length-1,1));
document.write(unescape(t));
}

function str_replace(haystack, needle, replacement) {
	var temp = haystack.split(needle);
	return temp.join(replacement);
}

function change_type(id, type){
	pre_text = "Расположение ";

	if (type == "left")
	{
		old_type = "right";
		old_type_text = "справа";
		new_type_text = "слева";
	}else{
		old_type = "left";
		old_type_text = "слева";
		new_type_text = "справа";
	}

	link_text = "<a href=\"#\" onclick=\"change_type('"+id+"', '"+old_type+"'); return false;\">"+old_type_text+"</a>";
	b_text = "<b>"+new_type_text+"</b>";
	text = (type == "right")?link_text+" | "+b_text:b_text+" | "+link_text;
	text = pre_text+text;

	old_text = document.getElementById('flat_preview_'+id).innerHTML;
	new_text = str_replace(old_text, old_type, type);
	document.getElementById('flat_preview_'+id).innerHTML = new_text;

	old_text = document.getElementById('flat_plan_'+id).innerHTML;
	new_text = str_replace(old_text, old_type, type);
	document.getElementById('flat_plan_'+id).innerHTML = new_text;

	document.getElementById('flat_link_'+id).innerHTML = text;
}
