
	
function showhide (id)
{ 
	if (document.getElementById) { 
		var obj = document.getElementById(id);
		if (obj.style.display == "none") { 
			obj.style.display = "block"; 
		} else { 
			obj.style.display = "none"; 
		}
	}
}

function show (id)
{ 
	if (document.getElementById) { 
		document.getElementById(id).style.display = "block";
	}
}

function hide (id)
{ 
	if (document.getElementById) { 
		document.getElementById(id).style.display = "none";
	}
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->

*/
  var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	
	if ((version >= 5.5) && (document.body.filters)) 
	{
	   for(var i=0; i<document.images.length; i++)
	   {
	      var img = document.images[i]
	      var imgName = img.src.toUpperCase()
	      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	      {
	         var imgID = (img.id) ? "id='" + img.id + "' " : ""
	         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
	         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
	         var imgStyle = "display:inline-block;" + img.style.cssText 
	         if (img.align == "left") imgStyle = "float:left;" + imgStyle
	         if (img.align == "right") imgStyle = "float:right;" + imgStyle
	         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
	         var strNewHTML = "<span " + imgID + imgClass + imgTitle
	         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
	         img.outerHTML = strNewHTML
	         i = i-1
	      }
	   }
	}
}

function addListeners(e) {
}

addEvent(window, 'load', addListeners, false);
if (window.attachEvent) {
	window.attachEvent("onload", correctPNG);
}

function addEvent(elm, evType, fn, useCapture)
// cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
// By Scott Andrew
{
	if (elm.addEventListener) {
	  elm.addEventListener(evType, fn, useCapture); 
	  return true; 
	} else if (elm.attachEvent) {
	  var r = elm.attachEvent('on' + evType, fn); 
	  return r; 
	} else {
	  elm['on' + evType] = fn;
	  return true; 
	}
}

function openWindow(link) {
	window.open(link, "help", "height=480,width=640,resizable=1");
	return false;
}

function openWindowArg(link, height, width) {
	window.open(link, "help", "height="+height+",width="+width+",resizable=1");
	return false;
}

function unicHideClass(className) {

  if(document.getElementsByClassName) {
		var list = document.getElementsByClassName(className);
		for (var i=0; i<list.length; i++) {
			Element.hide( list[i] );
		}
  }
}

function unicToggleClass(className) {

  if(document.getElementsByClassName) {
		var list = document.getElementsByClassName(className);
		for (var i=0; i<list.length; i++) {
			Element.toggle( list[i] );
		}
  }
}
function unicOnLoad () {
	unicHideClass("unicHide");
}

function unicToggleContent (e, c1, c2) {

    if(e.innerHTML == c1) {
	e.innerHTML = c2;
    } else {
	e.innerHTML = c1;
    }
}


function unicShowRssComment(id,rss) {

    if($(id) != null) {

	var url = '/emuseum_bin/ShowComment.asp';
	var params = 'comment='+encodeURI(rss);
	var ajax = new Ajax.Updater(id,url,
		{
			method: 'get',
			parameters: params
		});

    }

    return false;
}

function showCommentForm(formId, blogId, formDivId) {

    if($(formDivId)) {
	Element.toggle(formDivId);
    } else {
	return false;
    }

    if($(formId)) {
	$(formId).action = blogId;
	$(formId).permalink.value = $(formId).permalink.value.replace(/^permalink=(.*)/,'$1');
	Event.observe($(formId), 'submit', commentFormSubmit, true);
	return false;
    } else {
	return false;
    }

}

function commentFormSubmit(event, arg) {

    var form = Event.element(event);					// Find formularen
    var div = Event.findElement(event,'div')				// Find containing div
    Event.stop(event);   						// Stop vores submit
    Event.observe(form, 'submit', commentFormSubmit, true);		// Reetabler submit event

    form.permalink.value = form.permalink.value.replace(/^permalink=(.*)/,'$1');

    var ajax = new Ajax.Request(
	    	'/unicblog/' + form.action,
	    {
	    	method:		form.method,
		parameters: 	Form.serialize(form),
		onComplete: 	showComplete,
		onSuccess:      showSuccess,
		onFailure: 	showFailure,
		onException: 	showException,
		onCreate: 	showCreate,
		myVar: 		"stuff"
	    }
	    );

    return false;

}
function showComplete(req) {

}

function showSuccess(req) {
	alert("Tak for din kommentar" + req.options.myVar);
}

function onCreate(arg) {
    	alert(arg);
}

function showFailure(req,arg) {
	alert("Der opstod en fejl. Send venligst igen.");
}
function showException(req, e) {
	alert("Der opstod en fejl (" + e + "). Send venligst igen.");
}

