function search(){
	if(document.getElementById('search_input').value)
		document.getElementById('search_form').submit();
	else
		document.getElementById('search_input').focus();
}

function openImageForDog(obj){

	var width=800;
	var height=600;
	var h=0;

	if(typeof(screen)!='undefined'){
		x=(screen.width-width)/2;
		y=(screen.height-height-h)/2-60;
		if(navigator.userAgent.toLowerCase().indexOf('opera')!=-1)
			y-=50;
	}else{
		x=300;
		y=200;
	}
	var myWin=open(obj.href,'','width='+(width)+', height='+(height+h)+', left='+x+', top='+y+', scrollbars=yes, resizable=yes');
	return false;
}

function openImage(obj, id, width, height, title, content){
	if(content==undefined)
		content='';
	title=title.replace(/<br[ \/]*>/,' ');
	var h=0;

	if(typeof(screen)!='undefined'){
		x=(screen.width-width)/2;
		y=(screen.height-height-h)/2-60;
		if(navigator.userAgent.toLowerCase().indexOf('opera')!=-1)
			y-=50;
	}else{
		x=300;
		y=200;
	}
	//alert('screen.width='+screen.width+'\n'+'screen.height='+screen.height+'\n'+'x='+x+'\n'+'y='+y+'\n');

	//var myWin=open(obj.href,'w'+obj.href,'width='+width+', height='+(height+h)+', left='+x+', top='+y+', scrollbars=yes, resizable=yes');
	var myWin=open(obj.href,'','width='+(width)+', height='+(height+h)+', left='+x+', top='+y+', scrollbars=yes, resizable=yes');
	myWin.document.writeln('<html><head><title>'+title+'</title><style>'+
	'body {'+
		'overflow: auto;'+
	'}'+
	'html, body {'+
		'margin: 0;'+
		'padding: 0;'+
		'font-family: Verdana;'+
	'}'+

	'#div_id {'+
		'position: absolute;'+
		'right: 5px;'+
		'top: 5px;'+
		'padding: 0px 10px;'+
		'font-size: 10px;'+
		'background-color: #eee;'+
		'border: 1px solid #999;'+
	'}'+

	 '#div_content {'+
		'margin: 10px 10px 5px;'+
		'padding: 0;'+
		'font-size: 12px;'+
		'font-weight: bold;'+
	'}'+

	'</style></head><body><img src="'+obj.href+'" width="'+width+'" height="'+height+'" /><br /><div id="div_id">¹ <b>'+id+'</b></div>');
	if(content)
		myWin.document.writeln('<div id="div_content">'+content+'</div>');
	myWin.document.writeln('</body></html>');
	myWin.document.close();
	
	//myWin.resizeTo(width, height+h+10);
	if(content) {
		h=myWin.document.getElementById('div_content').clientHeight;
		if(navigator.userAgent.toLowerCase().indexOf('firefox')!=-1)
			h+=15;
		if(h)
			myWin.resizeBy(0,h+20);
		else
			myWin.resizeBy(0,60);
	}
	return false;
}

