var menu_light = "#FFFFFF";
var menu_dark = "#0000AA";
function change(name, picture)
{
    var obj = document.getElementById(name);
	obj.src = "/images/"+picture;
}

function show_hide(id)
{

 	var obj = document.getElementById(id);


 	if(obj.style.display == "none")
 	{
 		obj.style.display = "block";

 	}
 	else

 		obj.style.display = "none";

 	//alert(obj.style.display);
}
function bgcolor(id, color)
{
	var obj = id;
    if(typeof(id) == "string") obj = document.getElementById(id);
 	obj.style.backgroundColor = color;
}
function set_class(id, class_name)
{
	var obj = id;
    if(typeof(id) == "string") obj = document.getElementById(id);
 	obj.className = class_name;
}
function go(path)
{
	location.href = path;
}


function set_group_value(source, destination, group_name, value_name, suffics)
{
    //alert(groups);
    var source_form = document.getElementById(source);
    var dest_form = document.getElementById(destination);
    // get selected group
    var group_elements = groups[source_form.elements[group_name].value];
    // get value
    var value = source_form.elements[value_name].value;
    //alert(group_elements);
    for(var i=0; i<dest_form.length; i++)
    {
        for(var j=0; j<group_elements.length; j++)
        {
    		//alert(dest_form.elements[i].id);
    		if(dest_form.elements[i].id == (group_elements[j]+suffics) )
    		             dest_form.elements[i].value =  value ;
    	}
    }
}

function change_image(id, img)
{
	var img_tag = document.getElementById(id);
	if(img_tag)
	{

		 img_tag.src="";
		 img_tag.src=img+"&"+Math.floor(100*Math.random());

	}
}


/* -------------------------------------------------------------- */
function checkFill(form_name, fields_list)
{
  var arr = fields_list.split(",");
   var text = "";
   for(var i=0; i<arr.length; i++)
   {
      elem = eval("document."+form_name+"."+arr[i]);
	  if(elem.value==="")

   	  {
   	  	  if(text == "") text="Following fields are required:\n";
          elem.style.backgroundColor="#a7d0ea";
   	  }
      else
          elem.style.backgroundColor="#ffffff";
   }
   if(text!="")
   {
   		//alert(text);
   		return false;
   }

   return true;
}

function eq(form_name, el1, el2)
{
	elem1 = eval("document."+form_name+"."+el1);
	elem2 = eval("document."+form_name+"."+el2);
	if(elem1.value != elem2.value)
	{
		alert("Fields "+elem1.alt+" and "+elem2.alt+" do not match.");
		return false;
	}
	return true;
}

function addr_coincides(elem)
{
     var formChildren = $("form[name='registr']>fieldset:nth-child(3)>div, form[name='registr']>fieldset:nth-child(3)>hr")
     formChildren.each(
        function(i)
        {
            if ($("#"+elem).is(":checked"))
           	 this.style.display = "none";
            else
            	 this.style.display = "block";
        }
     );
}



function change_span()
{
$(function(){
   $("div.pager_content > span.pager_control").hover(
      function () {

        $(this).removeClass("pager_control");
        $(this).addClass("pager_control_hover");
      },
      function () {

        $(this).removeClass("pager_control_hover");
        $(this).addClass("pager_control");
      }
    );
});
}


function change_title(title)
{	document.title = title;}

















