var newWindow;
function makeNewWindow(title, img_path) {
    if (!newWindow || newWindow.closed) {
        newWindow = window.open("","sub","resizable,status,height=800,width=800");
        writeToWindow(title, img_path);
    } else if (newWindow.focus) {
		newWindow.close();
		writeToWindow(title, img_path);
        newWindow.focus( );
    }
}
function writeToWindow(new_title, img_path) {
    var newContent = "<html><head><title>"+new_title+"</title></head>";
	newContent += "<LINK rel=stylesheet href=/style.css>";
    newContent += "<body><a href=\"#\" OnClick=\"window.close()\"><img src=\""+img_path+"\"</img><br>";
	newContent += "<center><a href=\"#\" OnClick=\"window.close()\">Закрыть Окно</a></center>";
    newContent += "</body></html>";
    newWindow.document.write(newContent);
    newWindow.document.close();
}
function makeNewWindow1(title, img_path, width, height) {
    if (!newWindow || newWindow.closed) {
        newWindow = window.open("","sub","resizable,status,height="+height+",width="+width+",scrollbars=yes");
        writeToWindow1(title, img_path, width, height);
    } else if (newWindow.focus) {
		newWindow.close();
        newWindow = window.open("","sub","resizable,status,height="+height+",width="+width+",scrollbars=yes");
		writeToWindow1(title, img_path, width, height);
        newWindow.focus( );
    }
}

function writeToWindow1(new_title, img_path, width, height) {
	width = width-50;
	height = height-50;
    var newContent = "<html><head><title>"+new_title+"</title></head>";
	newContent += "<LINK rel=stylesheet href=/style.css>";
    newContent += "<body><center><a href=\"#\" OnClick=\"window.close()\"><br /><img width="+width+" heigth="+height+" src=\""+img_path+"\" border=0 alt=\"Закрыть окно\" /><br /><br />";
	newContent += "<a href=\"#\" OnClick=\"window.close()\">Закрыть Окно</a></center>";
    newContent += "</body></html>";
    newWindow.document.write(newContent);
    newWindow.document.close();
}

		function show_id(layer)
		{
			var l = document.getElementById(layer);
				
				try {
					l.style.display = "block";
				} catch(e){
				}
				try {
					l.style.visibility = "visible";
				} catch(e){
				}
				return true;

		}
			
		function hide_id(layer)
		{
			var l = document.getElementById(layer);

				try {
					l.style.display = "none";
				} catch(e){
				}
				try {
					l.style.visibility = "hidden";
				} catch(e){
				}
				return true;
				
		}
		
		function show_mid(layer)
		{
			var l = document.getElementById(layer);
			if(l.style.visibility == 'hidden'){
				
				try {
					l.style.display = "block";
				} catch(e){
				}
				try {
					l.style.visibility = "visible";
				} catch(e){
				}
				return true;

			}else{
				try {
					l.style.display = "none";
				} catch(e){
				}
				try {
					l.style.visibility = "hidden";
				} catch(e){
				}
				return true;
			
			}	
		}

		function color(layer)
		{
			var l = document.getElementById(layer);
			if(l.className == 'm_m'){
				
				try {
					l.className = "n_m";
				} catch(e){
				}
				return true;

			}else{
				try {
					l.className = "m_m";
				} catch(e){
				}
				return true;
			
			}	
		}

