// JavaScript Document
t_rid="postuniversitarro";
function rollinmy(id) { //v3.0
    if (document.getElementById) {
        window.document.getElementById(id).style.background = '#F4F5F7';
    }
    else if (document.layers) {
        window.document.layers[id].background = '#F4F5F7';
    }
    else if (document.all) {
        window.document.all[id].style.background = '#F4F5F7';
    }

}
function rolloutmy(id) { //v3.0
    if (document.getElementById) {
        window.document.getElementById(id).style.background = 'white';
    }
    else if (document.layers) {
        window.document.layers[id].background = 'white';
    }
    else if (document.all) {
        window.document.all[id].style.background = 'white';
    }

}
function processsearch() { //v3.0
        textdecautat=window.document.forms[0].textucautare.value;
        if (textdecautat=='keyword') textdecautat='';
			if(textdecautat) {
				if(window.document.forms[0].cecaut[0].checked) {//studiu
				linku='http://www.postuniversitar.ro/links.php?prel_search='+textdecautat;
				self.location.href=linku;
				}
				if(window.document.forms[0].cecaut[1].checked){//institutie
				linku='http://www.postuniversitar.ro/listainstitutii.php?prel_search='+textdecautat;
				self.location.href=linku;
				}
			} else {
			alert('Va rugam introduceti textul de cautat');
			}
}

function processsearchi(tarai) { //v3.0
        textdecautat=window.document.forms[0].textucautarei.value;
        if (textdecautat=='keyword') textdecautat='';
			if(textdecautat) {
				linku='international-univ.php?cauta='+textdecautat+'&country='+tarai;
				self.location.href=linku;
			} else {
			alert('Va rugam introduceti textul de cautat');
			}
}
function proc_inst_zone() { //v3.0
        if(document.forms[0].checkbox_buc.checked)v_buc=1; else v_buc=0 ;
		if(document.forms[0].checkbox_alte.checked)v_alte=1; else v_alte=0;
		if(document.forms[0].checkbox_str.checked)v_str=1; else v_str=0;
		if((v_buc==1)&&(v_alte==1)&&(v_str==1)){
		self.location.href='listainstitutii.php?prel_zona=ToateZonele'
		}
		if((v_buc==1)&&(v_alte==0)&&(v_str==0)){
		self.location.href='listainstitutii.php?prel_zona=Bucuresti'
		}
		if((v_buc==0)&&(v_alte==1)&&(v_str==0)){
		self.location.href='listainstitutii.php?prel_zona=AlteZone'
		}
		if((v_buc==0)&&(v_alte==0)&&(v_str==1)){
		self.location.href='listainstitutii.php?prel_zona=Strainatate'
		}
		if((v_buc==1)&&(v_alte==1)&&(v_str==0)){
		self.location.href='listainstitutii.php?prel_zona=Romania'
		}
		if((v_buc==1)&&(v_alte==0)&&(v_str==1)){
		self.location.href='listainstitutii.php?prel_zona=Bucuresti sau Strainatate'
		}
		if((v_buc==0)&&(v_alte==1)&&(v_str==1)){
		self.location.href='listainstitutii.php?prel_zona=Alte Zone sau Strainatate'
		}
		if((v_buc==0)&&(v_alte==0)&&(v_str==0)){
		alert('Selectati zona in care doriti sa cautati')
		}
}

function proc_lista_zone() { //v3.0
		v_ora=document.forms[0].orasele.options[document.forms[0].orasele.selectedIndex].text;
		v_tip=document.forms[0].tipurile.options[document.forms[0].tipurile.selectedIndex].text;
		v_dom=document.forms[0].domeniile.options[document.forms[0].domeniile.selectedIndex].text;
		if (v_ora=='Toate Zonele') v_ora='ToateZonele';
		if (v_tip=='Toate Tipurile') v_tip='';
		if (v_dom=='Toate Domeniile') v_dom='';
		if((v_ora=='ToateZonele')||(v_ora=='')){
		self.location.href='links.php?prel_zona=ToateZonele&prel_tipu='+v_tip+'&prel_domeniu='+v_dom
		}
		if((v_ora!='ToateZonele')&&(v_ora!='')){
		self.location.href='links.php?prel_zona='+v_ora+'&prel_tipu='+v_tip+'&prel_domeniu='+v_dom
		}
		
}

