
function procEmail()
{

  if (!document.addForm.email.value)
  {
    alert('Please, enter your E-Mail address!');
    document.addForm.email.focus();
    return false;
  }
  else
  {
    a = document.addForm.email.value.indexOf('@');
    b = document.addForm.email.value.indexOf('@', a+1);
    c = document.addForm.email.value.lastIndexOf('.');
    if (c < a+1) { c = -1; }
    if (a == -1 || b != -1 || c <= a + 2 || a < 1 || c + 2 >= document.addForm.email.value.length || c + 4 < document.addForm.email.value.length)
    {
      alert('Please enter a valid E-Mail Address');
      document.addForm.email.focus();
      return false;
    }
  }

  return true;
}


//function open_csi_wnd(path,pic,w,h)

function OpenImage(path,pic,w,h)
{
var windowName='picw';
var scw=w;
var sch=parseInt(h)+55;
var nWindow = window.open("",windowName,"fullscreen=no,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no, screenX=0,screenY=0,Width="+scw+",Height="+sch);
nWindow.document.write('<HTML> <HEAD><TITLE>'+pic+'</TITLE> <STYLE> { box-sizing: border-box; moz-box-sizing: border-box } HTML { BACKGROUND: black; HEIGHT: 100% } BODY { BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; OVERFLOW: auto; COLOR: blue; MARGIN: 0px; PADDING-TOP: 0px; BORDER-RIGHT-WIDTH: 0px } </STYLE> </HEAD> <BODY bgcolor="#222222" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" onLoad="this.focus()"> <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"> <tr> <td valign="middle" align="center"> <img src="data/'+path+pic+'" width="'+w+'" height="'+h+'" border="0"> </td> </tr> </table> </BODY> </HTML>');
nWindow.document.close();
nWindow.resizeTo(scw,sch);
nWindow.focus();
}

function OpenVideo(id)
{
var windowName='vidw';
var scw=425;
var sch=350+47;
var nWindow = window.open("?page=video&id="+id,windowName,"fullscreen=no,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no, screenX=0,screenY=0,Width="+scw+",Height="+sch);
//nWindow.document.write('<HTML> <HEAD><TITLE>'+pic+'</TITLE> <STYLE> { box-sizing: border-box; moz-box-sizing: border-box } HTML { BACKGROUND: black; HEIGHT: 100% } BODY { BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; OVERFLOW: auto; COLOR: blue; MARGIN: 0px; PADDING-TOP: 0px; BORDER-RIGHT-WIDTH: 0px } </STYLE> </HEAD> <BODY bgcolor="#222222" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" onLoad="this.focus()"> <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"> <tr> <td valign="middle" align="center"> <img src="data/'+path+pic+'" width="'+w+'" height="'+h+'" border="0"> </td> </tr> </table> </BODY> </HTML>');
//nWindow.document.close();
nWindow.resizeTo(scw,sch);
nWindow.focus();
}


var num=0;
function setFiles(numf)
{
 if(numf>0) num=numf-1;
}
function addFile()
{
 num++;
 document.getElementById('file'+num).style.display="block";
 if(num==9) document.getElementById('addFbtn').innerHTML="";
}

