
	function show_hidden() {

        var centerPosition = ((document.body.clientWidth - 800) / 2); // Get the center of the viewable area
        var topPosition = (document.body.scrollTop + 92); // Get distance from top of window and adjust

        document.getElementById("vseOtdely").style.visibility = "visible";
        document.getElementById("vseOtdely").style.top = topPosition;
        document.getElementById("vseOtdely").style.left = centerPosition;
        //document.getElementById("vseOtdely").style.width = 350;
       // document.getElementById("vseOtdely").style.height = 300;
        document.getElementById("vseOtdely").style.padding = "5px";
        document.getElementById("vseOtdely").style.border = "2px solid #FFA500";
        document.getElementById("vseOtdely").style.color = "#fff";
    }

	function hide_hidden_link(){
		setTimeout('hide_hidden()', 1000);
	}	
    function hide_hidden() {
        document.getElementById("vseOtdely").style.visibility = "hidden";
    }
	function popper(www,name,options){
	  var pops = window.open(www,name,options);
	  pops.focus();
  return false;
	}
	

function rateIt(i,innk,helped){

save(i,innk,helped);
}



a1=1;
a2=1;
a3=1;
a4=1;
a5=1;

function set_attr() {
  var i;
  var arg=set_attr.arguments;
  var obj=arg[0];
  for(i=1;i<arg.length;i+=2) {
    obj.setAttribute(arg[i],arg[i+1]);
    }
  return obj;
  }

function set_style() {
  var i;
  var arg=set_style.arguments;
  var obj=arg[0];
  for(i=1;i<arg.length;i+=2) {
    obj.style[arg[i]]=arg[i+1];
    }
  }

function set_opt() {
  var i,o;
  var arg=set_opt.arguments;
  var obj=arg[0];
  var cur=arg[1];
  for(i=2;i<arg.length;i+=2) {
    o=document.createElement("OPTION");
    set_attr(o,"value",arg[i]);
    if (arg[i]==cur) set_attr(o,"selected",true);
    o.appendChild(document.createTextNode(arg[i+1]));
    obj.appendChild(o);
    }
  }

function set_opt_() {
  var i,o,v;
  var arg=set_opt_.arguments;
  var obj=arg[0];
  var cur=arg[1];
  for(i=arg[2];i<=arg[3];i++) {
    if(i<10) v = "0"+i;
    else v = i;
  	o=document.createElement("OPTION");
    set_attr(o,"value",v);
    if (v==cur) set_attr(o,"selected",true);
    o.appendChild(document.createTextNode(v));
    obj.appendChild(o);
    }
  }
function createHREF(text,href)
{
var a = document.createElement("A")
document.body.appendChild(a)
var t = document.createTextNode()
t.data = text
a.href = href
a.appendChild(t)
return a
}
  
function append_td(tr,vtd) {
  var td=document.createElement("TD");
  td.appendChild(vtd); 
  tr.appendChild(td); 
  }

function save(whereID,key,val) {
  
//  if (!document.implementation) {
//    alert('Ваш браузер пока не поддерживает данную операцию!');
//    return;
//    }
  
if(whereID==1 && a1==2) return;
if(whereID==2 && a2==2) return;
if(whereID==3 && a3==2) return;
if(whereID==4 && a4==2) return;
if(whereID==5 && a5==2) return;

if(whereID==1) a1++;
if(whereID==2) a2++;
if(whereID==3) a3++;
if(whereID==4) a4++;
if(whereID==5) a5++;


del='rates[]=';
document.cookie=del;

val2='rates['+key+']='+val;
document.cookie=val2;

  
  var td,x,tbody;
  var tb=document.getElementById(whereID);



  tr=document.createElement("TR");
  set_attr(tr,"align","left");
  set_style(tr,"background","#FFFFFF");
  set_style(tr,"color","#990000");

  x=document.createTextNode("Сохранено.");
  append_td(tr,x);



  tb.appendChild(tr);


  return;
  }
function pop(url){
window.open(url, 'fotopop',  'width=700,height=700,toolbar=0,scrollbars=0,screenX=0,screenY=0,left=0,top=0');
return;
}