function EntryFocus (x){
	if(document.all||document.getElementById){    //IE5+ NE6+only
	x.style.background='#E0E7EB'
	}
}
function EntryBlur (x){
	if(document.all||document.getElementById){    //IE5+ NE6+only	
	x.style.background='white'
	}
}
function ButtonOver (x){
	if(document.all||document.getElementById){    //IE5+ NE6+only
	x.style.color='#FF9A00'
	}
}
function ButtonOut (x){
	if(document.all||document.getElementById){    //IE5+ NE6+only
	x.style.color='white'
	}
}
function escapeVal(aaa,replaceWith){ 
aaa = escape(aaa) 
	for(i=0; i<aaa.length; i++){ 
	
	 	if(aaa.indexOf("%0D%0A") > -1){ 
		aaa=aaa.replace("%0D%0A",replaceWith)
		}
		else if(aaa.indexOf("%0A") > -1){  
		aaa=aaa.replace("%0A",replaceWith)
		}
		else if(aaa.indexOf("%0D") > -1){  
		aaa=aaa.replace("%0D",replaceWith)
		}
		
	}
return unescape(aaa); 
}
// valid TO DELETE


function sc_al (entry) {
	out = ">"; // replace this
	add = " "; // with this
	temp = "" + entry.value; // temporary holder
	
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}
	entry.value = temp;
	//01
	
	out = "<"; // replace this
	add = " "; // with this
	temp = "" + entry.value; // temporary holder
	
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}
	entry.value = temp;
	//01
	
	out = "/"; // replace this
	add = " "; // with this
	temp = "" + entry.value; // temporary holder
	
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}
	entry.value = temp;
	//01
	
	out = "'"; // replace this
	add = ""; // with this
	temp = "" + entry.value; // temporary holder
	
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}
	entry.value = temp;
	//01
	
	out = "?"; // replace this
	add = ""; // with this
	temp = "" + entry.value; // temporary holder
	
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}
	entry.value = temp;
	//01
	
	out = "="; // replace this
	add = ""; // with this
	temp = "" + entry.value; // temporary holder
	
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}
	entry.value = temp;
	//01
	
	out = "&"; // replace this
	add = ""; // with this
	temp = "" + entry.value; // temporary holder
	
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add + temp.substring((pos + out.length), temp.length));
	}
	entry.value = temp;
}
function sd_move(){
	document.forms[0].fm_tip.value=document.forms[0].xfm_tip.options[document.forms[0].xfm_tip.selectedIndex].text;
	document.forms[0].fm_oras.value=document.forms[0].xfm_oras.options[document.forms[0].xfm_oras.selectedIndex].value;
	document.forms[0].fm_domeniu.value=document.forms[0].xfm_domeniu.options[document.forms[0].xfm_domeniu.selectedIndex].text;
	document.forms[0].fm_forma.value=document.forms[0].xfm_forma.options[document.forms[0].xfm_forma.selectedIndex].value;
	
}
function val_nongool () { 
	z=0;
	if (document.forms[0].fm_nume.value=='') {
		alert('Trebuie sa introduceti NUMELE !');
		document.forms[0].fm_nume.focus();
		z=1;
		return;
		}
	if ((document.forms[0].fm_email.value == "") || (document.forms[0].fm_email.value.indexOf('@')) == -1 || (document.forms[0].fm_email.value.indexOf('.') == -1) || (document.forms[0].fm_email.value.length<6) || (document.forms[0].fm_email.value.length>87)) {
		alert ('Trebuie sa introduceti un EMAIL corect !');
		document.forms[0].fm_email.focus();
		z=1;
		return;
		}
}
function submiteaza () {
	z=0;
	val_nongool();
	if (z==0) {    
		sc_al(document.forms[0].fm_detaliu);
		sd_move();
	}
	if (z==0) document.forms[0].submit();
}

function submiteazac () {
	z=0;
	val_nongool();
	if (z==0) {    
		sc_al(document.forms[0].fm_detaliu);
	}
	if (z==0) document.forms[0].submit();
}
function listfunctie() {
		if (vv_tip=='') v_tip='Toate Tipurile';
		if (vv_dom=='') v_dom='Toate Domeniile';								
								for(i=1;i<document.form1.domeniile.length;i++){
									if(document.form1.domeniile.options[i].text==vv_dom){
document.form1.domeniile.options[i].selected='true';
}}
								for(i=1;i<document.form1.tipurile.length;i++){
									if(document.form1.tipurile.options[i].text==vv_tip){
document.form1.tipurile.options[i].selected='true';
}}
}

//autosu
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			processsearch();
			return false;
		} 
		else
		return true;
	}   
// hbox
// box awitch
function tab1() {
document.getElementById('hdi2').style.display='none';
document.getElementById('hdi1').style.display='block';
document.getElementById('ll1').className='hombu';
document.getElementById('ll2').className='';
}
function tab2() {
document.getElementById('hdi1').style.display='none';
document.getElementById('hdi2').style.display='block';
document.getElementById('ll2').className='hombu';
document.getElementById('ll1').className='';
}