/**
	TODO: disable functionality, move iframe under popup;
**/
var myAnim2;


function initHS() {
	//Functions
	this.prepare 	= prepareHS;
	this.show		= showHS;
	this.hide		= hideHS;
	this.setText	= setTextHS;
	//Parameters
	this.text		= '';
	var predefines	= new Array();
	predefines[0] = 'This is an information toolbar';
	predefines[1] = 'Use your left and right keys from your keyboard to browse forward or back';
	predefines[2] = 'If you think that the content of this photo is inappropriate click here to report this image';
	predefines[3] = 'If a picture is not assigned to a gallery it will not be visible to other users of the site. You have to assign a picture to a gallery, such as your Main Gallery or one created by you, for it to be accessible through your profile.<br /><br />Your "Picture Box" works simply as picture storage, not visible for other users. You can choose to assign pictures to different galleries at any time and not only when you are uploading them.<br /><br />The first 20 pictures will automatically be assigned to your Main Gallery. Each gallery has a limit of twenty pictures, with the exception of "Polaroids", which has a limit of four pictures.';
	predefines[4] = 'This is an information toolbar';
	predefines[5] = 'All uploaded pictures are stored in your Picture Box. You can assign them to one or more galleries at any time before or after the upload process.';
	predefines[6] = 'You can make your pictures in picture box invisible by clicking "Hide". It makes the picture hidden only in your picture box.';
	this.predefines	= predefines;


	this.holder = document.createElement('div');
	var table 	= document.createElement('table');
	var tbody 	= document.createElement('tbody');
	var tr		= document.createElement('tr');

	this.holder.style.visibility	= 'hidden';
	this.holder.id					= 'helper';
	this.holder.style.position 		= "absolute";
	//this.holder.style.height 		= '200px';
	this.holder.style.width 		= '400px';
	this.holder.style.zIndex 		= 120;
	this.holder.style.left			= '50px';
	this.holder.style.top			= 0;
	this.holder.style.overflow		= 'hidden';

	table.width	= '100%';
	table.border	= '0';
	table.style.borderCollapse	= 'collapse';
	table.style.position 		= "absolute";
	table.style.bottom	= 0;

	//Create the second row...
	var tr = document.createElement('tr');

	var td1 = document.createElement('td');
	td1.style.padding 		= '0';
	td1.style.background 	= 'url('+WEBPATH+'images/frame/frame_bgnd_left.png)';
	td1.style.behavior	 	= 'url('+WEBPATH+'js/iepngfix.htc)';
	td1.style.width	 		= '20px';
	td1.innerHTML 			= '&nbsp;';


	this.td_ico = document.createElement('td');
	this.td_ico.width 		= '20';
	this.td_ico.style.padding 		= '10px 6px 0 0';
	this.td_ico.style.background 	= 'url('+WEBPATH+'images/frame/frame_bgnd.png)';
	this.td_ico.style.behavior	 	= 'url('+WEBPATH+'js/iepngfix.htc)';
	this.td_ico.innerHTML 			= '<img src="'+WEBPATH+'images/hint.gif">';
	this.td_ico.vAlign			= "top";
	///this.td_ico.style.textAlign		= "justify";
	
	
	this.td_c = document.createElement('td');
	this.td_c.style.padding 		= '13px 0 0 4px';
	this.td_c.style.background 	= 'url('+WEBPATH+'images/frame/frame_bgnd.png)';
	this.td_c.style.behavior	 	= 'url('+WEBPATH+'js/iepngfix.htc)';
	this.td_c.innerHTML 			= '';
	this.td_c.style.color			= "white";
	this.td_c.style.textAlign		= "justify";

	var td3 = document.createElement('td');
	td3.style.padding 		= '0';
	td3.style.background 	= 'url('+WEBPATH+'images/frame/frame_bgnd_right.png)';
	td3.style.behavior	 	= 'url('+WEBPATH+'js/iepngfix.htc)';
	td3.innerHTML 			= '&nbsp;';
	td3.style.width	 		= '20px';

	tr.appendChild(td1);
	tr.appendChild(this.td_ico);
	tr.appendChild(this.td_c);
	tr.appendChild(td3);

	tbody.appendChild(tr);

	//Create the last row...
	var tr = document.createElement('tr');

	var td1 = document.createElement('td');
	td1.style.padding 		= '0';
	td1.style.background 	= 'url('+WEBPATH+'images/frame/frame_bottom_left.png)';
	td1.style.behavior	 	= 'url('+WEBPATH+'js/iepngfix.htc)';


	var td2 = document.createElement('td');
	td2.colSpan 			= 2;
	td2.style.padding 		= '0';
	td2.style.background 	= 'url('+WEBPATH+'images/frame/frame_bgnd_bottom.png)';
	td2.style.behavior	 	= 'url('+WEBPATH+'js/iepngfix.htc)';
	td2.height 				= '20';
	td2.innerHTML 			= '&nbsp;';

	var td3 = document.createElement('td');
	td3.style.padding 		= '0';
	td3.style.background	= 'url('+WEBPATH+'images/frame/frame_bottom_right.png)';
	td3.style.behavior	 	= 'url('+WEBPATH+'js/iepngfix.htc)';
	td3.innerHTML 			= '&nbsp;';

	tr.appendChild(td1);
	tr.appendChild(td2);
	tr.appendChild(td3);

	tbody.appendChild(tr);

	table.appendChild(tbody);
	this.holder.appendChild(table);
	document.body.appendChild(this.holder);
}

function prepareHS(id) {
	this.text = this.predefines[id];
}

function setTextHS(text) {
	this.text = text;
}

function showHS(id) {
	if (typeof id != 'undefined') {
		this.prepare(id);
	}
	this.td_c.innerHTML 		 = this.text;
	this.holder.style.left		 = '50px';
	this.holder.style.top		 = windowScrollY + 'px';
	this.holder.style.visibility = 'visible';

	var myAnim2 = new YAHOO.util.Anim('helper', {height: {from:0, to: parseInt(this.td_c.clientHeight)+20}}, 1, YAHOO.util.Easing.bounceOut);
	myAnim2.animate();
	//alert(myAnim2.animate());
}

function hideHS() {
	var myAnim = new YAHOO.util.Anim('helper', {height: {to: 0}}, 1);
	myAnim.animate();
	//myAnim.onComplete.subscribe(removeElement);
	//this.holder.style.visibility = 'hidden';
}

function removeElement() {
	$('helper').style.visibility = 'hidden';
}