var Obj;

function ImageTip(obj, src){
	ToolTip(obj, src, 80, -10);
}

function ImageLargeTip(obj, src, w, h, text){
	var offset = 10;
	var myWidth = 0;
	var myHeight = 0;
	var vscroll = (document.all ? document.body.scrollTop : window.pageYOffset);
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}

	Obj=document.getElementById('Pop');
	Obj.innerHTML="<img src='" + src + "' alt='' width='" +w+ "' height='" +h+ "' border=0 /><div class=\"tipText\" >" + text + "</div>";

	//0 - x
	//1 - y
	//2 - w
	//3 - h
	var pos = zxcPos(obj);
	var objPos = zxcPos(Obj);

	objPos[1] = document.getElementById('Pop').offsetTop;
	//alert(objPos);
	//adjusting X
	if (pos[0]+pos[2]+offset+offset+w > myWidth-offset) {
		Obj.style.left=(pos[0]-offset-w-offset)+'px';
	} else {
		Obj.style.left=(pos[0]+pos[2]+offset)+'px';
	}

	//adjusting Y
	if (pos[1]-offset+objPos[3]-vscroll > myHeight-offset-offset) {
		Obj.style.top=(myHeight-offset-offset-objPos[3]+vscroll)+'px';
	} else {
		Obj.style.top=(pos[1]-offset)+'px';
	}

	Obj.style.visibility='visible';
}

function perPage(obj){
	var chosenoption = obj.options[obj.selectedIndex]
	if (chosenoption.value!="nothing"){
		goto('fotobalionai/list/?perPage=' + chosenoption.value);
 	}
}

function ToolTip(obj, src, x, y){
	Obj=document.getElementById('Pop');
	Obj.innerHTML="<img src='" + src + "' alt='' />";
	Obj.style.left=(zxcPos(obj)[0]+x)+'px';
	Obj.style.top=(zxcPos(obj)[1]+y)+'px';
	Obj.style.visibility='visible';
}

function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function Hide(){
	Obj.style.visibility='hidden';
}

function zxcPos(zxcobj){
	var zxclft=zxcobj.offsetLeft;
	var zxctop=zxcobj.offsetTop;
	var zxcwidth=zxcobj.width > 0 ? zxcobj.width : zxcobj.offsetWidth;
	var zxcheight=zxcobj.height > 0 ? zxcobj.height : zxcobj.offsetHeight;
	while(zxcobj.offsetParent!=null){
		zxcpar=zxcobj.offsetParent;
		zxclft+=zxcpar.offsetLeft;
		zxctop+=zxcpar.offsetTop;
		zxcobj=zxcpar;
	}
	return [zxclft,zxctop,zxcwidth,zxcheight];
}


function onlyDigits(e){
    var _ret = true;
    var evtobj=window.event? event : e  //distinguish between IE's explicit event object (window.event) and Firefox's implicit.
    var keyID=evtobj.charCode? evtobj.charCode : evtobj.keyCode;
//alert(keyID);
    if (keyID > 31 && (keyID < 35 || keyID > 40) && (keyID < 48 || keyID > 57) && keyID!=46) {
        keyID = 0;
        _ret = false;
    }
    return (_ret);
}
