			
//<!--

function showArticle(whichLayer)
{
	//if (document.getElementById)
		document.getElementById(whichLayer).style.display = 'block';
}

function showLayer(whichLayer)
{
	//if (document.getElementById)
		document.getElementById(whichLayer).style.display = 'block';

}

function hideLayer(whichLayer)
{
	//if (document.getElementById)
		document.getElementById(whichLayer).style.display = 'none';
}

function changeColorOver(document_id)
{
	var el = getElement('short-' + document_id);
	if(el)
	{
		el.id = 'short-over';
	}
}


function changeColor(document_id)
{
	var el = getElement('short-over');
	if(el)
	{
		el.id = 'short-' + document_id;
	}
}

var win=null;
function NewWindow(mypage,w,h,bScroll,bMenu,bResize, sWinName){
	var LeftPosition, TopPosition, settings
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=((screen.height)?(screen.height-h)/2:100)-100;
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+bScroll+',location='+bMenu+',directories='+bMenu+',status='+bMenu+',menubar='+bMenu+',toolbar='+bMenu+',resizable='+bResize;
	
	if(win)
	{
		win.close();
		win=window.open(mypage,sWinName,settings);
		win.focus();
	}
	else
	{
		win=window.open(mypage,sWinName,settings);
//		win.resizeTo(w,h); 
		win.focus();
	}				
}

function checkSubmit(e, jsCode)
{
	var charCode = (navigator.appName == "Netscape")? e.which : e.keyCode;
	if(charCode == 13)
	{
		e.keyCode = 9;
		eval(jsCode);
	}
}


function IfSubmit(e)
{
	var charCode = (navigator.appName == "Netscape")? e.which : e.keyCode;
	if(charCode == 13)
	{
		e.keyCode = 9;
		return true;
	}
	return false;
}


function TieButton(e, btn){
		if(((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)))
		{
			e.returnValue=false;
			e.cancel=true;
			btn.click();
		}
}


function doSearchFormKeyDown(e,document_id, textbox)
{
	if(((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)))
	{
		e.returnValue=false;
		e.cancel = true;
		document.location.href = "?did=" + document_id + "&" +  textbox.name + "=" + textbox.value;
		return false;
	}
	return true;
}

function doSearchForm(document_id, textbox)
{
	var loc;
	
	loc = "?did=" + document_id + "&" +  textbox.name + "=" + textbox.value;
	
	// loc is the relative path your wish to redirect to
	var b = document.getElementsByTagName('base');
	if (b && b[0] && b[0].href) {
	if (b[0].href.substr(b[0].href.length-1) == '/' && loc.charAt(0) == '/')
		loc = loc.substr(1);
	loc = b[0].href + loc;
	}
	location.href = loc;
}


function doSearchFormFromArchive(sitedirectory_id, textbox)
{
	document.location.href = "?aid=" + sitedirectory_id + "&" +  textbox.name + "=" + textbox.value;
}

function getElement(elName)
{	
	return document.all ? document.all(elName) : document.getElementById ? document.getElementById(elName) : document.layers ? document.layers[elName] : null;
}

function getSelectedRadio(buttonGroup) {
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].checked) {
            return i
         }
      }
   } else {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} 

function getSelectedRadioValue(buttonGroup) {
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) {
      return "";
   } else {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} 
function doVoteForm(document_id, radiobutton, bUseOwnWindow)
{
	var iObjectId = getSelectedRadioValue(radiobutton)
	if(iObjectId > -1)
	{
		if(bUseOwnWindow == false)
		{
			document.location.href = "?did=" + document_id + "&documentobjectid=" +  iObjectId + "&viewtype=vote";
		}
	}
}

var wndPopUp = null;
var sImageGalleryWindowProperties = 'toolbar=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=780,height=490';

function doWndImageGallery(sImageGalleryPath, sParam)
{
	if(wndPopUp!=null)
		wndPopUp.close();
	var strParam, nw;
	strParam = 'default.aspx?';
	if(sParam) 
		strParam += sParam;
	nw = open(sImageGalleryPath + strParam, 'Archive',sImageGalleryWindowProperties);
	wndPopUp = nw;
	nw.focus();
}

function addImage(file, element)
{
	var nr = new String()
	nr = element.replace('src', '');

	var fileId = parseInt(file.Id, 10);
	var ext = file.Fileextension;

	eval(element + '.value="' + fileId + ext + '"');

	var width = parseInt(file.Width, 10);
	var height = parseInt(file.Height, 10);
	
	if (parseInt(width, 10)<=69 && parseInt(height,10)<=68) // and )
	{
		previewImage(fileId, ext, nr, parseInt(width, 10), parseInt(height,10));
		return;
	}
	else
	{
		if (parseInt(width, 10)<parseInt(height,10))
		{
			previewImage(fileId, ext, nr, (parseInt(width, 10)/parseInt(height,10))*68, 68);
		}
		else
		{
			previewImage(fileId, ext, nr, 69, (parseInt(height,10)/parseInt(width, 10))*69);
		}
	}
}

