function select_item_for_join(id) {
id = "#qwer"+id;
   sel=   $(id).get(0).options[$(id).get(0).selectedIndex].value;
  $(id).get(0).parentNode.previousSibling.firstChild.value =" "+sel;
}
function onbody_load() {
   if (document.forms[0].elements[0]) {
       document.forms[0].elements[0].focus();
   }
}
function clear_style() {
    if ($$('secs')) {
        t = $$('secs');
        while (t) {
            t.style.textTransform = 'none';
            if (t.id!='sec') {
                t.style.fontWeight = 'normal';
            }
            t = t.nextSibling;
        }
    }  
}
function fnShowProps(obj){
    var result = "";
    objName="obj";
    for (var i in obj) //      
        result += objName + "." + i + " = " + obj[i] + "<br />\n";
    return (result);
}
function openClose(theID) {

 if (document.getElementById(theID).style.display == "block") {
     document.getElementById(theID).style.display = "none";
}
 else {
     document.getElementById(theID).style.display = "block";
} 
}
function delete_confirm(){
  return confirm("Уверены, что хотите удалить?");
}

function check_email(thisone) {
  if (!(/\w+@\w+\.[a-z]{2,4}/.test(thisone.value)) && (thisone.value!='')) {
    alert("Неправильный E-mail");
    thisone.select();
  }
}

function $$() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

function addBookmark(url, title)
{
  if (!url) url = location.href;
  if (!title) title = document.title;
  
  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
  
  return true;
}

//<!--
//<![CDATA[
  function menuhide(menunum)
  {
    var currentmenu = document.getElementById("navbody" + menunum);
    currentmenu.style.visibility = 'hidden';
  }

  function menushow(menunum)
  {
    var currentmenu = document.getElementById("navbody" + menunum);
    currentmenu.style.visibility = 'visible';
  }
//]]>
//-->







function addBookmark(url, title)
{
  if (!url) url = location.href;
  if (!title) title = document.title;
  
  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
  
  return true;
}


function show_it(id) {

var my_table=document.getElementById('hide');
var el=document.getElementById(id);

if (el.style.display=="none"){
el.style.display="";
}
else 
{
el.style.display="none";
}

//Скрываем предыдущую
var hid_div=document.getElementById('temp');
if (hid_div.value!=''){
var last_div=document.getElementById(hid_div.value);
last_div.style.display="none";
}

hid_div.value=id;

}



function select_submit(){
document.forms['my'].submit();
}


function show_hide_form() {
    var rl=document.getElementById('reg-link');
     var login=document.getElementById('center');
    var reg=document.getElementById('reg-menu');
    if (rl.childNodes[0].textContent == "Регистрация") {
          
        alert(rl.innerHTML);
        rl.innerHTML = 'Вход';
     } else {
          reg.style.display="none";
          login.style.display="";
        alert(rl.innerHTML);
        rl.innerHTML = 'Регистрация';
    }
}


function check_fill(){
if (document.order.f.value=="" || document.order.phone.value=="" || document.order.email.value=="" || document.order.adress.value=="") {
alert ('   ');} else {
document.order.submit();
}
}

function put_height(){
//alert ('frame'+document.getElementById('content2').clientHeight);
//alert ('body'+document.getElementById('content2').contentDocument.body.offsetHeight);
//document.getElementById('content2').height=document.getElementById('content2').contentDocument.body.offsetHeight+20;
document.getElementById('content2').height=document.getElementById('content2').contentWindow.document.body.offsetHeight+20;

}
function toggle_visible(obj,check_box) {
    if (obj.src.substr(-6)=='ok.gif') {
        obj.src=obj.src.substring(0,(obj.src.length-6))+'no.gif';  
    } else {
        obj.src=obj.src.substring(0,(obj.src.length-6))+'ok.gif';  
    }
    t =document.forms[1].elements[(check_box*2)-1];
   if (t.type == "checkbox") { 
        t.click();
   }
   
}