//var on=1;
var timeoutid='';
function timedhide()
{
 if(timeoutid) clearTimeout(timeoutid);
 timeoutid=setTimeout("hideallsubm()",5000);
}
function setDOValue()
{
   
	var titlu = document.getElementById("title");
	var nume = document.getElementById("nume");
	var cmp = document.getElementById("comment");
	var sp = document.getElementById("error");
	var codIntrodus = document.getElementById("security_code").value;
	 var url = "pages/reqComentariu.php";
	var curentLocation = window.location.toString();
	var indexStart = curentLocation.lastIndexOf(".");
	var indexEnd = curentLocation.indexOf("&id");
	var tblNameTemp = curentLocation.substring(indexStart+1,indexEnd);
	var idxTemp = curentLocation.substring(indexEnd+1,curentLocation.length);
	var idx = idxTemp.replace("id=","");
	idx = idxTemp.replace("#comentariu","");
	idx = idx.replace("id=","");
	
	var tblName = "";

	if(tblNameTemp == "leg_ini")
	{
	  tblName = "oaj_legi_ini"+"_c";
	}else if (tblNameTemp == "in_cart")
	{
		tblName = "oaj_in_cart_parlament_c";
	}else if(tblNameTemp == "pres_desp")
	{
	  tblName = "oaj_pres_desp_parlament_c";
	}else if(tblNameTemp == "scr_desc")
	{
	  tblName = "oaj_scr_desc_parlament_c";
	}else if(tblNameTemp == "conf_presa")
	{
	  tblName = "oaj_conf_presa_parlament_c";
	}else if(tblNameTemp == "com_presa")
	{
	  tblName = "oaj_com_presa_parlament_c";
	}
	else{
	  tblName = "oaj_"+tblNameTemp + "_c";	
	}
	
	
	var pars = "idx="+idx+"&tbl="+tblName+"&security_code="+codIntrodus+"&nume="+encodeURIComponent(nume.value)+"&titlu="+encodeURIComponent(titlu.value)+"&cooment="+encodeURIComponent(cmp.value);
		 
	
	if(cmp.value == "")
	{
        sp.style.display = "";
        sp.className = "errorBig";		
        sp.innerHTML = "Va rugam Completati Camplul marcat cu *";
		cmp.focus();
	}else{
		sp.innerHTML = "";
		sp.style.display = "none";
			$.ajax({
			  type: 'post',
			  data: pars,
			  url: url,
			  success: function(transport) {
				if(transport == "true")
				 {
				   sp.className = "errorBig";
                               sp.innerHTML = "Codul de siguranta introdus nu are aceasi valoare ca cea din imagine!";
				   sp.style.display = "";
				   codIntrodus.focus();
				 }
				 else if (transport == "suc")
				 {
					 sp.className = "error";
                                    sp.innerHTML = "Comentariul a fost introdus cu succes!";
				        
                                    sp.style.display = "";
					 var imgCp = document.getElementById("cap_img");
					 imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
					 
					
				 }else if ( transport == "exists")
				 {
				    sp.innerHTML = "Acest Comentariu a mai fost adaugat!";
					sp.style.display = "";
					var imgCp = document.getElementById("cap_img");
					 imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
					
				 }
				 
				 
		  }
		});
	}
	

	  
	
}
function doSesisare()
{
    frm = document.getElementById("sesizFrm");
	var desc = document.getElementById("descr");
	var cod_in = document.getElementById("security_code").value;
	var pars = "security_code="+cod_in;
	var sp = document.getElementById("error");
	
    
	if(desc.value == "" || cod_in == "")
	{
	    	sp.innerHTML = "";
			sp.innerHTML = "Va rugam Completati Campurile marcate cu *";
			sp.className = "errorBig";
			sp.style.display = "";
			
	}else{
	    	$.ajax({
			  type: 'post',
			  url: 'pages/reqSesiz.php',
			  data: pars,
			  success: function(transport) {
				
				if(transport == "true")
				 {
				   sp.className = "errorBig";
                   sp.innerHTML = "Codul de siguranta introdus nu are aceasi valoare ca cea din imagine!";
				   sp.style.display = "";
				   
				 }
				 if(transport == "false")
				 {
					 sp.innerHTML = "";
				     sp.style.display = "none";
					 document.getElementById("sesizFrm").submit();
					 //var imgCp = document.getElementById("cap_img");
					 //imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
				 }
			  }
		})
    }
	
	
}
function setDOValueColegiu(tbl)
{
   
	var titlu = document.getElementById("title");
	var nume = document.getElementById("nume");
	var cmp = document.getElementById("comment");
	var sp = document.getElementById("error");
	var codIntrodus = document.getElementById("security_code").value;
	 var url = "pages/reqColegiu.php";
	var curentLocation = window.location.toString();
	var indexStart = curentLocation.lastIndexOf(".");
	var indexEnd = curentLocation.indexOf("&id");
	
	var idxTemp = curentLocation.substring(indexEnd+1,curentLocation.length);
	var idx = idxTemp.replace("id=","");
	idx = idxTemp.replace("#comentariu","");
	idx = idx.replace("id=","");
	
	
	
	
	var pars = "idx="+idx+"&tbl="+tbl+"&security_code="+codIntrodus+"&nume="+encodeURIComponent(nume.value)+"&titlu="+encodeURIComponent(titlu.value)+"&cooment="+encodeURIComponent(cmp.value);
		 
	
	if(cmp.value == "")
	{
        sp.style.display = "";
        sp.className = "errorBig";		
        sp.innerHTML = "Va rugam Completati Camplul marcat cu *";
		cmp.focus();
	}else{
		sp.innerHTML = "";
		sp.style.display = "none";
			$.ajax({
			  type: 'post',
			  url: url,
			  data: pars,
			  success: function(transport) {
				if(transport == "true")
				 {
				   sp.className = "errorBig";
                               sp.innerHTML = "Codul de siguranta introdus nu are aceasi valoare ca cea din imagine!";
				   sp.style.display = "";
				   
				 }
				 else if (transport == "suc")
				 {
					 sp.className = "error";
                                    sp.innerHTML = "Comentariul a fost introdus cu succes!";
				        
                                    sp.style.display = "";
					 var imgCp = document.getElementById("cap_img");
					 imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
					 
					 
				 }else if ( transport == "exists")
				 {
				    sp.innerHTML = "Acest Comentariu a mai fost adaugat!";
					sp.style.display = "";
					var imgCp = document.getElementById("cap_img");
					 imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
					
				 }
				 
				 
		  }
		});
	}
	

	  
	
}
function setDoValueProiecte()
{
   var nume = document.getElementById("nume");
   var prenume = document.getElementById("pnum");	
	var email = document.getElementById("mail");
	var companie = document.getElementById("comp");
	var adresa = document.getElementById("adre");
	var tel = document.getElementById("tele");
	var messaj = document.getElementById("descr")
	var sp = document.getElementById("error");
	var codIntrodus = document.getElementById("security_code").value;
	 var url = "pages/reqProiect.php";
	 var pars = "security_code="+codIntrodus+"&nume="+encodeURIComponent(nume.value)+"&prenume="+encodeURIComponent(prenume.value)+"&email="+encodeURIComponent(email.value)+"&cooment="+encodeURIComponent(messaj.value)+"&phon="+tel.value+"&companie="+encodeURIComponent(companie.value)+"&adresa="+encodeURIComponent(adresa.value);
	if( messaj.value == "" )
	{
        messaj.focus();
		sp.style.display = "";
        sp.className = "errorBig";		
        sp.innerHTML = "Va rugam Completati Camplul marcat cu *";
		
	}else{
	   sp.innerHTML = "";
		sp.style.display = "none";
			$.ajax({
			  type: 'post',
			  url : url,
			  data: pars,
			 success: function(transport) {
				
				if(transport == "true")
				 {
				   sp.className = "errorBig";
                   sp.innerHTML = "Codul de siguranta introdus nu are aceasi valoare ca cea din imagine!";
				   sp.style.display = "";
				   
				 }
				 else if (transport == "suc")
				 {
					 sp.className = "error";
                     sp.innerHTML = "Mesajul a fost introdus cu succes!";
				     sp.style.display = "";
					 var imgCp = document.getElementById("cap_img");
					 imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
					 
					
				 }else if ( transport == "exists")
				 {
				    sp.className = "error";
					sp.innerHTML = "Acest Mesaj a mai fost adaugat!";
					sp.style.display = "";
					var imgCp = document.getElementById("cap_img");
					 imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
					// document.getElementById("cap_img").src =  "CaptchaSecurityImages.php?width=100&height=40&characters=5";
				 }
				 
				 
		  }
		});
}
}
function postComment()
{
    	var nume = document.getElementById("name");
	var email = document.getElementById("mail");
	var tel = document.getElementById("phon");
	var messaj = document.getElementById("mess");
	var sp = document.getElementById("error");
	var codIntrodus = document.getElementById("security_code").value;
	 var url = "pages/reqContact.php";
	 var pars = "security_code="+codIntrodus+"&nume="+encodeURIComponent(nume.value)+"&email="+encodeURIComponent(email.value)+"&cooment="+encodeURIComponent(messaj.value)+"&phon="+tel.value;
	 if(nume.value == "" || email.value == "" || tel.value == "" || messaj.value == "" || codIntrodus == "")
	 { 
        sp.style.display = "";
        sp.className = "errorBig";		
        sp.innerHTML = "Va rugam Completati Camplul marcat cu *";
		
	}else{
	   sp.innerHTML = "";
		sp.style.display = "none";
			$.ajax({
			  url: url,
			  type: 'post',
			  data: pars,
			  success: function(transport) {
				if(transport == "true")
				 {
				   sp.className = "errorBig";
                   sp.innerHTML = "Codul de siguranta introdus nu are aceasi valoare ca cea din imagine!";
				   sp.style.display = "";
				   
				 }
				 else if (transport == "suc")
				 {
					 sp.className = "error";
                     sp.innerHTML = "Mesajul a fost introdus cu succes!";
				     sp.style.display = "";
					 var imgCp = document.getElementById("cap_img");
					 imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
					 
					
				 }else if ( transport == "exists")
				 {
				    sp.innerHTML = "Acest Mesaj a mai fost adaugat!";
					sp.style.display = "";
					var imgCp = document.getElementById("cap_img");
					 imgCp.src  = "CaptchaSecurityImages.php?width=100&height=40&characters=5&rnd="+Math.random();
					
				 }
				 
				 
		  }
		});
    }
}
function hideallsubm()
{
 var arr = new Array("activ_pol","parlament","parlament0mass","parlament0actiuni_publice","activ_pol0sed_cl","activ_pol0proj","activ_pol0int_cet","parlament0solicitari_informatii","parlament0legi_lcr","activ_pol0media","colegiu","colegiu0int_cet","colegiu0as_prop","parlament0interpelari");
 for(i=0;i<arr.length;i++)
 {
  document.getElementById(arr[i]).style.display="none";
 }
}
function showsubm(x,y)
{
 if(timeoutid) clearTimeout(timeoutid);
 hideallsubm();
 if((x=='activ_pol') || (x=='parlament') || (x=='colegiu') )
 {
  
  document.getElementById(x).style.display="";
  
  if(y != 'none') {
	     if( y == "actiuni_publice" && x == "parlament")
		 {
		   
		   document.getElementById(x+'0'+y).style.display="none";
		 }else{
			 document.getElementById(x+'0'+y).style.display="";
			 }
	  
	  }
  
 }
}
function showpage(n,name,name2,lines)
{
 
 var link_point = window.location.toString();


 
 var idx = link_point.indexOf(".");
 showsubm(name,name2);

 
 
 //b5
 for(i=1;i<=7;i++) document.getElementById('btn'+i).src="interface/btn"+i+".jpg";
 document.getElementById('btn'+n).src="interface/btn"+n+"-roll.jpg";
 //content
 
 
   for(i=1;i<=7;i++) document.getElementById('c'+i).style.display="none";
   document.getElementById('c'+n).style.display="";
   
   
 
 //lines
 if(lines)
 {
  document.getElementById('l1').style.display="";
  document.getElementById('l2').style.display="";
  document.getElementById('lc').className="page-lines2";
 }
 else
 {
  document.getElementById('l1').style.display="none";
  document.getElementById('l2').style.display="none";
  document.getElementById('lc').className="page-lines";
 }
 //class
 for(i=1;i<=7;i++) if(document.getElementById('bl'+i).className!="bls") document.getElementById('bl'+i).className='bls0';
 if(document.getElementById('bl'+n).className!="bls") document.getElementById('bl'+n).className='bls'+(n-2); 
 if(n == 2 || n==5) document.getElementById("bl"+n).className = 'bls1';
 
 if(name == "activ_pol")  {
	 //alert(document.getElementById("activ_pol").style.display);
	 //document.getElementById("activ_pol").style.position = "relative";
	 //document.getElementById("activ_pol").style.left = "12%";
	 
 }
 
 //on=n;
}
