function pic_popup(p_id, w, h){
	
	var picpop = window.open('thumb.php?id='+p_id,'Popup','top=5, left=5, toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=' + w + ',height='+ h);
	picpop.focus();
}

function openMedImg(img_url,img_width, real_width, real_height)
{
	document.images['medImg'].src = img_url;
	document.images['medImg'].width = img_width;
	document.images['medImg'].real_width = real_width;
	document.images['medImg'].real_height = real_height;
}

function openBigImg(popup_title)
{
	var pic = document.images['medImg'].src;
	var nam = '';
	var w = document.images['medImg'].real_width;
	var h = document.images['medImg'].real_height;
	wh = parseInt(w)+30;
	hh = parseInt(h)+30;
	
	var handler = window.open('','','scrollbars=yes,toolbar=no,statusbar=no,resizable=yes,width='+wh+',height='+hh);
	handler.document.open();
	handler.document.writeln('<html><head><title>'+popup_title+'</title></head><body style="margin-top: 0px;margin-left: 0px;">');
	handler.document.writeln('<table border="0" cellspacing="0" cellpadding="0" width="'+w+'"><tr><td valign="middle" align="center">');
	handler.document.writeln('<img title="'+nam+'" alt="'+nam+'" src="'+pic+'">');
	handler.document.writeln('</td></tr></table>');
	handler.document.writeln('</body></html>');
	handler.document.close();
	handler.focus();
}


var windowNote;

function redirect_per_page(redirect)
{
	document.location = redirect + "&per_page=" + document.per_page.num.value;
}
function redirect_sort(redirect)
{
	document.location = redirect + "&sort=" + document.sort.num.value;
}
function showPic(title, pic, colorBack, wid, hei)
{
	windowNote = window.open('','Note','top=5, left=5, toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=' + wid + ',height='+ hei);
	image = '<a href="javascript:window.close()"><img src="'+ pic +'" width="'+ wid +'" height="'+ hei +'" border="0" alt="X"></a>';
	text = "<html><head><META HTTP-EQUIV=\"imagetoolbar\" CONTENT=\"no\"><title>"+ title + "</title></head><body bgcolor=\"#" + colorBack +"\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">" + image + "</body></html>";
	windowNote.document.write(text);
	windowNote.focus();
	windowNote.document.close();
	return false;
}

var type = "IE";
BrowserSniffer();
function BrowserSniffer()
{
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";	//Opera
	else if (document.all) type="IE";							//Internet Explorer e.g. IE4 upwards
	else if (document.layers) type="NN";							//Netscape Communicator 4
	else if (!document.all && document.getElementById) type="MO";				//Mozila e.g. Netscape 6 upwards
	else type = "IE";									//I assume it will not get here
}
function hide_div(div_name)
{
	if (type=="IE") eval("document.all."+div_name+".style.display='none'");
	if (type=="NN") eval("document."+div_name+".display='none'");
	if (type=="MO" || type=="OP") eval("document.getElementById(div_name).style.display='none'");
}
function showhide_div(div_name)
{
	if (type=="IE")
	{
		if(eval("document.all."+div_name+".style.display")!='none')
		{
			eval("document.all."+div_name+".style.display='none'");
		}
		else
		{
			eval("document.all."+div_name+".style.display='block'");
		}
	}
	if (type=="NN")
	{
		if(eval("document."+div_name+".display")!='none')
		{
			eval("document."+div_name+".display='none'");
		}
		else
		{
			eval("document."+div_name+".display='block'");
		}
		
	}
	if (type=="MO" || type=="OP")
	{
		if(eval("document.getElementById(div_name).style.display")!='none')
		{
			eval("document.getElementById(div_name).style.display='none'");
		}
		else
		{
			eval("document.getElementById(div_name).style.display='block'");
		}
		
	}
}