// JavaScript Document

var xmlDoc;

function $(e){
	var obj = document.getElementById(e)
	if(obj){return obj;}return false;
}

function scale(e, t, start, end){
	var steps = 15;	
	var interval = (t * 1000) / steps;
	var step = (parseInt(start) - parseInt(end))/steps;
	for(var i=0; i<steps; i++){
		console.log((start - (step * i)));
		setTimeout(	'do_scale("'+e+'",' + (start - (step * i))+')',  (interval*i));
	}
}


function do_scale(e, h){
	$(e).style.height = h+'px';	
	$(e).firstChild.height = h+'px';
}

function slide(e, t, start, end){
	var fx = new Fx.Styles($(e), {duration: t*1000, wait:false, transition: Fx.Transitions.Quad.easeOut});
	fx.start(
		//{'margin-left': 0, 'background-color': '#333', 'color': '#888'}
		{'top':end, 'height':500}
	);
}


function move(e, t, start, end){
	console.log("move");
	var steps = 24;
	
	console.log(e + " :: " + t + " :: " + start + " :: " + end);
	
	var interval = (t * 1000) / steps;
	
	var step = (parseInt(start) - parseInt(end))/steps;
	
	for(var i=0; i<steps; i++){
		console.log((start - (step * i)));
		setTimeout(	'do_move("'+e+'",' + (start - (step * i))+')',  (interval*i));
	}
}


function do_move(e, h){
	$(e).style.top = h+'px';	
	$(e).firstChild.top = h+'px';
}


function setContent(c){
	$('content').innerHTML = c;
}


function loadXML(){
	// code for IE
	if (window.ActiveXObject){
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async=false;
		xmlDoc.load("note.xml");
		getmessage();
	}else if (document.implementation && document.implementation.createDocument){
	// code for Mozilla, Firefox, Opera, etc.
		xmlDoc=document.implementation.createDocument("","",null);
		xmlDoc.load("note.xml");
		xmlDoc.onload=getmessage;
	}else{
		alert('Your browser cannot handle this script');
	}
}