// JavaScript Document

function validateEmail(email) {
	var mail_pat = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	var reg_email = new RegExp(mail_pat);
	
	return email.match(reg_email);
}

function responseNumber(event) {
	if( ( event.keyCode < 48 || event.keyCode > 57 ) && 
	( event.keyCode < 35 || event.keyCode > 40 ) && 
	( event.keyCode < 96 || event.keyCode > 105 ) &&
	( event.keyCode != 8 && event.keyCode != 9 && event.keyCode != 13 && event.keyCode != 46 ) ) 
	{ Event.stop(event); }
}


function responseFloatingBox(id, style) {
	if(!$(id)) return;
	
	var floatingBoxId = 'floatingBox';// + (new Date()).getMilliseconds();
	if( $(floatingBoxId)) {
		if( $(floatingBoxId).style.display == 'none')
			$(floatingBoxId).style.display = 'block';
		else
			$(floatingBoxId).style.display = 'none';
			
		return;
	}
	
	var floatingBox = document.createElement('div');
	Element.extend(floatingBox);
	floatingBox.addClassName('floatingbox_div')
	floatingBox.id = floatingBoxId;
	document.body.appendChild(floatingBox);
	
	$(floatingBoxId).update($(id).title).setStyle(style);

	var positionXY = new String( Position.cumulativeOffset($(id)) );
	var positionX = positionXY.substr(0, positionXY.indexOf(',')) + 'px';
	var positionY = (parseInt(positionXY.substr(positionXY.indexOf(',')+1, (positionXY.length-positionXY.indexOf(',')-1)), 10)+15) + 'px';
	$(floatingBoxId).setStyle({
							  	left: positionX,
							  	top: positionY
							  });
}



/*
function responseFloatingBox(id, style) {
	if(!$(id)) return;
	
	var floatingBoxId = 'floatingBox';// + (new Date()).getMilliseconds();
	if( $(floatingBoxId)) {
		if( $(floatingBoxId).style.display == 'none')
			$(floatingBoxId).style.display = 'block';
		else
			$(floatingBoxId).style.display = 'none';
	}
	
	var floatingBox = document.createElement('div');
	Element.extend(floatingBox);
	floatingBox.addClassName('floatingbox_div')
	floatingBox.id = floatingBoxId;
	document.body.appendChild(floatingBox);
	
	$(floatingBoxId).innerHTML = $(id).title;
	$(floatingBoxId).setStyle(style);
	
	var positionXY = new String( Position.cumulativeOffset($(id)) );
	var positionX = positionXY.substr(0, positionXY.indexOf(',')) + 'px';
	var positionY = (parseInt(positionXY.substr(positionXY.indexOf(',')+1, (positionXY.length-positionXY.indexOf(',')-1)), 10)+15) + 'px';
	$(floatingBoxId).setStyle({
							  	left: positionX,
							  	top: positionY
							  });
}
function responseFloatingBox() {
	var floatingBox = document.createElement('div');
	Element.extend(floatingBox);
	floatingBox.addClassName('floatingbox_div')
	floatingBox.id = 'floatingBox';
	document.body.appendChild(floatingBox);
	
	
	//$($( 'floatingBox' ).parentNode).appendChild(document.createTextNode((Event.element(event)).title));
	
	
	
//$($('someElement').parentNode).hide()

	//floatingBox.appendChild(document.createTextNode((Event.element(event)).title));

	// insert it in the document

	alert( (Event.element(event)).title);
	//alert( (Event.element(event)).id );

if( event.returnValue ) {
		event.returnValue = false;
		event.cancelBubble = true;
	}
	if( event.preventDefault ) {
		event.preventDefault();
		event.stopPropagation();
	}

//var element = Event.element(event);
	// alert( element.id );
	// alert( event.keyCode );
	// alert( element.value );
}
*/