function get_value(n){
var n;



if(n==1){
document.forms.rate.status.value="Никому не реккомендую";
return;
}
if(n==2){
document.forms.rate.status.value="Неудовлетворительное";
return;
}
if(n==3){
document.forms.rate.status.value="Удовлетворительное";
return;
}
if(n==4){
document.forms.rate.status.value="Хорошее";
return;
}
if(n==5){
document.forms.rate.status.value="Отличное";
return;
}


}
function save(n){

if(n>=1 && n<=5) document.forms.rate.save.value="Сохранено.";

}
function pop_help(url){

var winW;
var winH;
var ot;

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}



if(winW==undefined) winW=800;
if(winH==undefined) winH=600;


ot=winW-200;
window.open(url, 'pop',  'width=400,height='+winH+',toolbar=0,scrollbars=0,screenX='+ot+',screenY=0,left='+ot+',top=0');
return;
}	


function popper(www,name,options){
  var pops = window.open(www,name,options);
  pops.focus();
  return false;
}
	
function sverhu(elem) {
    try {
        var top = 0;
        if (elem.offsetParent) {
            while (elem.offsetParent) {
                top += parseInt(elem.offsetTop);
                elem = elem.offsetParent;
            }
        } else if (elem.y) {
            top += parseInt(elem.y);
        }
        return top;
    } catch (e) {
        return 0;
    }
}

function locate_otstup(elem) {
    var left = 0;
    try {
        if (elem.offsetParent) {
            while (elem.offsetParent) {
                left += parseInt(elem.offsetLeft);
                elem  = elem.offsetParent;
            }
        } else if (elem.x) {
            left += parseInt(elem.x);
        }
        return left;
    } catch (e) {
        /**
         */
        return 0;
    }
}

    function showLayer(left,verh) {

		if(left==undefined) left=65;
		if(verh==undefined) verh=35;
		var sleva=locate_otstup(menuMetka)-left;
        var topPosition = sverhu(menuMetka) + verh; // Get distance from top of window and adjust
		var layer = document.getElementById("vseOtdely");
		layer.style.visibility = "visible";
			
        
        layer.style.top = topPosition;
        layer.style.left = sleva;		
		
		
	    // show IFRAME
	    var iframe = document.getElementById('iframe');
	    iframe.style.display = 'block';
	    iframe.style.width = layer.offsetWidth;
	    iframe.style.height = layer.offsetHeight;
	    iframe.style.left = sleva;
	    iframe.style.top = topPosition;			
		

    }

	function msieversion()
	{
		var ua = window.navigator.userAgent
		var msie = ua.indexOf ( "MSIE " )
		if ( msie > 0 )		// is Microsoft Internet Explorer; return version number
			return parseInt ( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) )
		else
			return 0	// is other browser
	}
	var faded=0;
	function do_fade() {
		if(faded>0) return;
		set_fade(20);
		out_fade(20);
		faded=1;
	}
	function set_fade(SomeNumberThing) {
		var layer = document.getElementById("vseOtdely");
		layer.style.opacity = SomeNumberThing/100;
	}
	function out_fade(SomeNumberThing) {
		if (SomeNumberThing <= 100) {
		set_fade(SomeNumberThing);
		SomeNumberThing += 10;
		window.setTimeout("out_fade("+SomeNumberThing+")", 100);
		}
	}

    function hideLayer() {

       document.getElementById("vseOtdely").style.visibility = "hidden";	
	
	    // hide IFRAME
		var iframe = document.getElementById('iframe');
		iframe.style.display = 'none';
    }
	function popper(www,name,options){
	  var pops = window.open(www,name,options);
	  pops.focus();
  return false;
	}

//Specify highlight behavior. "TD" to highlight table cells, "TR" to highlight the entire row:
var highlightbehavior="TR"

var ns6=document.getElementById&&!document.all
var ie=document.all

function fixto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TABLE")
return
while(source.tagName!=highlightbehavior && source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TABLE")
return
while(source.tagName!=highlightbehavior && source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function contains_ns6(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}

function changeback(e,originalcolor){
if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}

/**
 * This array is used to remember mark status of rows in browse mode
 */
var marked_row = new Array;


/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   integer  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits

    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 1.1 Sets the mouse pointer to pointer on mouseover and back to normal otherwise.
    if (theAction == "over" || theAction == "click") {
        theRow.style.cursor='pointer';
    } else {
        theRow.style.cursor='default';
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it

    if (currentColor.indexOf("rgb") >= 0)
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
        }
    } // end 4

    // 5. Sets the new color...
	
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function














