function tablemarker() {
	if (document.getElementById && document.createTextNode) {
		var tables = document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++) {
			if (tables[i].className=='marker') {
				var trs=tables[i].getElementsByTagName('tr');
				for (var j=0;j<trs.length;j++) {
					if (trs[j].parentNode.nodeName=='tbody' && trs[j].parentNode.nodeName!='tfoot') {
						trs[j].onmouseover = function(){this.className='active';return false}
						trs[j].onmouseout = function(){this.className='';return false}
					}
				}
			}
		}
	}
}

function goto(href) {
	if (href) window.location.reload = href;
}

function sub(form,action) {
	document.forms[form].form_tab.value = action;
	document.forms[form].submit();
}

function email(name,domain) {
	document.write(name);
	document.write("&#64;");
	document.write(domain);
}

function popup(action,width,height,scroll) {
	var name = "message"
	if ((width<0) && (height<0)) {
		var left = Math.abs(width)
		var top = Math.abs(height)
		var width = screen.width-(left*2)
		var height = screen.height-(top*2)
	} else {
		var left = (screen.width-width)/2
		var top = (screen.height-height)/2
	}
	action = action + "&amp;window_width=" + width + "&amp;window_height=" + height
	name = name + "_" + width + "x" + height
	var tools = 'toolbar=0,scrollbars=' + scroll + ',location=0,status=0,menubar=0,resizable=1,width=' + width + ',height=' + height + ',left=' + left + ',top=' + top
	PopUp = window.open(action,name,tools)
}

//Fade-in image slideshow- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var ie4=document.all
var dom=document.getElementById

//if (ie4||dom)
//	document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div  id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:0;left:0;filter:alpha(opacity=10);-moz-opacity:10"></div></div>')
//else
//	document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')

var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1

function fadepic() {
	if (curpos<100){
		curpos+=10
	if (tempobj.filters)
		tempobj.filters.alpha.opacity=curpos
	else if (tempobj.style.MozOpacity)
		tempobj.style.MozOpacity=curpos/100
	} else {
		clearInterval(dropslide)
		nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
		tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
		tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
		nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
		setTimeout("rotateimage()",pause)
	}
}

function rotateimage() {
	if (ie4||dom) {
		resetit(curcanvas)
		var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
		crossobj.style.zIndex++
		var temp='setInterval("fadepic()",speed)'
		dropslide=eval(temp)
		curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
	} else
		document.images.defaultslide.src=fadeimages[curimageindex]
	curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}

function resetit(what) {
	curpos=10
	var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
	if (crossobj.filters)
		crossobj.filters.alpha.opacity=curpos
	else if (crossobj.style.MozOpacity)
	crossobj.style.MozOpacity=curpos/100
}

function startit() {
	var preloadedimages=new Array()
	for (p=0;p<fadeimages.length;p++) {
		preloadedimages[p]=new Image()
		preloadedimages[p].src=fadeimages[p]
	}
	var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
	crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
	rotateimage()
}

function javaconfirm(text,ok) {
	var x=window.confirm(text)
	if (x) window.location=ok
}

if (window != top) top.location.href = location.href;

function fieldset_hide(box,id) {
	if (box.checked) {
		document.getElementById(id).style.visibility = "visible";
		document.getElementById(id).style.display = "block";
	} else {
		document.getElementById(id).style.visibility = "hidden";
		document.getElementById(id).style.display = "none";
	}
}

function hide_elements() {
	for(id in elements) {
		document.getElementById(elements[id]).style.visibility = "hidden";
		document.getElementById(elements[id]).style.display = "none";
	}
}

function show_element(id) {
	document.getElementById(elements[id]).style.visibility = "visible";
	document.getElementById(elements[id]).style.display = "block";
}

function test_type(id) {
	hide_elements();
	if (document.getElementById(id).value == "") return;
	index = "edit[extra_" + document.getElementById(id).value + "]";
	if (document.getElementById(index)) {
		if (document.getElementById(index).value == "") return;
		var str = document.getElementById(index).value;
		ar = str.split("|");
		for (i=0;i<ar.length;i++) show_element(i);
		document.getElementById("extra_label").innerHTML = ar[0];
	}
}
