/*
 Functia deschide o noua fereastra de browser folosind parametrii personalizati :  
	Address : intre ghilimele se specifica adresa paginii care va fii incarcata (este obligatoriu)
	W : latimea frestrei
	H : inaltimea ferestrei
*/
function open_win(address,w,h){
 var adr = '';
 var op = '';
 adr = address;
 op = 'width='+w+','+'height='+h+','+
 'scrollbars=Yes,location=No,menubar=No,resizable=No,status=No,directories=No,dependent=0,toolbar=No,copyhistory=Yes';
  window.open(adr,'',op);
}

/*
 Functia deschide formularul pentru CV intr-o fereastra separata tinand cont de rezolutia curenta a monitorului.
*/
function show_cv_form(){
 if (screen.height > 600) open_win('cv_pas1.php',470,650);
 else open_win('cv_pas1.php',470,550);
}


/*
 Functia afiseaza un mesaj in status bar
*/
function msg(message){
 window.status = message;
}

/*
 Functia este folosita de meniul "drop down" - se face salt la pagina in limba selectata.
*/
function jumpto() {         
 var msg1 = "We're sorry but the English version of the Advanced Technology Systems \n" + 
            "web page is under construction. \n" +
			"Please come back later.";
 var msg2 = "We're sorry but the Deutsch version of the Advanced Technology Systems \n" + 
            "web page is under construction. \n" +
			"Please come back later.";
 var msg3 = "We're sorry but the French version of the Advanced Technology Systems \n" + 
            "web page is under construction. \n" +
			"Please come back later.";



 if (document.f2.url.options.value == "English") {alert(msg1);  document.f2.url.options.value = 'SELECTED';}
 if (document.f2.url.options.value == "Deutsch") {alert(msg2);  document.f2.url.options.value = 'SELECTED';}
 if (document.f2.url.options.value == "Francais") {alert(msg3);  document.f2.url.options.value = 'SELECTED';}
}

function valid_email(email) {
 var t = email;
 var v = 0;
 var first_bad = new Array('~', '!' ,'@' ,'#' ,'$' ,'%' ,'^', '&', '*', '+', '(', ')');
 var bad = new Array('~', '!' ,'@' ,'#' ,'$' ,'%' ,'^', '&', '*', '+', '(', ')');
 if ( !isNaN(parseInt(t.substring(0, 1))) ) v++;
}
/* Functie care codeaza*/
function Encode(s,j){
  r='';
 	for(i=0;i<s.length;i++){
		n=s.charCodeAt(i); 
				if (n>=8364){
			n = 128;
		} 
		r += String.fromCharCode( n + j ); 
	}
  return r;
}
/* Functie care decodeaza - "mailto:"  */
function Decode(s,j) {
	r='';
	for(i=0;i<s.length;i++){
		n=s.charCodeAt(i); 
				if (n>=8364){
			n = 128;
		} 
		r += String.fromCharCode( n - j ); 
	}
  return r;
}
/* Functie care contruieste adresa de email */
function MailToATS (user,domain)
{
	var a, s, n;
	//a ="pdlowr=";
	a="rfnqyt?";
	n=64;
	d=String.fromCharCode(n);
	var aro = user + d + domain;
	status=Decode(a,5)+ user + d + domain;
	locationstring = Decode(a,5) + aro;
	window.location = locationstring;
}


