Vidar = Array();
Vidar.active_tab = false;
Vidar.tabs_height = 0;
Vidar.tab_content_height = 0;
Vidar.tabs = false;
function activate_tab(obj) {
	if(!obj && document.getElementById('tab-1')) {
		obj = document.getElementById('tab-1');
	}
	if(!Vidar.tabs) { Vidar.tabs= obj.parentNode.parentNode; }
	div = false; tmp = obj; c=0;
   while(!div && c < 7) {
   	tmp = tmp.nextSibling
       if(tmp.nodeType == 1) { div = tmp }
       c++;
   }
   // div = obj.nextSibling.nextSibling
	obj.parentNode.className = 'active tab';
	if((Vidar.active_tab) && (obj.parentNode != Vidar.active_tab)){
		Vidar.active_tab.className = 'inactive tab';
	}
	Vidar.active_tab = obj.parentNode;
	height = div.clientHeight + div.offsetTop
	if(Vidar.tabs.clientHeight < height) { 
		Vidar.tab_content_height = div.clientHeight
		Vidar.tabs_height = height;
		Vidar.tabs.style.height = height+"px";
	}
	if(Vidar.tabs_height > 0){
		div.style.height = (Vidar.tab_content_height-30)+"px";
	}
}
function show_me_the_money() {
	document.getElementById('hide').style.display = 'block';
	ul = false;
	i = 0;
	uls = document.getElementsByTagName('ul')
	while((!ul) && (i < uls.length)) {
		if(uls[i].className == 'wizard') {
			ul = uls[i];
		}
		i++;
	}
	lis = ul.getElementsByTagName('li')
	for(i = 0;i<lis.length;i++) {
		lis[i].className = (lis[i].className == 'active') ? '' : 'active';
	}
	if(document.getElementById('tab-1')) { activate_tab(); }
	if(document.getElementById('mailform')) { self_label(document.getElementById('mailform')); }
}
function self_label(form) {
	if(!form) {
		form = document.getElementById('mailform');
	}
	if(form) {
		elements_c = form.elements.length;
		_labels = form.getElementsByTagName('label');
		Vidar.labels = Array();
		for(i = 0;i < _labels.length; i++) {
			label = _labels[i];
			str = label.htmlFor || label.getAttribute('for');
			text = label.textContent || label.innerHTML
			Vidar.labels[str] = text;
		}
		for(i = 0;i < elements_c; i++) {
			if(form.elements[i].type == 'text') {
				input = form.elements[i];
				input.title = Vidar.labels[input.id];
				input.onfocus = function() {label_focus(this)} ;
				input.onblur = function() {label_blur(this)} ;
				if(input.value == '') {
					input.value = Vidar.labels[input.id]
				}
			}
		}
	}
	if(document.getElementById('tab-1')) {
		activate_tab();
	}
}
function label_focus(obj) {
	if(obj.value == Vidar.labels[obj.id]) {
		obj.value = '';
	}
}
function label_blur(obj) {
	if(obj.value == '') {
		obj.value = Vidar.labels[obj.id];
	}
}
