
/* <![CDATA[ */
if(document.all) {
	document.onmousemove = coords;
}
else if(document.getElementById){
	window.document.onmousemove = coords;
} else {
	window.onmousemove = coords;
	window.captureEvents(Event.MOUSEMOVE);
} 

var header_Height = 70;
var da_title = "";

function show_it(o) {
	da_title = o.title;
}

function del_it(o) {
	da_title = "";	
}

function coords(e) {
	var abk = (document.body.offsetWidth - 1000)/2;
	var x_real = 0;
	var y_real = 0;
	var x_trans;
	var y_trans;
	
	if (navigator.appName == 'Netscape') {
		x_real = e.pageX - 10;
		y_real = e.pageY;
		x_trans = Math.ceil((x_real - abk)/10) + 1;
		y_trans = Math.ceil((y_real - header_Height)/10);
		document.getElementById('coords_box').style.top = y_real + "px;";
		document.getElementById("coords_box").style.left = (x_real + 20) + "px;";
	} else {
		x_real = event.clientX - 10;
		y_real = event.clientY;
		x_trans = Math.ceil((x_real - abk)/10) + 1;
		y_trans = Math.ceil((y_real - header_Height + document.documentElement.scrollTop)/10);
		document.getElementById('coords_box').style.top = (y_real + document.documentElement.scrollTop);
		document.getElementById('coords_box').style.left = (x_real + 20 + document.documentElement.scrollLeft);
	}
	
	if ((x_trans <= 0) || (x_trans > 100) || (y_trans <= 0) || (y_trans > 100)) {
		document.getElementById('coords_box').style.display = "none";
	} else {
		document.getElementById('coords_box').style.display = "";
		if (da_title != "") {
			document.getElementById('x_coord').innerHTML = da_title;
			document.getElementById('y_coord').innerHTML = "";
		} else {
			document.getElementById('x_coord').innerHTML = "This pixelspace is available! ";
			document.getElementById('x_coord').innerHTML += " (x: " + x_trans + ", y: ";
			document.getElementById('y_coord').innerHTML = y_trans + ")";
		}
	}
}

function calculate_price() {
	
	if (isNaN(document.calculate.minutes.value)) document.calculate.minutes.value = 0;
	if (isNaN(document.calculate.seconds.value)) document.calculate.seconds.value = 0;

	// check for minimum
	if (document.calculate.minutes.value * 60 + document.calculate.seconds.value*1 < 20)  {
		alert("The minimum to buy is 20 seconds.");
		return;
	}
	
	// Calculate seconds
	sum_seconds = document.calculate.minutes.value * 60 + document.calculate.seconds.value*1;
	document.calculate.sum_seconds.value = sum_seconds + " seconds.";
	
	// Calculate price
	price = Math.ceil(sum_seconds/20)*20;
	document.calculate.price.value = price + " US Dollar.";
	
	// Calculate amount of pixels
	pixel = Math.floor(price/100)*100;
	document.calculate.pixel.value = pixel + " pixels.";
}
		
/* ]]> */
