// JavaScript Document
function v_sand(cas){
	if(cas){
		alert('لا يمكنك التصويت مرة أخرى');
		return false;
		}
		else{
			alert('شكرا على تصويتك \n سيتم نقلك إلى نتائح الإستفتاء');
		return true;
			}
}

function open_win_div(id){
document.getElementById(id).style.display='';
location.href="#";
}
function close_win_div(id){
document.getElementById(id).style.display='none';
}
function url(url){
location.href=url;
}
function del(url){
	var d=confirm('هل أنت متأكد من عملية الحذف');
	if(d)
location.href=url;
}
function change_cs(chem){
	if(document.getElementById('code_suc').src.match(/securitecode.php$/i)!=null)
document.getElementById('code_suc').src=chem+"/includes/securitecode2.php";
else
document.getElementById('code_suc').src=chem+"/includes/securitecode.php";
}
function checked_tout(id){
var	n_chek=document.getElementsByName(id+'[]').length;
if(document.getElementById(id).checked){
for(cont=0;cont<n_chek;cont++)
document.getElementsByName(id+'[]')[cont].checked=true;
}
else{
	for(cont=0;cont<n_chek;cont++)
document.getElementsByName(id+'[]')[cont].checked=false;
	}
}
function GetId(id)
				{
				return document.getElementById(id);
				}
				var aff_bulle=false; 
				
				function move(e) {
				  if(aff_bulle) {  
				  if (navigator.appName!="Microsoft Internet Explorer") { 
				    GetId("infobulle").style.left=e.pageX + 5+"px";
				    GetId("infobulle").style.top=e.pageY + 10+"px";
				    }
				    else { 
				    if(document.documentElement.clientWidth>0) {
				        GetId("infobulle").style.left=event.x+"px";
				        GetId("infobulle").style.top=10+event.y+"px";
				    }
				    else {
				        GetId("infobulle").style.left=5+event.x+"px";
				        GetId("infobulle").style.top=10+event.y+"px";
				    }
				    }
				  }
				}
				
				function montre(text) {
					
				  if(aff_bulle==false) {
				  GetId("infobulle").style.visibility="visible"; // Si il est cacher (la verif n'est qu'une securité) on le rend visible.
				  GetId("infobulle").innerHTML = text; // Cette fonction est a améliorer, il parait qu'elle n'est pas valide (mais elle marche)
				  aff_bulle=true;
				  }
				  
				}
				function cache() {
				if(aff_bulle==true) {
				GetId("infobulle").style.visibility="hidden"; // Si la bulle etais visible on la cache
				aff_bulle=false;
				}
				
				}
				//GetId("curseur").onmouseout = cache;
				window.document.onmousemove=move; 
				window.document.onmouseout = cache;
				document.write('<div id="infobulle" style="position: absolute;visibility: hidden;"></div>');
				
function input_vide(id){
	document.getElementsByName(id)[0].value='';
	}
function winop(idn,w,h){
wincom=window.open(idn,'com','resizable=0,width='+w+',height='+h+',scrollbars=yes,left=350,top=250');
wincom.window.focus();
}
function change_style_name(name,id){
	document.getElementById(id).className=name;
}

function position(id) {
                    if (navigator.appName!="Microsoft Internet Explorer") { 
				    document.getElementById(id).style.left="auto";
				    document.getElementById(id).style.top="170px";
				    }
					else {
				        document.getElementById(id).style.left=5+event.x+"px";
				        document.getElementById(id).style.top=10+event.y+"px";
				    }  
				}
	function daiapo_texte(id){
	this.id=id;
	this.retar=2000;
	this.d_t=new Array();
	this.d_t_a=0;
this.auto=function(){
	document.getElementById(this.id).innerHTML =this.d_t[this.d_t_a];
	if(this.d_t_a==this.d_t.length-1)
	this.d_t_a=0;
	else
	this.d_t_a=this.d_t_a+1;
}
this.suiv=function(){
	if(this.d_t_a==this.d_t.length-1)
	this.d_t_a=0;
	else
	this.d_t_a=this.d_t_a+1;
	document.getElementById(this.id).innerHTML =this.d_t[this.d_t_a];
}
this.prev=function(){
	if(this.d_t_a==0)
	this.d_t_a=this.d_t.length-1;
	else
	this.d_t_a=this.d_t_a-1;
	document.getElementById(this.id).innerHTML =this.d_t[this.d_t_a];
}
this.selec=function(dt){
	this.d_t_a=dt;
	document.getElementById(this.id).innerHTML =this.d_t[dt];
}
this.go=function(obj){
	this.auto();
set=setInterval(obj+".auto()",this.retar);	
}
this.stp=function(){
	clearInterval(set);
}
}		

function aff_img(sr,tx){
	url('#');
	document.getElementById('aff_img').style.display='';
	document.getElementById('aff_img').innerHTML='<center><div class="dp_txt_alb"><center>'+tx+'<br>إضغط على الصورة لإخفائها</center></div><img src="'+sr+'" onclick="disp_img()"  alt="إضغط على الصورة لإخفائها"><center>';
}
function disp_img(){
	document.getElementById('aff_img').innerHTML='';
document.getElementById('aff_img').style.display='none';	
}