function previewImage(fileId, ext, nr, width, height)
{
	eval(nr + 'Image.src="arch/_img/w69/' + fileId + ext + '"');
	eval(nr + 'Image.width=' + width);
	eval(nr + 'Image.height=' + height);
}

var winImage=null;

function ShowImage(src,bScroll,bMenu,bResize, sWinName){
	var LeftPosition, TopPosition, settings
	
	if (document.getElementById(src))
	{	
		if (document.getElementById(src).value=='') return;
		
		settings='scrollbars='+bScroll+',location='+bMenu+',directories='+bMenu+',status='+bMenu+',menubar='+bMenu+',toolbar='+bMenu+',resizable='+bResize;
		if(winImage)
		{
			winImage=window.open('arch/_img/' + document.getElementById(src).value,sWinName,settings);
			winImage.focus();
		}
		else
		{
			winImage=window.open('arch/_img/' + document.getElementById(src).value,sWinName,settings);
			winImage.focus();
		}
	}
}

function deleteImage(src)
{
	if (document.getElementById(src)) document.getElementById(src).value='';
	
	var obj = document.getElementById(src.replace('src', '') + 'Image'); 
	if (obj)
	{
		obj.src="im/trans.gif";
		obj.width=70;
		obj.height=50;
	}
}

function addHrefFromArchive(object, element)
{	
	switch(getObjectClass(object))
	{
		case 'file_data':
			eval(element + '.value = "arch/_img/' + object.Id + object.Fileextension + '"');
			break;
		case 'folder_data':
			eval(element + '.value = ' + object.Id);
			break;
		case 'document_data':
			eval(element + '.value = "?did=' + object.Id + '"');
			break;
		case 'sitedirectory_data':			
			eval(element + '.value = "?aid=' + object.Id + '"');
			break;
		default:
			alert('Unsupported objecttype: ' + getObjectClass(object) + '\n' + 'Must be "sitedirectory_data", "document_data" or "file_data"');
	}
	
}

function addIdFromArchive(object, element)
{	
	switch(getObjectClass(object))
	{
		case 'file_data':
			eval(element + '.value = "' + object.Id + '"');
			break;
		case 'folder_data':
			eval(element + '.value = ' + object.Id);
			break;
		case 'document_data':
			eval(element + '.value = "' + object.Id + '"');
			break;
		case 'sitedirectory_data':			
			eval(element + '.value = "' + object.Id + '"');
			break;
		default:
			alert('Unsupported objecttype: ' + getObjectClass(object) + '\n' + 'Must be "sitedirectory_data", "document_data" or "file_data"');
	}
	
}

