var wndhnd
var prevcol
function showmenu(elmnt){
document.all(elmnt).style.visibility="visible"
}

function hidemenu(elmnt){
document.all(elmnt).style.visibility="hidden"
}

function H(x){
 prevcol=x.style.backgroundColor
 x.style.backgroundColor="#fbfba0"
}
function HOFF(x){x.style.backgroundColor=prevcol}

function hlon(x,col1,col2){
x.style.color=col1;
x.style.backgroundColor=col2}

function hloff(x,co1,col2){
x.style.color=col1;
x.style.backgroundColor=col2
}

function hloff1(x,col){
if (col!=""){
    x.style.color=col
}else{
    x.style.color="LightSteelBlue"}
 x.style.backgroundColor="#4682b4"}

function message(x){alert(x)}

function moveover(x,src){x.src=src}

function moveback(x,src){x.src=src}
 
function fct1(){
if (eval("Form1.EmailAddress.type")!="hidden"){
	Form1.EmailAddress.focus()}
eval("Form1.ScreenType.value='" + screen.width + "'")}

function CloseWin(){
   if(typeof(wndhnd)=="object"){
    if(wndhnd.closed==false){
        wndhnd.close()}}}

function Help(page){
  CloseWin();
  wndhnd = window.open("Help.asp?page=" + page,"Help","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,titlebar=no,resizable=yes,copyhistory=no,top=20,left=20,width=660,height=550")
  wndhnd.focus()
}

function OpenWindow(x,y,z){
if(typeof(z)=="undefined"){
	z=""
}
CloseWin();
if(z==""){
	z = "directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,top=20,left=20,width=660,height=550" }
if(z=="Max"){
	width = screen.width - 40;
	height = screen.height - 70;
	z = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,top=10,left=10,width=" + width + ",height=" + height };
if(z=="Max1"){
	width = screen.width - 60;
	height = screen.height - 90;
	z = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,top=30,left=30,width=" + width + ",height=" + height };
if(z=="Max2"){
	width = screen.width-30;
	height = screen.height-60;
	z = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,top=0,left=0,width=" + width + ",height=" + height };
if(z=="Size1"){
	z = "directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,top=50,left=100,width=790,height=650" }
 wndhnd = window.open(x,y,z);
 wndhnd.focus();
}

function ShowContacts(x){
 CloseWin();
 wndhnd = window.open("Contacts.asp","Contacts","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,titlebar=no,resizable=no,copyhistory=no,top=20,left=20,width=660,height=450");
 wndhnd.focus()
}

function SaveChanges(x,y,z){
u = eval("Form1.EmailAddress.value");
if(x=="Lang"){
	location="Login.asp?Lang=" + y + "&EmailAddress=" + u	}}

function SaveChangesLang(y){
eval("document.forms.formlang.taskvar.value='" + y + "'");
document.forms.formlang.submit()}

function SaveChangesHome(){location="Default.asp"}

function RequestPWD(){
e=eval("document.forms.LoginForm.EmailAddress.value");
location="/Government/RequestPassword.asp?task=firstcheck&EmailAddress=" + e}

function RequestPWDMytenders(){
e=eval("document.forms.LoginForm.EmailAddress.value");
location="/Mytenders/RequestPassword.asp?task=firstcheck&EmailAddress=" + e}

function Check(){
if (event.keyCode ==13){
    document.LoginForm.submit()}}

var _ONE=0;
function Switch(item,OldChar,NewChar)
{
  var _ret="";
  var _flag=0;
  var _item=item.split("");
  for(var i=0;i<_item.length;i++)
  {
    if(!_flag&&_item[i]==OldChar)
	{
	  _item[i]=NewChar;
      _flag=_ONE;
	}
	_ret+=_item[i];
  }
  return(_ret);
}

function PrepJsStr(x){
  //replace single quotes;
  out = Switch(x,"'","' + String.fromCharCode(39)  + '")
  //replace return
  out = Switch(out,String.fromCharCode(13),"' + String.fromCharCode(13)  + '")
  return out
}

function counter(x){
  t = document.getElementById("Fld" + x).innerHTML
  maxlen = 4000
	nbcar = t.length;
	if (nbcar > maxlen ) {
	  alert("Max num of chars for this field is " + maxlen + "!");
	  valcar = 0;
    } 
	else {  
	  valcar = maxlen - nbcar;
	  document.getElementById("Cnt" + x).value = valcar;
	}
}	

function ShowTitle(TitID){
  d = document.getElementById("T" + TitID);
  s = document.getElementById("S" + TitID);
  i = document.getElementById("I" + TitID);	
	switch(s.value){
		case '1':{
			d.style.display = ''
			i.src = 'http://www.tenderlink.be/images/tlink/collapse.gif'			
			s.value = '2'
			break
		}
		case '2':{
			d.style.display = 'none'
			i.src = 'http://www.tenderlink.be/images/tlink/expand.gif'			
			s.value = '1'			
			break
		}
	}
}	

function ChangeLang(x){
	strLoc = window.location.href;
	strLoc = strLoc.replace(/&lang=EN/i,"");
	strLoc = strLoc.replace(/&lang=FR/i,"");
	strLoc = strLoc.replace(/&lang=NL/i,"");
	strLoc = strLoc.replace(/\?lang=EN&/i,"?");
	strLoc = strLoc.replace(/\?lang=FR&/i,"?");
	strLoc = strLoc.replace(/\?lang=NL&/i,"?");
	strLoc = strLoc.replace(/\?lang=EN/i,"?");
	strLoc = strLoc.replace(/\?lang=FR/i,"?");
	strLoc = strLoc.replace(/\?lang=NL/i,"?");
	p = strLoc.indexOf("?")
	if(p==-1){
		strLoc = strLoc + "?"
	}else{
		if(p+1!=strLoc.length){
			strLoc = strLoc + "&"
		}
	}
	strLoc = strLoc + "lang=" + x
	window.location.href = strLoc 
}

