/*
*		Prcenter_CommonScripts.js
*		Файл скриптов страниц раздела "Prcenter"
*/

					//<base href="http://192.168.1.2/prcenter_pages/" />

					isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
					isOpera=isOpera5=window.opera && isDOM //Opera 5+
					isOpera6=isOpera && window.print //Opera 6+
					isOpera7=isOpera && document.readyState //Opera 7+
					isMSIE=document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
					isMSIE5=isDOM && isMSIE //MSIE 5+
					isNetscape4=document.layers //Netscape 4.*
					isMozilla=isDOM && navigator.appName=="Netscape" //Mozilla или Netscape 6.*

					// Показать НОВОЕ ПОЛНОЕ окно
					function WinNewOpen(wurl, WinTitleName, width, height)
					{
						wnd = window.open(wurl, WinTitleName, "location=yes,toolbar=yes,scrollbars=yes,directories=yes,status=yes,menubar=yes,resizable=yes,width=" + width + ",height=" + height + ",left="+Math.floor((screen.width - width)/2)+",top="+Math.floor((screen.height - height)/2)+"");
						wnd.focus() ;
					}
					
					// Показать растежимое окно посередине экрана
					function wopen(wurl, WinTitleName, width, height)
					{
						wnd = window.open(wurl, WinTitleName, "location=no,toolbar=no,scrollbars=yes,directories=no,status=no,menubar=no,resizable=yes,width=" + width + ",height=" + height + ",left="+Math.floor((screen.width - width)/2)+",top="+Math.floor((screen.height - height)/2)+"");
						wnd.focus() ;
					}
					
					// Показать нерастяжимое окно посередине экрана
					function showwin(url,w,h)
					{
						var myleft = Math.round ((screen.width - w) / 2);
						var mytop =  Math.round ((screen.height - h) / 2) - 30;
					  	window.open(url,"_blank","toolbar=no,location=no,directoties=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+w+",height="+h+",top="+mytop+",left="+myleft);
					}

					
					function g(wurl){
						  if (opener){
						    if (opener.closed)
						      window.open(wurl, "") ;
						    else if (opener.location.href.search(wurl) == -1)
						      opener.location.href = wurl ;
						    self.close() ;
						    return false ;
						  }
					  	return true ;
					}
					
					function MySubsUrlPictures(){
						if (isOpera)	//  
							//		var	myString = document.location.href ;
							//		var mySplitResult = myString.split("/");
							//		var MyBaseUrl=mySplitResult[0] ;
							//		for(x=1; x<(mySplitResult.length-1); x++) {
							//			MyBaseUrl = MyBaseUrl + "/" + mySplitResult[x] ;
							//		}
							for(i=0;i<100;i++) {
								var	TestForLinkPic = 'myPhotoGaleries'+i;
								if(document.getElementById) {
									var Par1 = document.getElementById(TestForLinkPic);
									if (Par1 != null) {
										//alert(Par1.href) ;
										Par1.href = Par1.href ;
										//Par1.href = MyBaseUrl + "/FOTO/HULI/5_S.jpg" ;
										//var test2 = MyBaseUrl + "/FOTO/HULI/5_S.jpg" ;
									}
								}
							}
					}
					
					function AfishaChangeMonth(MonthNum) {
								var	NewAfishaIdName = 'AfishaMonth'+MonthNum;
								var	NewMenuIdName = 'menuMonth'+MonthNum;
								
								for(i=1; i<13; i++) {
									var	OldAfishaIdName = 'AfishaMonth'+i;
									var	OldMenuIdName = 'menuMonth'+i;
									
									//if(!(i=MonthNum)) {
										var elemAfisha = document.getElementById(OldAfishaIdName);
										var elemMenu = document.getElementById(OldMenuIdName);
										
										if(elemAfisha) {
											//elemAfisha.className = 'AfishaHiden';
											elemAfisha.style.display='none';
										}
										if(elemMenu)
											elemMenu.className = 'menu_Months-item';
									//}
								}
								
								// Переключаемся на активный месяц
								var elemAfishaNew = document.getElementById(NewAfishaIdName);
								var elemMenuNew = document.getElementById(NewMenuIdName);
								
								if(elemMenuNew)
									elemMenuNew.className = 'menu_Months-item-active';
										
								if(elemAfishaNew) {
									//elemAfishaNew.className = 'AfishaVisible';
									elemAfishaNew.style.display='block';
								}
					}					
					
					
		//<LINK href="../Common/prcenter_style2.css" type=text/css rel=STYLESHEET>
		//	html { overflow-x: auto; }		-- For Opera !!!
		
		//			var gl_H1_PictureDiv = "headerC0C3-" ;
		//			onload = function() {
		//					//		    gl_header1_border = document.getElementById("header1_border");
		//					//		    gl_sub_header2_border = document.getElementById("sub_header1_border");
		//					//		    //if(isMozilla)
		//					//		    	//AllWidthResizing(gl_H1_PictureDiv, 3.613);
		//					//		    	ChangeWidthByHeight('headerC0C3-1', 3.613);
		//					//		    	var Hed12 = GetWidth('headerC0C3-1') ;
		//					//		    	SetWidth('headerC0C3-2', Hed12) ;
		//			} ;
		//			
		//			onresize = function() {
		//						//AllWidthResizing(gl_H1_PictureDiv, 3.613);
		//				//	ChangeWidthByHeight('headerC0C3-1', 3.613);
		//				//	var Hed12 = GetWidth('headerC0C3-1') ;
		//	    		//	SetWidth('headerC0C3-2', Hed12) ;
		//			} ;
//==========================================================================================
// 
			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_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_findObj(n, d) { //v3.0
			  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); 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];
			   }
			}
