////////////////////////////////// Styles ///////////////////////////////////////////var agent=navigator.userAgent.toLowerCase();if ((agent.indexOf("msie 6") > -1)||(agent.indexOf("msie 7") > -1)||(agent.indexOf("msie 8") > -1)) {  document.write("<link rel='stylesheet' href='/css/ie.css' type='text/css'>");}////////////////////////////////////// Weather ///////////////////////////////// arrweekday=new Array("вс","пн","вт","ср","чт","пт","сб","вс"); arrtod=new Array("Ночь","Утро","День","Вечер"); arrFrcDay=new Array("0","1","2","3","4","5"); arrAltMstorm=new Array("Нет магнитных возмущений","Небольшие магнитные возмущения","Слабая геомагнитная буря","Малая геомагнитная буря","Умеренная геомагнитная буря","Сильная геомагнитная буря","Жесткий геомагнитный шторм","Экстремальный геомагнитный шторм","Возможна магнитная буря"); var numFRC=0; function checkFrcTopLink(){   for (var i=0; i<arrFrcDay.length; i++)     if (numFRC==arrFrcDay[i]) {       document.getElementById("frc_"+arrFrcDay[i]).style.color="#3b55c5";       document.getElementById("frc_"+arrFrcDay[i]).style.fontWeight="bold";     }     else {       document.getElementById("frc_"+arrFrcDay[i]).style.color="#0000ee";       document.getElementById("frc_"+arrFrcDay[i]).style.fontWeight="normal";     } }function FrcObject(pref_id){	this._pref=pref_id;	this.setDiv=function() {  	var div= document.createElement("div");  	div.setAttribute("id", this._pref+"content_table");  	document.getElementById(this._pref+"content_weather").appendChild(div);  	for(i=2; i<=13; i++) {  		var childDiv=document.createElement("div");  		childDiv.setAttribute("id", this._pref+"td"+i);  		childDiv.setAttribute("class", "weather_table_"+i);  		document.getElementById(this._pref+"content_table").appendChild(childDiv);  	}	}	this.showFrc=function() {  	  	if (this._pref=="frc_")       		document.getElementById("blog_text").innerHTML=document.getElementById("frc_text_"+numFRC).innerHTML;        for (var i=0;i<11;i++) {        	if (typeof(arrFRC[numFRC][i])=="undefined") arrFRC[numFRC][i]=arrFRC[0][i];	       document.getElementById(this._pref+arrFRC[numFRC][i][0]).innerHTML="";	       if (this._pref+arrFRC[numFRC][i][0]==this._pref+"td2") {	         var hour=arrFRC[numFRC][i][3];	         var tod=getTod(hour);	       }	       else var tod=arrFRC[numFRC][i][3];		   if (arrFRC[numFRC][i][4]<3) var cloudiness=0;		   else if ((arrFRC[numFRC][i][4]>=3)&&(arrFRC[numFRC][i][4]<8)) cloudiness=3;		   		else cloudiness=8;	       if (this._pref=="frc_") document.getElementById(this._pref+arrFRC[numFRC][i][0]).style.background = "url(/images/fon/"+tod+"_"+cloudiness+".gif)";	       for (var k=0;k<arrFRC[numFRC][i].length-1;k++) {		  	 if (k==0) continue;	      	 if (k==2) continue;	         var objId=getObjId(this._pref+arrFRC[numFRC][i][0],k);	         document.getElementById(this._pref+arrFRC[numFRC][i][0]).innerHTML+="<div id="+objId+" align='center' valign='middle'></div>";		     document.getElementById(objId).style.width='100%';		     setObjIdBorderStyle(objId,k);		     if (k==1) {		  	   fillDayAndWeekDay(objId,arrFRC[numFRC][i][1],arrFRC[numFRC][i][2]);		  	   continue;		     }		     if (k==3) {		       if (this._pref+arrFRC[numFRC][i][0]==this._pref+"td2") fillHour(objId,tod,hour,this._pref);		       else fillTod(objId,tod,this._pref);		       continue;		     }		     if (k==4) {		  	   fillPhenomena(objId,tod,arrFRC[numFRC][i][4],arrFRC[numFRC][i][5], arrFRC[numFRC][i][arrFRC[numFRC][i].length-1],this._pref);		       k++;		       continue;	         }	         if (k==arrFRC[numFRC][i].length-2) {	           if (arrFRC[numFRC][i][11]>2) var MstormPict="2";	           else var MstormPict=arrFRC[numFRC][i][11];	      	   if (this._pref=="frc_") document.getElementById(objId).innerHTML='<img src="/images/mstorm/'+MstormPict+'.png" width="34" height="12"  onLoad="transparent(this)" alt="'+arrAltMstorm[arrFRC[numFRC][i][11]]+'" title="'+arrAltMstorm[arrFRC[numFRC][i][11]]+'">';	           else document.getElementById(objId).innerHTML='<img src="/images/mstorm/'+MstormPict+'.gif" width="34" height="12"  alt="'+arrAltMstorm[arrFRC[numFRC][i][11]]+'" title="'+arrAltMstorm[arrFRC[numFRC][i][11]]+'">';	           continue;	         }	         if (k<arrFRC[numFRC][i].length-1) document.getElementById(objId).innerHTML=arrFRC[numFRC][i][k];	      }       }	}}function getObjId(cowId,i) {	  if (i<3) return cowId+(i-1);	  if ((i>=3)&&(i<6)) return cowId+(i-2);	  if (i>=6) return cowId+(i-3);}function getTod(tod) {    if ((tod>=0) && (tod<6)) return 0;    if ((tod>=6) && (tod<12)) return 1;    if ((tod>=12) && (tod<18)) return 2;    if ((tod>=18) && (tod<24)) return 3;}function setObjIdBorderStyle(objId,i) {	if ((i>5) && (i<11)) {	  document.getElementById(objId).style.borderBottom="solid 1px";	  document.getElementById(objId).style.borderBottomColor="#FFF";	}}function fillDayAndWeekDay(objId,day,weekday) {    if ((weekday==1) ||(weekday==7)) document.getElementById(objId).style.color="#a70909";	document.getElementById(objId).innerHTML=day+" "+arrweekday[weekday-1];}function fillTod(objId,tod, _pref) {	document.getElementById(objId).innerHTML=arrtod[tod];	if (((tod==0) || (tod==3)) && (_pref=="frc_")) document.getElementById(objId).style.color="#FFF";}function fillHour(objId,tod,hour, _pref) {	document.getElementById(objId).innerHTML=hour+":00";	if (((tod==0) || (tod==3)) && (_pref=="frc_")) document.getElementById(objId).style.color="#FFF";}function fillPhenomena(objId,tod,cloudiness,precipitation,alt,_pref) {  document.getElementById(objId).style.height='80px';  if ((tod==0) || (tod==3))  var pref_tod="n";  else var pref_tod="d";  if (_pref=="frc_") document.getElementById(objId).innerHTML='<img src="/images/icon/'+pref_tod+precipitation+"_"+cloudiness+'.png" alt="'+alt+'" title="'+alt+'" width="50" height="80" onLoad="transparent(this)">';  else document.getElementById(objId).innerHTML='<img src="/images/prticons/'+pref_tod+precipitation+"_"+cloudiness+'.png" alt="'+alt+'" title="'+alt+'" width="50" height="80">';}//////////////////////////////////// Graphics //////////////////////////////////function GraphObj(townindex,geosuffix) {	var graph = this;	graph._townindex=townindex;	graph._arrGraphName=new Array("P","T","R","W");	graph._n=graph._arrGraphName.length;	graph._arrGraphPic=new Array();	graph._lastShowGraphic=0;	graph._graphicTimer=null;	graph.preloadGraph=function() {		var k=0;		for (var i=numFRC*graph._n; i<(numFRC+1)*graph._n; i++){			if (graph._arrGraphPic[i]==null) {				graph._arrGraphPic[i]=new Image();				graph._arrGraphPic[i].src="http://www.meteonova.ru/images/graphics/"+graph._arrGraphName[k]+"G"+graph._townindex+"_"+numFRC+".png"+geosuffix;				graph._arrGraphPic[i].onLoad=graph.initGraphic(i);		  }		  k++;		}	}	graph.initGraphic=function(i) {		if (!document.getElementById("graph"+i)) {	  		var img= document.createElement("img");				img.setAttribute("id", "graph"+i);	  		img.src=graph._arrGraphPic[i].src;				var s = img.style;				s.top=0;	  		s.left=0;	  		s.visibility = "hidden";	  		s.position = "absolute";	  		s.zIndex=12;			document.getElementById('graphic').appendChild(img);	  }	}	graph.showGraphic=function(el,graph_num) {		clearTimeout(graph._graphicTimer); 		var obj=document.getElementById("graphic");   		if (obj) {    	obj.style.left = getPos(document.getElementById("frc_td2"),"Left")+55+"px";     	if (agent.indexOf("opera")>-1) obj.style.top =  getPos(el,"Top")+(el.offsetHeight-3)+"px";     	else obj.style.top =  getPos(el,"Top")+el.offsetHeight+"px";     	obj.style.visibility = "visible";    	}    var div=document.getElementById("graph"+graph._lastShowGraphic);    if (div) div.style.visibility="hidden";    div=document.getElementById("graph"+graph_num);   	if (div) {   		div.style.visibility="visible";   		graph._lastShowGraphic=graph_num;   	}  }  graph.hideGraphic=function(){	clearTimeout(graph._graphicTimer);    var div=document.getElementById("graph"+graph._lastShowGraphic);    if (div) div.style.visibility="hidden";    div=document.getElementById("graphic");    if (div) div.style.visibility = "hidden";  }  graph.timerHideGraphic=function() {  	graph._graphicTimer=setTimeout(function(){graph.hideGraphic();},1000);  }}function getPos(el,sProp) {	var iPos = 0;	while (el!=null) {		iPos+=el["offset" + sProp]		el = el.offsetParent;	}	return iPos}///////////////////////////////// AJAX preloader ///////////////////////////////function setPreloaderPict(parentId,preloaderId,preloaderStyle){  var div = document.createElement("div");  div.setAttribute('id', preloaderId);  var s = div.style;  s.position = "absolute";  s.zIndex=12;  document.getElementById(parentId).appendChild(div);  if (preloaderStyle=="mini")  	div.innerHTML="<img src=\"/images/ajax-miniloader.gif\" width=\"16\" height=\"16\" />";  else div.innerHTML="<img src=\"/images/ajax-loader.gif\" width=\"93\" height=\"26\" />";  return div;}function setPreloaderStyle(parentDiv,preloaderDiv){	var div=document.getElementById(preloaderDiv);	var pdiv=document.getElementById(parentDiv);	div.style.left=Math.round(pdiv.offsetWidth/2)-Math.round(div.offsetWidth/2)+"px";	if ((parentDiv=="townsContainer") && (pdiv.className=="townsContainerMain"))		div.style.top=Math.round(pdiv.offsetHeight/2)-Math.round(div.offsetHeight/2)+"px";	else		div.style.top=Math.round(pdiv.offsetHeight/2)+15-Math.round(div.offsetHeight/2)+"px";}function initPreloader(parentId, preloaderId,preloaderStyle) {	var pobj=document.getElementById(parentId);	var obj=document.getElementById(preloaderId);	if (!obj) {		obj=setPreloaderPict(parentId,preloaderId,preloaderStyle);		setPreloaderStyle(parentId,preloaderId);	}	obj.style.visibility="visible";}//////////////////////////////////// Ajax //////////////////////////////////////function sendAjaxRequest(url,method,callback,onerror) {//  var request = null; if (window.ActiveXObject) // IE  	var request = new ActiveXObject("Microsoft.XMLHTTP"); else if (window.XMLHttpRequest) // Mozilla, Safari, ...    var request = new XMLHttpRequest();  request.onreadystatechange = function() { requesFunction(request,method,callback,onerror); };  request.open(method, url, true);  request.send(null);}function requesFunction(req,method,fcall,ferror) {	var self;  if (req) self={req:req,method:method,fcall:fcall,ferror:ferror,request:arguments.callee.request}  else self=arguments.callee;  if(self.req.readyState == 4) {    var callbackArgsArray=new Array(self.req);    try{    	if(self.req.status == 200) {        self.fcall.apply(null,callbackArgsArray);      }      else self.ferror.apply(null,callbackArgsArray);    }    catch(err) {    	self.ferror.apply(null,callbackArgsArray);    }		//self.req.ready=0;  	//self.req.abort();  }}///////////////////////////////////// Slider ///////////////////////////////////	function initScrollContent(obj) {	  if(obj) {	   obj.state = 0;		 obj.maxVert = obj.scrollHeight - obj.offsetHeight;	  }	}  function scroll(val,contentId) {    var obj=document.getElementById(contentId);   	if (obj) {   		initScrollContent(obj);   		obj.scrollTop=obj.maxVert*(val/100);    }	}  function scroll2(el,contentId, vSlider,slideHandle) {  	var obj=document.getElementById(contentId);  	if (obj) {  		initScrollContent(obj);  		if (el.getAttribute("id").indexOf("slideBottom")>-1) {  			if (obj.maxVert > obj.scrollTop) obj.scrollTop=obj.scrollTop+16;      } else obj.scrollTop=obj.scrollTop-16;    }    var obj2=document.getElementById(vSlider);    var obj3=document.getElementById(slideHandle);    if ((obj2)&&(obj3))    	obj3.style.top=Math.ceil(obj2.offsetHeight-22-((obj2.offsetHeight-22)*((obj.maxVert-obj.scrollTop)/obj.maxVert)))+"px";	}  function scroll3(contentId, vSlider,slideHandle, i) {  	var obj=document.getElementById(contentId);  	if (obj) {  		initScrollContent(obj);  	    if (obj.maxVert > obj.scrollTop) obj.scrollTop=(obj.scrollTop+16)*i;    }    var obj2=document.getElementById(vSlider);    var obj3=document.getElementById(slideHandle);    if ((obj2)&&(obj3))    	obj3.style.top=Math.ceil(obj2.offsetHeight-22-((obj2.offsetHeight-22)*((obj.maxVert-obj.scrollTop)/obj.maxVert)))+"px";	}///////////////////////////////////// Print ////////////////////////////////////function printtable(){	w=window.open("","printable","location=no, toolbar=yes ,menubar=yes,width=730,height=550");	w.document.write(getHeader()+getBody());	w.document.write(getFooter());	w.document.close();}function getHeader() {	var temp;	temp="<html>"	temp+='<head><title>Meteonova</title><META http-equiv=Content-Type content="text/html charset=windows-1251">'+			'<link rel="stylesheet" href="/css/mosg_990.css" type="text/css">'+  			'<link rel="stylesheet" href="/css/general.css" type="text/css">'+  			'<link rel="stylesheet" href="/css/print.css" type="text/css">';	if ((agent.indexOf("msie 6") > -1)||(agent.indexOf("msie 7") > -1)||(agent.indexOf("msie 8") > -1)) {		temp+="<link rel='stylesheet' href='/css/ie.css' type='text/css'>";		temp+='<link rel="stylesheet" href="/css/printie6.css" type="text/css">';    }	return temp+"</head>";}function getFooter() {	var temp;	temp="<div class='footer'>Copyright © 2009, Метеосистемы</div></body></html>";	return temp;}function getBody() {	var temp;	temp="<body>"; 	temp+="<div style='margin-left:15px'><img src='/images/logo.gif' width='250' height='50' title='Meteonova' alt='Meteonova'></div>"; 	temp+="<div class='city_name_print'>"+document.getElementById("city_name").innerHTML+"</div>";	temp+='<div id="print_content_weather"  class="content_weather">';  	temp+='<div class="weather_table_1" id="print_td1">'+	      	'<div id="print_weather_row_title_0" class="weather_row_title">Дата<br>Время суток</div>'+	      	'<div id="print_weather_row_title_1" class="weather_row_title"></div>'+	      	'<div id="print_weather_row_title_2" class="weather_row_title">Облачность<br>Осадки</div>'+	      	'<div id="print_weather_row_title_3" class="weather_row_title">Давление, мм.</div>'+	      	'<div id="print_weather_row_title_4" class="weather_row_title">Температура,&deg;C</div>'+	      	'<div id="print_weather_row_title_5" class="weather_row_title">Влажность,%</div>'+	      	'<div id="print_weather_row_title_6" class="weather_row_title">Ветер,метр/с</div>'+	      	'<div id="print_weather_row_title_7" class="weather_row_title">Комфорт,&deg;C</div>'+	      	'<div id="print_weather_row_title_8" class="weather_row_title">Магнитные бури</div>'+	      '</div>';	var printObj=new FrcObject("print_");	printObj.setDiv();	printObj.showFrc();  	temp+=document.getElementById('print_content_table').innerHTML;	temp+='</div>';	return temp;}/////////////////////////  GuestBook //////////////////////////////////function checkGbForm(){  if (document.getElementById("username").value=="") {  	document.getElementById("resCheckGbForm").innerHTML="Не заполнено поле с именем";  	return;  }  if (document.getElementById("city").value=="") {  	document.getElementById("resCheckGbForm").innerHTML="Введите название города";  	return;  }  if (document.getElementById("comment").value=="") {  	document.getElementById("resCheckGbForm").innerHTML="Отсутствует текст сообщения";  	return;  }  if (document.getElementById("checknum").value=="") {  	document.getElementById("resCheckGbForm").innerHTML="Введите контрольное число";  	return;  }}function AddGbComment(obj){  var username=document.getElementById("username").value;  var email=document.getElementById("email").value;  var country=document.getElementById("country").value;  var city=document.getElementById("city").value;  var comment=document.getElementById("comment").value;  var checknum=document.getElementById("checknum").value;  var cryptnum=document.getElementById("cryptnum").value;  if ((username!="") && (city!="") && (comment!="") && (checknum!="")) {  	obj.submit();  }}///////////////////////// Transparancy /////////////////////////////////var bIE6=agent.indexOf("msie 6")>-1;function transparent(im) {   setTimeout(function(){   if (bIE6 && (!im.transparented)) {      im.transparented = 1;      var picture = im.src;      var w = im.width;      var h = im.height;      im.src = "/images/clear.gif";      im.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod='scale', src='" + picture + "');";      im.width = w;      im.height = h;      }   return "transparent";   }, Math.floor(Math.random()*400));}////////////////////////////////////////// Cookies ////////////////////////////////////////var bNovaSilence=document.cookie.indexOf("novas=1")!=-1;function setSilence(bS){ if(bS) { bNovaSilence=1; document.cookie="novas=1; expires=Wed, 6 Mar 2030 00:00:00; path=/;";}   else  { bNovaSilence=0; document.cookie="novas=1; expires=Wed, 1 Mar 2006 00:00:00; path=/;";}}///////////////////////////////////////////////////////////////////////////////////////////////function setURL(cindex) { if (cindex!=domains[domain][0]){ 	if (domain!="ru") return URL.replace(domain,domains["ru"][1]); 	else { 		for (var i=1; i<domains["all"].length; i++) { 			if (cindex==domains[domains["all"][i]][0]) { 				return URL.replace(domain,domains[domains["all"][i]][1]); 			} 		} 		return URL; 	} } else return URL;}function getSearchURL(str) {//	return "/find.htm?searchby=firstchar&fchar="+escape2(str);  return "/search/?req=findall&town="+escape2(str);}/////////////////////////////////Hints//////////////////////////////////////////var hintTimeouts = new Array();function showHint(parentObj, id, bVisible, width) {	id = id.toString();	var obj = document.getElementById("hint_content_"+id);	if (!obj) initHint(id, width);	var hintObj = document.getElementById(id);	if (hintObj) {    hintObj.style.left=getPos(parentObj,"Left")+2+"px";    hintObj.style.top =  getPos(parentObj,"Top")+parentObj.offsetHeight+2+"px";    setTimeoutHint(hintObj, bVisible);  }}function setTimeoutHint(hintObj, bVisible) {	var id = hintObj.getAttribute("id").toString();	var hintTimeout = hintTimeouts[id];	clearTimeout(hintTimeout);  hintTimeouts[id] = setTimeout(function() {  		if (bVisible) hintObj.style.visibility="visible";  		else hintObj.style.visibility="hidden";    },    500  );}function initHint(id, width) {	var imgUrl = "/images/hints";	var hintObj = document.getElementById(id);	if (hintObj) {		var content = hintObj.innerHTML;		var hintBlock = "<div>";		hintBlock+="<div class='hint_top_left'><img src='"+imgUrl+"/hint_top_left.png' width='15' height='18' class='corner' onLoad='transparent(this)'></div>";		hintBlock+="<div class='hint_top_center' style='width: "+width+"px;'></div>";		hintBlock+="<div class='hint_top_right'><img src='"+imgUrl+"/hint_top_right.png' width='23' height='18' class='corner' onLoad='transparent(this)'></div>";		hintBlock+="</div>";    hintBlock+= "<div>";		hintBlock+="<div class='hint_body_left'><img src='"+imgUrl+"/hint_body_left.png' id='hint_body_left"+id+"' width=15 onLoad='transparent(this)'></div>";		hintBlock+="<div class='hint_body_center' id='hint_content_"+id+"' style='width: "+width+"px; background-color: #f8f9fd'>"+content+"</div>";		hintBlock+="<div class='hint_body_right'><img src='"+imgUrl+"/hint_body_right.png' id='hint_body_right"+id+"' width=23 onLoad='transparent(this)'></div>";		hintBlock+="</div>";    hintBlock+= "<div>";		hintBlock+="<div class='hint_bottom_left'><img src='"+imgUrl+"/hint_bottom_left.png' width='15' height='18' class='corner' onLoad='transparent(this)'></div>";		hintBlock+="<div class='hint_bottom_center' style='width: "+width+"px;'></div>";		hintBlock+="<div class='hint_bottom_right'><img src='"+imgUrl+"/hint_bottom_right.png' width='23' height='18' class='corner' onLoad='transparent(this)'></div>";		hintBlock+="</div>";		hintObj.innerHTML = hintBlock;		var content_height = document.getElementById("hint_content_"+id).offsetHeight;		document.getElementById("hint_body_left"+id).style.height = content_height;		document.getElementById("hint_body_right"+id).style.height = content_height;		hintObj.style.width = width+40;		hintObj.style.height = content_height;	}}
