var big_photo; 
var old_id= 'drop';

function change(big,small)
{
 document.getElementById('photo').src= small;
 big_photo = big; 
}

function setup(big)
{
 big_photo = big; 
}

function newWindow(url, width, height, winname) {
  
  var screen_width  = screen.width;
  var screen_height = screen.height;
  var left = screen_width/2-width/2;
  var top  = screen_height/2-height/2;
  
	if(screen_width > width && screen_height > height)
        var scrollbars = 'scrollbars=no';
    else 
        var scrollbars = 'scrollbars=yes';
  
  
  var Win = window.open('large.php?img=' + url, winname, 'width=' + width + ', height=' + height + ', resizable=yes, ' + scrollbars + ', menubar=no' + ', top=' + top + ', left=' + left);
}

function SetSize()
{
    if (self.innerWidth)
    {
    	frameWidth = self.innerWidth;
    	frameHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth)
    {
    	frameWidth = document.documentElement.clientWidth;
    	frameHeight = document.documentElement.clientHeight;
    }
    else if (document.body)
    {
    	frameWidth = document.body.clientWidth;
    	frameHeight = document.body.clientHeight;
    }
    
    image = document.getElementById('photo');
    
    
    imageWidth  = image.offsetWidth+50;
    imageHeight = image.offsetHeight+100;
    /*
    if(imageWidth < 200)
        imageWidth = 200;
        
    if(imageHeight < 200)
        imageHeight = 200;
    
    if(imageHeight > self.screen.height) imageHeight = self.screen.height - 30;
    if(imageWidth  > self.screen.width)  imageWidth  = self.screen.width - 30;
    */
    
    window.moveTo( (screen.width-imageWidth)/2, (screen.height-imageHeight)/2 )
    window.resizeTo(imageWidth, imageHeight);    
}

function SetNewSize()
{
  if (window.innerWidth)
    {
     imageWidth = window.innerWidth;
     imageHeight = window.innerHeight;
    }
    else
    {
     imageWidth = document.body.clientWidth;
     imageHeight =document.body.clientHeight;
    }
    
    
    if(document.images[0].width > imageWidth)
        imageWidth = document.images[0].width - imageWidth+10;
    else
        imageWidth = document.images[0].width +10;
        
    imageHeight = document.images[0].height - imageHeight+10;
    window.resizeBy(imageWidth+10, imageHeight+20);
}


function popup()
{
 newWindow(big_photo,10,10,'prev');
}

function change_dropdown()
{
 
 //alert ("Changing dropdown to "+id);
 id = (document.forms['search'].pr_122.value) -1;
 
 if( (id > -1) && (id < 7))
  {
  
   
  
   dropdown = document.getElementById(old_id);
   dropdown.style.visibility = 'hidden';
   dropdown.style.display = 'none';
   
   old_id = 'drop'+(document.forms['search'].pr_122.value -1);

   
   document.getElementById(old_id).style.display = '';
   document.getElementById(old_id).style.Top = dropdown.innerTop;
   document.getElementById(old_id).style.Left = dropdown.innerLeft;
   document.getElementById(old_id).style.visibility = '';  
 }
  else
  
  {
  
   dropdown = document.getElementById(old_id);
   dropdown.style.visibility = 'hidden';
   dropdown.style.display = 'none';
   
   old_id = 'drop';

   document.getElementById(old_id).style.visibility = '';
   document.getElementById(old_id).style.display = '';
   document.getElementById(old_id).style.Top = dropdown.innerTop;
   document.getElementById(old_id).style.Left = dropdown.innerLeft;
   document.getElementById(old_id).style.visibility = '';
  
  }
}


function historytoggle(id)
{
 eid = 'hist'+id;
 element = document.getElementById(eid);
 state = element.style.display;
  
 if(state == '') 
    element.style.display = 'none'
 else
    element.style.display = ''
}


function DropDownMenu(id,menu)
{
Menu = document.getElementById(menu);
Menu.style.visibility = '';
Menu.style.display = '';

    //alert('ID '+id);
     
    var parent = document.getElementById(id);
    var left = 0;
    var top = 0;
             
    while (parent != null)
      {
       left +=  parent.offsetLeft;
       top  +=  parent.offsetTop;
       parent = parent.offsetParent;
      }          
    
    
    var posX = left-4;
    var posY = top + document.getElementById(id).offsetHeight;
             
    
  
//posX = id.offsetTop + id.parent.offsetTop;


Menu.style.left = posX +'px';
Menu.style.top = posY+'px';

}

function MenuHide(id)
{

 document.getElementById(id).style.visibility = 'hidden';

}

function menuaction(id)
{
	st=false;
	link_block=true;
	links=document.getElementById('menujs').getElementsByTagName('a');
	for (i=0;i<links.length;i++)
	{
		if (st && !links[i].className) break
		if (st)
		{
			if (links[i].style.display=='none')
			{
				links[i].style.display='';
				link_block=false;
			}
			else
			{
				links[i].style.display='none';
				link_block=false;
			}
		}
		if (id==new Number(links[i].id))
			st=true;
	}
	return link_block;
}
