function ClientBrowse() { this.w=0; this.h=0;
if (self.screen) { this.w=screen.width; this.h=screen.height; }
else if (self.java) { var jkit=java.awt.Toolkit.getDefaultToolkit(); var scrsize=jkit.getScreenSize(); this.w=scrsize.width; this.h=scrsize.height; } return this; }

function oPic(obj,w,h) { p=new ClientBrowse();
obj=obj.firstChild; endNum=obj.src.lastIndexOf("/"); obj=obj.src.substring(endNum+1);
if (w) { leftPos=(p.w-w)/2; } else { w=p.w-100; leftPos=(p.w-w)/2; } if (h) { topPos=(p.h-h)/2; } else { h=p.h-100; topPos=10; }
s=0; nwin="vpic"; var property="left="+leftPos+",top="+topPos+",width="+w+",height="+h+",scrollbars="+s;
window.open ("/gallery/show_photo/?"+obj,nwin,property); }

function OpenWin(url,nwin,widthWin,heightWin,sbar) { p=new ClientBrowse();
if (widthWin) { leftPos=(p.w-widthWin)/2; } else { widthWin=p.w-100; leftPos=(p.w-widthWin)/2; }
if (heightWin) { topPos=(p.h-heightWin)/2; } else { heightWin=p.h-100; topPos=10; }
(sbar==1)?null:sbar=0; (nwin)?null:nwin="win"; var property="left="+leftPos+",top="+topPos+",width="+widthWin+",height="+heightWin+",scrollbars="+sbar;
window.open (url,nwin,property); }


dom = (document.getElementById) ? true : false;
nn4 = (document.layers) ? true : false;
ie = (document.all) ? true : false;
ie4 = ie && !dom;
function empty(){}

var stdMouseX = -1, stdMouseY = -1;
var MouseMoved = 0;
var hint="";
var MouseMove = empty;
var Init = empty;

if(nn4) document.captureEvents(Event.MOUSEMOVE); 
document.onmousemove = stdMouseMove; 

function stdMouseMove(e)
{
	stdMouseX = (nn4) ? (e.pageX):(event.x + document.body.scrollLeft);
	stdMouseY = (nn4) ? (e.pageY):(event.y +document.body.scrollTop + document.documentElement.scrollTop);
	MouseMoved++;
	MouseMove(e);
	HintMouseMove();
}


function HintMouseMove()
{
	if(hint)moveElem(hint, stdMouseX-30, stdMouseY+20);
}

function showElem(elemId) {
if (dom) document.getElementById(elemId).style.display = "block";
	else if (ie4) document.all[elemId].style.display = "block";
		else if (nn4) document.layers[elemId].display = "show";
}

function hideElem(elemId) {
if (dom) document.getElementById(elemId).style.display = "none";
	else if (ie4) document.all[elemId].style.display = "none";
		else if (nn4) document.layers[elemId].display = "hide";
}

function moveElem(idname,x,y)
{
if (dom)
	with(eval(idname)){
		style.left = x;
		style.top = y;
	}
else if(nn4){
		document.layers[idname].left=x;
		document.layers[idname].top=y;
	}
}

function OverIm(id)
{
	if(hint)hideElem(hint);
	hint=id;
	moveElem(hint, stdMouseX-30, stdMouseY-90);
	showElem(hint);
}

function OutIm()
{
	hideElem(hint);
	hint="";
}

function getElementsByClassName(classname, tag_name, node)  {
    if(!node) node = document.getElementById('left');
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName(tag_name);
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}

function getCookie(c_name) {
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}
