function popup_url(url) {
  wx=screen.width-708;
  window_name="phpLeWeb_popup";
  window.open(url, window_name, "toolbar=yes,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,copyhistory=no,width=708,height=600,left="+wx+",top=0"); 
}

js_href_base='';

function popup_help(help) { popup_url(js_href_base+"help_popup.php?help="+help) }
function popup_cond() { popup_url(js_href_base+"cond_gene.php") }
function popup_rdvl(login) { window.location=js_href_base+main_page+"?gmode=show_item&cat=users&login="+login; }
function popup_rdvl2(login) { popup_url(js_href_base+"popup.php?gmode=show_item&cat=users&login="+login) }
function popup_item(cat,item) { window.location=js_href_base+main_page+'?gmode=show_item&cat='+cat+'&item='+item; }
function popup_edit_item(cat,item) { window.location=js_href_base+main_page+"?gmode=edit_item&cat="+cat+"&item="+item; }
function popup_item2(cat,item) { popup_url(js_href_base+'popup.php?gmode=show_item&cat='+cat+'&item='+item) }
function popup_edit_item2(cat,item) { popup_url(js_href_base+"popup.php?gmode=edit_item&cat="+cat+"&item="+item) }
function popup_invite(from,to,rqst) { popup_url(js_href_base+"invite.php?state="+rqst+"&from="+from+"&to="+to) }
function popup_rdv(id) { popup_item("users",id)}
function popup_rdv2(id) { popup_item2("users",id)}
function popup_message(mid,from,to) { window.location=js_href_base+main_page+"?gmode=show_item&cat=messages&item="+mid+"&from="+from+"&to="+to; }
function popup_messagel(from,to) { window.location=js_href_base+main_page+"?gmode=show_item&cat=messages&item=insert&from="+from+"&to_login="+to; }

function popup_smileys(frame,obj) 
{
  wx=screen.width-600;

  frame.window.open("smileys.php?lang="+lang+"&obj_name="+obj, "smileys", "toolbar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,copyhistory=no,width=500,height=450,top=0,left="+wx); 
}

function popup_attach_media(frame,id,acat,aitem)
{
  wx=screen.width-600;

  frame.window.open("popup.php?lang="+lang+"&textareaid="+id+"&gmode=show_cat&cat=attached_gallery_"+lang+"&acat="+acat+"&aitem="+aitem, "attach_image", "toolbar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,copyhistory=no,width=600,height=600,top=0,left="+wx); 
}

function popup_icons(frame,obj) 
{
  wx=screen.width-600;

  frame.window.open("icons.php?lang="+lang+"&obj_name="+obj, "icons", "toolbar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,copyhistory=no,width=500,height=450,top=0,left="+wx); 
}

function popup_chat(room)
{
  wx=0; 
  window.open("chat.php?lang="+lang+"&disp_pub=1&room="+room, "rdv_chat", "toolbar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,copyhistory=no,width=900,height=700,left="+wx+",top=0"); 
}


function del_item(cat,item)
{
  var a = false;

  a=confirm('Voulez-vous vraiment effacer ?');
  if (a)
  {
	window.location="/popup.php?lang="+lang+"&gmode=delete_item&cat="+cat+"&item="+item;
  }
}


function checkAll(doc) {
  for(i=0;i<doc.form_sel.elements.length;i++)
  {
   if (doc.form_sel.elements[i].type == "checkbox")
        doc.form_sel.elements[i].checked = true;
  }
}

function invCheckAll(doc) {
  for(i=0;i<doc.form_sel.elements.length;i++)
  {
   if (doc.form_sel.elements[i].type == "checkbox")
        doc.form_sel.elements[i].checked = !doc.form_sel.elements[i].checked; 
  }
}

function submitAction(doc,action) {
  doc.form_sel.action.value=action;
  doc.form_sel.submit();
}

function dialWithUser(id,login,age,sexe,ville,gville,pays,state,blacklist,thumb) {
	if (user_info_approuve!='oui') {
		alert(parent.str_NoDialWhenNotApprouved);
	} else {
		if (parent.document!=d) {
			if (parent.setUserDial(id,login,age,sexe,ville,gville,pays,state,blacklist,thumb)) parent.openDial();
		} else {
			if (window.opener.parent.setUserDial(id,login,age,sexe,ville,gville,pays,state,blacklist,thumb)) {
				window.opener.parent.openDial();
				window.opener.window.focus();
				self.window.close();
			} else {
				self.window.focus();
			}
		}
	}
}

function inscription() {
	if (window.opener && !window.opener.closed)
 	{
		window.opener.location.href="index.php?&gmode=edit_item&cat=users&item=insert";
		window.opener.window.focus();
		self.window.close();
	} else {
		self.location.href="index.php?&gmode=edit_item&cat=users&item=insert";
	}
}

function doBlink() {
	var blink = document.all.tags("BLINK")
	for (var i=0; i<blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
	if (document.all)
		setInterval("doBlink()",500)
}
window.onload = startBlink;