function getObjectClass(obj)
{
	if (obj && obj.constructor && obj.constructor.toString)
	{
		var arr = obj.constructor.toString().match(/function\s*(\w+)/);
		return arr && arr.length == 2 ? arr[1] : undefined;
	}
	else
	{
		return undefined;
	}
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
//expires = expires * 1000 * 60 * 60 * 24;
expires = expires * 1000 * 60 * 60;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
		


function get_random(iMax)
{
    var ranNum= Math.round(Math.random()*parseInt(iMax,10));
    if(ranNum < 1)
      return get_random(iMax);
    return ranNum;
}

/* Andrew Urquhart : Client-Side Request Object for javascript : http://andrewu.co.uk/tools/request/
COPYRIGHT:You are free to use this script for any use you wish if this comment is left intact. Feel free to enhance the script and send me the updated version. Please don't redistribute. This script is provided as is,with no warranty of any kind. Use it at your own risk. Copyright Andrew R Urquhart; VERSION:#1.3 2005-05-11 17:52 UTC*/
function RObj(ea){var LS="";var QS=new Object();var un="undefined";var x=null;var f="function";var n="number";var r="string";var e1="ERROR:Index out of range in\r\nRequest.QueryString";var e2="ERROR:Wrong number of arguments or invalid property assignment\r\nRequest.QueryString";var e3="ERROR:Object doesn't support this property or method\r\nRequest.QueryString.Key";function Err(arg){if(ea){alert("Request Object:\r\n"+arg)}};function URID(t){var d="";if(t){for(var i=0;i<t.length;++i){var c=t.charAt(i);d+=(c=="+"?" ":c)}};return unescape(d)};function OL(o){var l=0;for(var i in o){if(typeof o[i]!=f){l++}};return l};function AK(key){var auk=true;for(var u in QS){if(typeof QS[u]!=f&&u.toString().toLowerCase()==key.toLowerCase()){auk=false;return u}}if(auk){QS[key]=new Object();QS[key].toString=function(){return TS(QS[key])};QS[key].Count=function(){return OL(QS[key])};QS[key].Count.toString=function(){return OL(QS[key]).toString()};QS[key].Item=function(e){if(typeof e==un){return QS[key]}else {if(typeof e==n){var a=QS[key][Math.ceil(e)];if(typeof a==un){Err(e1+"(\""+key+"\").Item("+e+")")};return a}else {Err("ERROR:Expecting numeric input in\r\nRequest.QueryString(\""+key+"\").Item(\""+e+"\")")}}};QS[key].Item.toString=function(e){if(typeof e==un){return QS[key].toString()}else {var a=QS[key][e];if(typeof a==un){Err(e1+"(\""+key+"\").Item("+e+")")};return a.toString()}};QS[key].Key=function(e){var t=typeof e;if(t==r){var a=QS[key][e];return(typeof a!=un&&a&&a.toString()?e:"")}else {Err(e3+"("+(e?e:"")+")")}};QS[key].Key.toString=function(){return x}};return key};function AVTK(key,val){if(key!=""){var key=AK(key);var l=OL(QS[key]);QS[key][l+1]=val}};function TS(o){var s="";for(var i in o){var ty=typeof o[i];if(ty=="object"){s+=TS(o[i])}else if(ty!=f){s+=o[i]+", "}};var l=s.length;if(l>1){return(s.substring(0,l-2))}return(s==""?x:s)};function KM(k,o){var k=k.toLowerCase();for(var u in o){if(typeof o[u]!=f&&u.toString().toLowerCase()==k){return u}}}if(window.location&&window.location.search){LS=window.location.search;var l=LS.length;if(l>0){LS=LS.substring(1,l);var preAmpAt=0;var ampAt=-1;var eqAt=-1;var k=0;var skip=false;for(var i=0;i<l;++i){var c=LS.charAt(i);if(LS.charAt(preAmpAt)=="="||(preAmpAt==0&&i==0&&c=="=")){skip=true}if(c=="="&&eqAt==-1&&!skip){eqAt=i}if(c=="&"&&ampAt==-1){if(eqAt!=-1){ampAt=i}if(skip){preAmpAt=i+1};skip=false}if(ampAt>eqAt){AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,ampAt)));preAmpAt=ampAt+1;eqAt=ampAt=-1;++k}}if(LS.charAt(preAmpAt)!="="&&(preAmpAt!=0||i!=0||c!="=")){if(preAmpAt!=l){if(eqAt!=-1){AVTK(URID(LS.substring(preAmpAt,eqAt)),URID(LS.substring(eqAt+1,l)))}else if(preAmpAt!=l-1){AVTK(URID(LS.substring(preAmpAt,l)),"")}}if(l==1){AVTK(LS.substring(0,1),"")}}}};var TC=OL(QS);if(!TC){TC=0};QS.toString=function(){return LS.toString()};QS.Count=function(){return(TC?TC:0)};QS.Count.toString=function(){return(TC?TC.toString():"0")};QS.Item=function(e){if(typeof e==un){return LS}else {if(typeof e==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof QS[i]!=f&&++c==e){return QS[i]}};Err(e1+"().Item("+e+")")}else {return QS[KM(e,QS)]}};return x};QS.Item.toString=function(){return LS.toString()};QS.Key=function(e){var t=typeof e;if(t==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof QS[i]!=f&&++c==e){return i}}}else if(t==r){var e=KM(e,QS);var a=QS[e];return(typeof a!=un&&a&&a.toString()?e:"")}else {Err(e2+"().Key("+(e?e:"")+")")};Err(e1+"().Item("+e+")")};QS.Key.toString=function(){Err(e2+"().Key")};this.QueryString=function(k){if(typeof k==un){return QS}else {var k=KM(k,QS);if(typeof QS[k]==un){t=new Object();t.Count=function(){return 0};t.Count.toString=function(){return "0"};t.toString=function(){return x};t.Item=function(e){return x};t.Item.toString=function(){return x};t.Key=function(e){Err(e3+"("+(e?e:"")+")")};t.Key.toString=function(){return x};return t}if(typeof k==n){return QS.Item(k)}else {return QS[k]}}};this.QueryString.toString=function(){return LS.toString()};this.QueryString.Count=function(){return(TC?TC:0)};this.QueryString.Count.toString=function(){return(TC?TC.toString():"0")};this.QueryString.Item=function(e){if(typeof e==un){return LS.toString()}else {if(typeof e==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof QS[i]!=f&&++c==e){return QS[i]}};Err(e1+".Item("+e+")")}else {return QS[KM(e,QS)]}}if(typeof e==n){Err(e1+".Item("+e+")")};return x};this.QueryString.Item.toString=function(){return LS.toString()};this.QueryString.Key=function(e){var t=typeof e;if(t==n){var e=Math.ceil(e);var c=0;for(var i in QS){if(typeof QS[i]=="object"&&(++c==e)){return i}}}else if(t==r){var e=KM(e,QS);var a=QS[e];return(typeof a!=un&&a&&a.toString()?e:"")}else {Err(e2+".Key("+(e?e:"")+")")};Err(e1+".Item("+e+")")};this.QueryString.Key.toString=function(){Err(e2+".Key")};this.Version=1.3;this.Author="Andrew Urquhart (www.andrewu.co.uk)"};var Request=new RObj(false);

function HTMLEncode(t) {
    return t.toString().replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
}


// -->