//==========================================================================================

		function SelectText(num){
				if(document.getElementById('block0'+num).style.display!='block'){
					ClearAll();
					document.getElementById('block0'+num).style.display='block';
					
					//if(num<3) document.getElementById('hand').style.backgroundImage = "url('/img/hand-1.jpg')";
					//if(num==3 || id==5) document.getElementById('hand').style.backgroundImage = "url('/img/hand-2.jpg')";
					//if(num==4) document.getElementById('hand').style.backgroundImage = "url('/img/hand-3.jpg')";
					
					document.getElementById('menu0'+id+'norm').style.display='none';
					document.getElementById('menu0'+id+'hover').style.display='none';
					document.getElementById('menu0'+id+'active').style.display='block';
				}
		}

		function ClearAll(){
			for(i=1; i<6; i++){
				if(document.getElementById('block0'+i).style.display=='block'){
					   document.getElementById('block0'+i).style.display='none';
					   
					   document.getElementById('menu0'+i+'norm').style.display='block';
					   document.getElementById('menu0'+i+'hover').style.display='none';
					   document.getElementById('menu0'+i+'active').style.display='none';
				}
			}
		}
//==========================================================================================
		function OverNav1(num){
				if(document.getElementById('block0'+num).style.display=='none'){
					ClearNav1();
					document.getElementById('menu0'+num+'norm').style.display='none';
					document.getElementById('menu0'+num+'hover').style.display='block';
				}
		}
		
		function OutNav1(num){
				if(document.getElementById('block0'+num).style.display=='none'){
					ClearNav1();
					document.getElementById('menu0'+num+'norm').style.display='block';
					document.getElementById('menu0'+num+'hover').style.display='none';
				}
		}
		
		function ClearNav1(){
			for(i=1; i<6; i++){
				if(document.getElementById('block0'+i).style.display!='block'){
					document.getElementById('menu0'+i+'norm').style.display='block';
					document.getElementById('menu0'+i+'hover').style.display='none';
					document.getElementById('menu0'+i+'active').style.display='none';
				}
			}
		}
//==========================================================================================
function initDoc(){

	for(i=1; i<6; i++){
		document.getElementById('block0'+i).style.display='none';
		document.getElementById('menu0'+i+'hover').style.display='none';
		document.getElementById('menu0'+i+'active').style.display='none';
		document.getElementById('menu0'+i+'norm').style.display='block';
	}

document.getElementById('nav').style.display='block';
document.getElementById('block01').style.display='block';
document.getElementById('menu01active').style.display='block';
document.getElementById('menu01norm').style.display='none';
}
//==========================================================================================

