function mouseover(el) {
  el.className = "raised";
}

function mouseout(el) {
  el.className = "button";
}

function mousedown(el) {
  el.className = "pressed";
}

function mouseup(el) {
  el.className = "raised";
}
/////////////////////////////////////////////////////////
var layer = null;
var image = null;
var counterID = 0;
var w3c = document.getElementById;
var ns;
var ie;
if(!w3c) {
	ns = (document.layers) ? true : false;
	ie = (document.all) ? true : false;
}

var checkboxes = 1;

var lastVisibleCounter = 0;



function voider() {
	;
}

function getImagePageLeft(img) {
	if(ie || w3c) {
		var x, obj;
		x = 0;
		obj = img;
		while (obj.offsetParent != null) {
			x += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		x += obj.offsetLeft;
		return x;
	}

	if(w3c)
		return img.offsetLeft;

	if(ns)
		return img.x;

	return -1;
}

function getImagePageTop(img) {
	if(ie || w3c) {
		var y, obj;
		y = 0;
		obj = img;
		while (obj.offsetParent != null) {
			y += obj.offsetTop;
			obj = obj.offsetParent;
		}
		y += obj.offsetTop;
		return y;
	}

	if(w3c)
		return img.offsetTop;

	if(ns)
		return img.y;

	return -1; 
}



function showLayer(imageName) {
	var showhide;

	if(lastVisibleCounter == imageName || !imageName) {
		//showHide = "vihidden";
		showHide = "hidden";
		lastVisibleCounter = 0;
	} else {
		showHide = "visible";
		lastVisibleCounter = imageName;
	}

	var whichLayer = 'counterMenu';

	var style;

	if(w3c)
		
		style = document.getElementById(whichLayer).style;
	else if(ie)
		
		style = document.all[whichLayer].style;
	else if(ns)
		
		style = document.layers[whichLayer];


	var image;
	if(imageName)
		image = document.images[imageName];

	if(image) {
		style.left = getImagePageLeft(image) + image.width;
		style.top =  getImagePageTop(image);
	}
	style.visibility = showHide;
}

function selectallcounters(check) {
	var f = document.forms["counters"];
	for (var i = 0 ; i < f.elements.length ; i++) {
		if (f.elements[i].type == "checkbox")
			f.elements[i].checked = check;
	}
	checkboxes = !checkboxes;
}

function newLocation(tab, link) {
	showLayer(0);
	window.location='s?tab=' + tab + '&link=' + link + '&id='+counterID;
	return false;
}
