function urlencode(strText) {
var isObj;
   var trimReg;
   if( typeof(strText) == "string" ) {
      if( strText != null ) {
		 strText = strText.replace('+', '%2B');
         trimReg = /(^\s+)|(\s+$)/g;
         strText = strText.replace( trimReg, '');
         for(i=32;i<256;i++) {               
             strText = strText.replace(String.fromCharCode(i),escape(String.fromCharCode(i)));                                                                 
         }
      }
   }          
   return strText;
}

function enterkeypressReg(evt) 
	{
		evt = (evt) ? evt : event;
		var charCode = (evt.charCode) ? evt.charCode :  ((evt.which) ? evt.which : evt.keyCode);	
		//alert(charCode);		
		if (charCode == 13 || charCode == 3) 
			{      
				user_registration();
			}			
		return true; 
		
	}	
function enterkeypressNew(evt) 
	{
		evt = (evt) ? evt : event;
		var charCode = (evt.charCode) ? evt.charCode :  ((evt.which) ? evt.which : evt.keyCode);	
		//alert(charCode);		
		if (charCode == 13 || charCode == 3) 
			{      
				user_login();
			}			
		return true; 
		
	}	


function browserCompatiablity(ugra)
	{
		var elem;
		if( document.getElementById ){	elem = document.getElementById( ugra );	} // this is the way the standards work
		else if( document.all ){ elem = document.all[ugra];	} // this is the way old msie versions work
		else if( document.layers ){	elem = document.layers[ugra]; } // this is the way nn4 works
		return elem;
	}
	
	
function displayTabContainerHome( whichLayer )
	{
		var elem, vis, ugra;
		for(var i=1;i<=2;i++)
			{
				ugra="GraphTab_"+i+"";				
				if(whichLayer==ugra)
					{ 
						browserCompatiablity(ugra).style.display='block'; 						
					}
				else{
					 	browserCompatiablity(ugra).style.display='none';						
					}
					
				if( whichLayer=="GraphTab_1")	
					{
						browserCompatiablity('divExampleTab').style.display='block';
						browserCompatiablity('divInfoTab').style.display='none';
					}
				else if(whichLayer=="GraphTab_2")
					{
						browserCompatiablity('divExampleTab').style.display='none';
						browserCompatiablity('divInfoTab').style.display='block';
					}
			}
	
	}


function user_login()
	{		
		window.location.href='login.php?Submit=Submit&username='+urlencode(browserCompatiablity('username').value)+'&password='+urlencode(browserCompatiablity('password').value);
	}
	
function user_registration()
	{
		window.location.href='registration.php?reg_name='+urlencode(browserCompatiablity('reg_name').value)+'&email='+urlencode(browserCompatiablity('reg_email').value);
	}
	
	
function clearvalue(str)
	{
		if(browserCompatiablity(str).value=="E-mail"){ browserCompatiablity(str).value=""; }
		if(browserCompatiablity(str).value=="Password"){ browserCompatiablity(str).value=""; }
		if(browserCompatiablity(str).value=="Gebruikersnaam"){ browserCompatiablity(str).value=""; }
		if(browserCompatiablity(str).value=="Email Adres"){ browserCompatiablity(str).value=""; }		
	}
