
var bookmarkurl="http://www.e-rostov.ru"
var bookmarktitle="E-ROSTOV | Портал Электронный Ростов"
function addbookmark()
{
 if (document.all)
 window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function chbgcolor(td,color)
{ td.style.backgroundColor=color;return true;}

// Menu --------------------------------------------------------------------

var m1c, m1t;
var m2c, m2t;
var m3c, m3t;

function new_image_src(src)
{
var i=new Image;
i.src=src;
return i;
}

function image_change (img, ref)
{
if (!document.images)
return;
document.images[img].src = il[ref].src;
}

function layer_image_change (div, img, ref) 
{
var i;
if (!document.images)
return;
if (document.layers)
i = document.layers[div].document.images;
else
i = document.all[div].document.images;
i[img].src = il[ref].src;
}


function layer_x(name) {
if (document.layers) {
if (document.layers[name])
return document.layers[name].pageX;
} else {
if (document.all[name] && document.all[name].style)
return document.all[name].offsetLeft;
}
}

function layer_y(name) {
if (document.layers) {
if (document.layers[name])
return document.layers[name].pageY;
} else {
if (document.all[name] && document.all[name].style)
return document.all[name].offsetTop;
}
}

function layer_move (name,x,y) {
if (document.layers) {
if (document.layers[name]) {
document.layers[name].pageX = x;
document.layers[name].pageY = y;
}
} else {
if (document.all[name] && document.all[name].style) {
document.all[name].style.left = x;
document.all[name].style.top = y;
}
}
}

function layer_show (name) {
if (document.layers) {
if (document.getElementById(name))
{
document.getElementById(name).style.visibility = "show";
}
} else {
if (document.getElementById(name) && document.getElementById(name).style)
{
document.getElementById(name).style.visibility = "visible";
}
}
}

function layer_hide (name) {
if (document.layers) {
if (document.getElementById(name))
document.getElementById(name).visibility = "hide";
} else {
if (document.getElementById(name) && document.getElementById(name).style)
document.getElementById(name).style.visibility = "hidden";
}
}

function window_width() {
if ( navigator_explorer() )
return document.body.offsetWidth;
if ( navigator_netscape() )
return window.innerWidth+4;
}

function window_height() {
if ( navigator_explorer() )
return document.body.offsetHeight;
if ( navigator_netscape() )
return window.innerHeight;
}


function navigator_explorer() {
return ( navigator.appName.indexOf('Explorer') != -1);
}

function navigator_netscape() {
return ( navigator.appName.indexOf('Netscape') != -1);
}



function m1s(name) {
if ( m1c && m1c != name )
layer_hide(m1c);
m1c = name;
layer_show(m1c);
if ( m1t )
clearTimeout(m1t);
m1t = 0;
}

function m1h(name) {
m1t = setTimeout('layer_hide(\''+name+'\')', 500);
}

function m2s(name) {
if ( m2c && m2c != name )
layer_hide(m2c);
m2c = name;
layer_show(m2c);
if ( m1t )
clearTimeout(m1t);
if ( m2t )
clearTimeout(m2t);
m1t = 0;
m2t = 0;
}

function m2h(name) {
m1t = setTimeout('layer_hide(\''+m1c+'\')', 500);
m2t = setTimeout('layer_hide(\''+name+'\')', 500);
}

function m3s(name) {
m3c = name;
if ( m1t )
clearTimeout(m1t);
if ( m2t )
clearTimeout(m2t);
if ( m3t )
clearTimeout(m3t);
m1t = 0;
m2t = 0;
m3t = 0;
}

function m3h(name) {
m1t = setTimeout('layer_hide(\''+m1c+'\')', 500);
m2t = setTimeout('layer_hide(\''+m2c+'\')', 500);
m3t = setTimeout('layer_hide(\''+name+'\')', 500);
}

// Other -------------------------------------------------------------------

<!--
var layerRef="null",styleSwitch="null";
if (navigator.appName == "Netscape"){
  layerRef="document.layers";
  styleSwitch="";
}
else{
  layerRef="document.all";
  styleSwitch=".style";
}
function showLayer(layerName){
  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
function hideLayer(layerName){
  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}
function pict_sh(img){
  document.images[img].src = "images/dot_red.gif";
}
function pict_h(img){
  document.images[img].src = "images/dot_gr.gif";
}
function ShowResults(){
 window.open ('question_stat.php3','Result','menubar=0,scrollbars=0,resizable=1,status=0,location=0,toolbar=0,directories=0,width=430,height=190');
}
function ShowMerCall(){
 window.open ('call.html','Call','menubar=0,scrollbars=0,resizable=1,status=0,location=0,toolbar=0,directories=0,width=486,height=420');
}
function ShowWin(url,x,y){
 window.open (url,'Result','menubar=0,scrollbars=0,resizable=1,status=0,location=0,toolbar=0,directories=0,width='+x+',height='+y);
}
function ShowWin1(url,x,y){
 window.open (url,'Result','menubar=0,scrollbars=1,resizable=1,status=0,location=0,toolbar=0,directories=0,width='+x+',height='+y);
}
////////////////////////////////////////////////////////////////////////////////
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function NY(){
 Layer1.style.left = document.all.t1.offsetLeft+80;
}
function leyer_Hide(){
  document.all.Layer2.style.visibility = "hidden";
}
////////////////////////////////////////////////////////////////////////////////
function Mot(eld)
{eld.style.backgroundColor='#2F4157';}

function Mor(eld)
{eld.style.backgroundColor='#586884';}

function Motx(eld)
{eld.style.backgroundColor='#f6faef';}

function Morx(eld)
{eld.style.backgroundColor='#dfecc8';}
function randimg()
{
 var imgn1,imgn2,imgn3,imgn4;
 imgn1=Math.floor(Math.random()*26)+1;
 do
  imgn2=Math.floor(Math.random()*26)+1;
 while(imgn2==imgn1);
 do
  imgn3=Math.floor(Math.random()*26)+1;
 while(imgn3==imgn2 || imgn3==imgn1);
 do
  imgn4=Math.floor(Math.random()*26)+1;
 while(imgn4==imgn3 || imgn4==imgn2 || imgn4==imgn1 || imgn3==imgn2 || imgn3==imgn1 || imgn2==imgn1);
 document.top_img1.src="'+incp+'images/top_images/top_image_"+imgn1+".jpg";
 document.top_img2.src="'+incp+'images/top_images/top_image_"+imgn2+".jpg";
 document.top_img3.src="'+incp+'images/top_images/top_image_"+imgn3+".jpg";
 document.top_img4.src="'+incp+'images/top_images/top_image_"+imgn4+".jpg";
}

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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
////////////////////////////////////////////////////////////////////////////////
function leftf(Xself,Xtarget,Xmanual)
{
 var offsetTrail = Xself;
 var offsetLeft = +1;
 var offsetTop = +1;
 while (offsetTrail) 
 { 
  offsetLeft += offsetTrail.offsetLeft;
  offsetTop += offsetTrail.offsetTop;
  offsetTrail = offsetTrail.offsetParent;
 }
 document.getElementById(Xtarget).style.left=offsetLeft-Xmanual;
 document.getElementById(Xtarget).style.top=offsetTop; 
}
// Calendar ----------------------------------------------------------------

//var args = window.dialogArguments;
var WeekTitles=new Array('П','В','С','Ч','П','С','В')
function showallweektitles()
{
 var i, answer="  <tr>\n"
 for(i=0;i<WeekTitles.length;i++) answer+="    <th class='txt_si_day'><b>"+WeekTitles[i]+"</b></th>\n"
 answer+="  </tr>\n"
 return answer
}

function calendar_show(m, d, y, h, incp)
{
//alert (h);
//alert (incp);
 var h=h; 
 var incp=incp; 

 var sdate= new Date(m+'/1/'+y);
// var sdate= new Date(m+'/8/'+y);

 var mdate= new Date(m+'/'+d+'/'+y);
 var todaydate= new Date();
 var days=dayonmonth(m,y)

//alert(days);
//alert(sdate.getDay());

 var iday=0, day, answer=''
 var rd=d, rm=m;
 answer+='<table border=0 align="center">'
 answer+='  <tr>'
 answer+='  	<th colspan=7>'
 answer+='		<table width="100%" border=0 cellpadding=0 cellspacing=0 height="100%" style="border-bottom:1px solid #889ebd" align="center">'
 answer+='  			<tr>'
 answer+='    			<td align="left" class="txt_si"><b>Выбрана</b></td>'
 if (d<10)
  rd='0'+d;
 if (m<10)
  rm='0'+m;
 answer+='    			<td align="right" class="txt_si">'+rd+'.'+rm+'.'+y+'</td>'
 answer+='  			</tr>'
 answer+='		</table>'
 answer+='	</th>'
 answer+='  </tr>'
 answer+='  <tr>'
 answer+='  	<th colspan=7>'
 answer+='<table border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">'
 answer+='  <tr>'
 answer+='    <td width="25%" height="20px" onMouseOver="Morx(this)" onMouseOut="Motx(this)" onClick="calendar_move(\'-\',\'y\','+m+','+d+','+y+',\''+h+'\',\''+incp+'\')"><table align="center" border=0 cellpadding=0 cellspacing=0><tr><td><img width="7px" height="7px" src="'+incp+'images/meloch/strlb.gif"><img width="7px" height="7px" src="'+incp+'images/meloch/strlb.gif"></td></tr></table></td>'
 answer+='    <td width="25%" height="20px" onMouseOver="Morx(this)" onMouseOut="Motx(this)" onClick="calendar_move(\'-\',\'m\','+m+','+d+','+y+',\''+h+'\',\''+incp+'\')"><table align="center" border=0 cellpadding=0 cellspacing=0><tr><td><img width="7px" height="7px" src="'+incp+'images/meloch/strlb.gif"></td></tr></table></td>'
 answer+='    <td width="25%" height="20px" onMouseOver="Morx(this)" onMouseOut="Motx(this)" onClick="calendar_move(\'+\',\'m\','+m+','+d+','+y+',\''+h+'\',\''+incp+'\')"><table align="center" border=0 cellpadding=0 cellspacing=0><tr><td><img width="7px" height="7px" src="'+incp+'images/meloch/strl.gif"></td></tr></table></td>'
 answer+='    <td width="25%" height="20px" onMouseOver="Morx(this)" onMouseOut="Motx(this)" onClick="calendar_move(\'+\',\'y\','+m+','+d+','+y+',\''+h+'\',\''+incp+'\')"><table align="center" border=0 cellpadding=0 cellspacing=0><tr><td><img width="7px" height="7px" src="'+incp+'images/meloch/strl.gif"><img width="7px" height="7px" src="'+incp+'images/meloch/strl.gif"></td></tr></table></td>'
 answer+='  </tr>'
 answer+='</table>'
 answer+='	</th>'
 answer+='  </tr>'
 answer+='  <tr>'
 answer+=showallweektitles()

 ndayinweek=sdate.getDay();
 if(sdate.getDay()==0) { 
   ndayinweek=7;   
  }

// for(day=1;day<sdate.getDay();day++)
 for(day=1;day<ndayinweek;day++)
 {
  iday++
  answer+="    <td>&nbsp;</td>"
 }
 for(day=1;day<=days;day++)
 {
  iday++
  //window.self.location
  var _GET_Keys;
  var _GET_Values; 
  var _GET_Count = 0;
  var _GET_Default = '';
  var ResulURL='';
  get = new String(window.location); 
  var location;
  x = get.indexOf('?');
  var cd=todaydate.getDate();
  var cm=todaydate.getMonth()+1;
  var cy=todaydate.getFullYear();
  if(x!=-1) 
  {
   //ResulURL='ERROR';
   l = get.length; 
   location = get.substr(0, x);
   get = get.substr(x+1, l-x);
   l = get.split('&'); 
   x = 0; 
   _GET_Count = l.length; 
   _GET_Keys = new Array(_GET_Count); 
   _GET_Values = new Array(_GET_Count);
   for(i in l) 
   { 
   get = l[i].split('='); 
   _GET_Keys[x] = get[0]; 
   _GET_Values[x] = get[1]; 
   x++; 
   }
   ResulURL=location+'?';
   for ( key in _GET_Keys ) 
   { 
    if (_GET_Keys[key]!='d' && _GET_Keys[key]!='m' && _GET_Keys[key]!='y' && _GET_Keys[key]!='D' && _GET_Keys[key]!='M' && _GET_Keys[key]!='Y')
	 ResulURL+=_GET_Keys[key]+'='+_GET_Values[key]+'&';
	if (_GET_Keys[key]=='d')
	 cd=_GET_Values[key];
	if (_GET_Keys[key]=='m')
	 cm=_GET_Values[key];
	if (_GET_Keys[key]=='y')
	 cy=_GET_Values[key]; 
   }
  } 
  else
   ResulURL=window.location+'?';
  if (h!='0') ResulURL=h;
  //alert(ResulURL);
  if((todaydate.getMonth()+1)==m && todaydate.getDate()==day && todaydate.getFullYear()==y)
  {
   if(cm==m && cd==day && cy==y)
    answer+="    <td onMouseOver=\"Morx(this)\" onMouseOut=\"Motx(this)\" onClick=\"window.self.location='"+ResulURL+"d="+day+"&m="+m+"&y="+y+"'\"><table border=0 cellpadding=0 cellspacing=2 width=\"15\" height=\"100%\" align=\"center\"><tr class=\"but_3_u_day\" style=\"font-weight:bold\" align=\"center\"><td>"+day+"</td></tr></table></td>"
   else
    answer+="    <td onMouseOver=\"Morx(this)\" onMouseOut=\"Motx(this)\" onClick=\"window.self.location='"+ResulURL+"d="+day+"&m="+m+"&y="+y+"'\"><table border=0 cellpadding=0 cellspacing=2 width=\"15\" height=\"100%\" align=\"center\"><tr class=\"but_3_u_day\" align=\"center\"><td>"+day+"</td></tr></table></td>"
  }
  else
  if(cm==m && cd==day && cy==y)
   answer+="    <td onMouseOver=\"Morx(this)\" onMouseOut=\"Motx(this)\" onClick=\"window.self.location='"+ResulURL+"d="+day+"&m="+m+"&y="+y+"'\"><table border=0 cellpadding=0 cellspacing=2 width=\"15\" height=\"100%\" align=\"center\"><tr class='txt_si' style=\"font-weight:bold\" align=\"center\"><td class='txt_si'>"+day+"</td></tr></table></td>"
  else
   answer+="    <td onMouseOver=\"Morx(this)\" onMouseOut=\"Motx(this)\" onClick=\"window.self.location='"+ResulURL+"d="+day+"&m="+m+"&y="+y+"'\"><table border=0 cellpadding=0 cellspacing=2 width=\"15\" height=\"100%\" align=\"center\"><tr class='txt_si' align=\"center\"><td class='txt_si'>"+day+"</td></tr></table></td>"
  if(iday==7)
  {
   answer+="</tr><tr>"
   iday=0
  }
 }
 answer+="  </tr>"
 answer+='</table>'
 //self.calendar.innerHTML=answer
 document.all.calendar.innerHTML=answer
}

function dayonmonth(m, y)
{
 var answer
 if(m!=2)
 {
  var date1=new Date(m+'/31/'+y)
  var mm=(m<12)?(m+1):1;
  var yy=(m<12)?y:(y+1);
  var date2=new Date(mm+'/1/'+yy)
  answer=(date1.getDay()==date2.getDay())?'30':'31';
 }
 else
 {
  var date1=new Date(m+'/29/'+y)
  var mm=(m<12)?(m+1):1;
  var yy=(m<12)?y:(y+1);
  var date2=new Date(mm+'/1/'+yy)
  answer=(date1.getDay()==date2.getDay())?'28':'29';
 }
 return answer
}

function calendar_move(to, index, m, d, y, h, incp)
{
 switch(to)
 {
  case('-'):
			switch(index)
			{
			 case('m'):
			 		   if(m>1)
			   		   {
					    m--
			   		   }
			   		   else
			   		   {
					    m=12
					    y--
			   		   }
			  		   break
			 case('d'):
			  		   var mm=(m>1)?--m:1
			   		   var yy=(m>1)?y:--y
			   		   var days=dayonmonth(mm, yy)
			   		   if(d>1)
			   		   {
					    d--
			   		   }
			   		   else
					   {
					    d=days
					    m=mm
					    y=yy
					   }
					   break
			 case('y'):
					   y--
					   break
  			}
			break
  case('+'):
			switch(index)
			{
			 case('m'):
					   if(m<12){
						m++
					   }
					   else
					   {
						m=1
						y++
					   }
					   break
			 case('d'):
					   var mm=(m<12)?++m:1
					   var yy=(m<12)?y:++y
					   var days=dayonmonth(m, y)
					   if(d<days)
					   {
						d++
					   }
					   else
					   {
						d=1
						m=mm
						y=yy
					   }
					   break
			 case('y'):
					   y++
					   break
			}
			break
 } 

// alert ('???????'+incp);
 calendar_show(m, d, y, h, incp);
}

function viewfoto(url,w,h,s,t) {
        var ind;
        var tstr;
//alert('!!!!!!!');
	attr = "width="+w+",height="+h+",location=0,menubar=no,resizable=yes,scrollbars="+s+",status=0,titlebar=0,toolbar=0,hotkeys=0";
	if ( parseInt(navigator.appVersion) >= 4 ) {
		x = (screen.width - w) / 2;
		y = (screen.height - h) / 2;
		if( x<0 ) x=0;
		if( y<0 ) y=0;
		attr += ",xposition="+x+",left="+x+",yposition="+y+",top="+y;
	}
	window.open(url,t,attr);
}

function insFlash(file,variabili,larghezza,altezza,colore,trasparente)
{
 pathf='';
 var flashObject = '<object type=\"application/x-shockwave-flash\" data=\"flash/' + pathf + file + '.swf\" id=\"' + pathf + file + '\" width=\"' + larghezza + '\" height=\"' + altezza + '\">';
 var flashVars = '    <param name=\"flashVars\" value=\"' + variabili +'\">';
 var movie = '    <param name=\"movie\" value=\"flash/' + pathf + file + '.swf\" />';
 var nome = '    <param name=\"name\" value=\"' + pathf + file + '\" />';

 document.writeln(flashObject);
 document.writeln(movie); 
 document.writeln(flashVars); 
 document.writeln("    <param name=\"loop\" value=\"false\" />");
 document.writeln("    <param name=\"menu\" value=\"false\" />"); 
 document.writeln("    <param name=\"quality\" value=\"high\" />"); 
 document.writeln("    <param name=\"bgcolor\" value=\"#" + colore + "\" />");
 document.writeln(nome);
 if (trasparente == true) 
 {
  document.writeln("    <param name=\"wmode\" value=\"transparent\">");
  var traspEmbed = " wmode=\"transparent\""
 } 
 else 
 {
  var traspEmbed = ""
 }
 var EMBED = '<EMBED src=\"flash/' + pathf + file + '.swf\" flashVars=\"' + variabili + '\" loop=\"false\" menu=\"false\" quality=\"high\" bgcolor=\"' + colore + '\" WIDTH=\"' + larghezza + '\" HEIGHT=\"' + altezza + '\" NAME=\"' + pathf + file + '\"' + traspEmbed + ' ALIGN=\"\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED>';
 document.writeln (EMBED);
 document.writeln("</object>"); 
}

