function AllowTabCharacter() {
   if (event != null) {
      if (event.srcElement) {
         if (event.srcElement.value) {
            if (event.keyCode == 9) { // tab character
               if (document.selection != null) {
                  document.selection.createRange().text = "   ";
                  event.returnValue = false;
               }else {
                  event.srcElement.value += '\t'; 
	     return false;
				}
			}
		}
	  }
	}
}

var dom = document.getElementById ? 1 : 0; // DOM1 supported?



// mouseovers main & global navigation --------------------------------------------------
// initialize and preload mouseovers

var secondMouseOver = new Array(); // stores related image swaps

function initNavMouseover(e,e2){
	if (dom){
		var imgs = getElement(e).getElementsByTagName("IMG");
		var preloads = new Array();
		for (var i=0;i<imgs.length;i++){
			imgs[i].onmouseover = imgOver;
			imgs[i].onmouseout = imgOut;
			if (e2){secondMouseOver[imgs[i].src]=new Array(i,e2)} // img has related image swap on other image
			preloads[i] = new Image();
			preloads[i].src = imgs[i].src.replace(/.gif/,"_hi.gif");
		}
	}
}

// swap image to hover state
function imgOver(e){
	var img = (e && e.src) ? e : this;
	if (secondMouseOver[img.src]){// swap source of related image
		var img2 = document.getElementById(secondMouseOver[img.src][1]).getElementsByTagName("IMG")[secondMouseOver[img.src][0]];
		if (img2.src && img2.src != img.src) {
			imgOver(img2);
		}
	}
	if (img.src.indexOf("_ac.gif")==-1)img.src = img.src.replace(/.gif/,"_hi.gif");
}

// restore image swap
function imgOut(e){
	var img = (e && e.src) ? e : this;
	if (img.src.indexOf("_ac.gif")==-1)img.src = img.src.replace(/_hi.gif/,".gif");
	if (secondMouseOver[img.src]){// swap source of related image
		var img2 = document.getElementById(secondMouseOver[img.src][1]).getElementsByTagName("IMG")[secondMouseOver[img.src][0]];
		if (img2.src && img2.src != img.src) {
			imgOut(img2);
		}
	}
}


// utility functions ------------------------------------------------------------------
// return object reference
function getElement(e){if (dom)return document.getElementById(e);if (document.all)return document.all[e]; return false;}

// TODO
function go( s, n ) {
	document.forms['go'].user_params.value = s;
	document.forms['go'].elements['next-screen'].value = n;
	document.forms['go'].submit();
}

function hoverResult(){
	this.className = this.className + "hover"
}

function hoverOutResult(){
	this.className = this.className.replace("hover","")
}

//HTML elements Visible change
function toggleElement(id)
{
    var elm = document.getElementById(id);
    elm.style.display = (elm.style.display == 'none') ? 'block' : 'none';
}

function showElement(id)
{
    var elm = document.getElementById(id);
    elm.style.display = 'block';
}


function hideElement(id)
{
    var elm = document.getElementById(id);
    elm.style.display = 'none';
}

function showPic(foto){
  var tfoto = new Image(230,170);
  tfoto.src = foto;
  
  if( navigator.appName.indexOf("Microsoft") > -1 ){
    photo.src = tfoto.src;
    document.getElementById('photo2').setAttribute("href", 'javascript:viewPicPop(\''+ tfoto.src.replace('T', '') + '\');'); 
    //photo2.href = 'javascript:viewPicPop(\''+ tfoto.src.replace('T', '') + '\');';
  }else{
  
   document.photo.src = tfoto.src;
   document.getElementById('photo2').setAttribute("href", 'javascript:viewPicPop(\''+ tfoto.src.replace('T', '') + '\');'); 

  }
} 



function viewPicPop(picture){
//window.open(picture,'name','height=800,width=600, toolbar=no,directories=no,status=no,menubar=no, scrollbars=no,resizable=no'); 
window.open(picture, 'titel', 'width=700, height=500, toolbar=0, scrollbars=0, location=0, status=0, menubar=0, resizable=1, screenX=' + ((screen.width - 700) / 2) + ', screenY=' + ((screen.height - 500) / 2) + ', top=' + ((screen.height - 500) / 2) + ', left=' + ((screen.width - 700) / 2) + '') 
}


function popup(url,winName,W,H) {
	if(W == undefined) W = 400;	//default width
	if(H == undefined) H = 300; //default height
	X = (window.screen.width/2)-(W/2);
	Y = (window.screen.height/2)-(H/2);
	winprops = 'height='+H+',width='+W+',top='+X+',left='+Y+',scrollbars=no,location=0';
	win = window.open(url, winName, winprops);
}


   // if (navigator.appName == 'Netscape') i=40;
 // if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
 // self.focus();
 
 function show_message(message, url){
   if(confirm(message)) location.href = url;
}



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}