﻿/*
	(C) www.dhtmlgoodies.com, September 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	*/	
	function showHideAnswer(divid)
{
var numericID = 0;

numericID = divid.replace(/[^\d]/g,'');

//alert ('id=' + id + ' numericid= ' + numericID )

var obj = document.getElementById('a' + numericID);
if(obj.style.display=='block'){
obj.style.display='none';
}else{
obj.style.display='block';
} 
}

function setonclick()
{
showHideAnswer (this.id)
}


function initShowHideContent()
{
var qryid;

var divs = document.getElementsByTagName('DIV');
for(var no=0;no<divs.length;no++){
if(divs[no].className=='question' || divs[no].className=='subquestion'){
divs[no].onclick = setonclick;
}
}
qryid=getQuerystring ("id");
if (qryid!="")
{
showHideAnswer ('q'+qryid);
} 

}

function getQuerystring(key, default_)
{
if (default_==null) default_=""; 
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
} 
