function emptyFunction() {}

var ie = (window.navigator.userAgent.toLowerCase().indexOf("msie") != -1)? true : false;

var xhr_handler = function(t) {
	alert(t.responseText);
}

function b_manager(action,meme_id,post_id) {
  if(action) {
		detailswindow = window.open("/blogadmin/?action=" + action + "&memeid=" + meme_id + "&postid=" + post_id);
		detailswindow.focus();
  }
}

function b_xhr_manager(action,meme_id,post_id) {
	if(action) {
		q = "/blogadmin/?action=" + action + "&memeid=" + meme_id + "&postid=" + post_id;
		$.ajax({
			url: q,
			async: true,
			success:  function(msg){
    			alert( msg );
			}
		})
	}
}

function adminConnectorMenu(id,connector_id) {
	mgrMenuDiv = top.document.createElement("DIV");
	if (connector_id>0) {
		addItemToMenu('connecteur',connector_id,-1,"Details du connecteur ","cmfirstitem0");
	}
	return mgrMenuDiv;
}

/* Onglets discussion */
function switchTabs(discussion_id,type,on,topCatIdx,url) {
	$("ul.wultabs > li").removeClass("active");
	$('#rtype'+on).addClass("active");
	var params = 'discussionid='+discussion_id+'&type='+type+'&tabidx='+on+'&topCatIdx='+topCatIdx;
	$.ajax({
		type: "GET",
		url: "/blogs/includes/"+url,
		data:params, 
		success: function(html){
			if ($('#tabcontent')) {
				$('#tabcontent').remove();
			}
			if ($('#navigate')) {
				$('#navigate').remove();
			}
				$('.gizmoPagination').remove();
			($("#tabset")).after(html);
		}
	});
	return false;
}

function bloganswer(event,id,discussionid,infoid,displayPseudo,pseudo){
	var tgt=event=(ie)?window.event.srcElement:event.target;top.edit=true;
	a=top.document.getElementById("answer");if(a)a.parentNode.removeChild(a);
	tgt = $('comment'+id);
	fAnswer=top.document.createElement("FORM");fAnswer.style.marginLeft="30px";fAnswer.id="answer";fAnswer.action="/blog/datas/docomment.jsp";fAnswer.target="stdfrm";fAnswer.method="post";
	if(window.attachEvent){fAnswer.attachEvent("onsubmit",ccomment);}else if(window.addEventListener){fAnswer.addEventListener("submit",ccomment,true);};
	if(top.user){fAnswer.appendChild(mkHidInput("user",top.user));};
	if(top.pId){fAnswer.appendChild(mkHidInput("gparentid",top.pId));};
	if(id){fAnswer.appendChild(mkHidInput("parentid",id));};
	fAnswer.appendChild(mkHidInput("id",-1));
	fAnswer.appendChild(mkHidInput("parenttype","2"));
	fAnswer.appendChild(mkHidInput("referrer",""));
	fAnswer.appendChild(mkHidInput("discussionid",discussionid));
	fAnswer.appendChild(mkHidInput("infoid",infoid));
	if(top._target){fAnswer.appendChild(mkHidInput("target",top._target));};
	if(top.subscribe){fAnswer.appendChild(mkHidInput("commentalert","on"));};
	cDiv=top.document.createElement("DIV");cDiv.className="comments";fAnswer.appendChild(cDiv);
	fDiv=top.document.createElement("DIV");fDiv.className="form";cDiv.appendChild(fDiv);
	faDiv=top.document.createElement("DIV");faDiv.className="form-area";fDiv.appendChild(faDiv);
	ul=top.document.createElement("UL");faDiv.appendChild(ul);	
	liTitle=top.document.createElement("LI");ul.appendChild(liTitle);
	h3=top.document.createElement("H3");liTitle.appendChild(h3);	h3.appendChild(top.document.createTextNode(top._fillComment));
	if (displayPseudo) {
	  labelPseudo=top.document.createElement("label");liTitle.appendChild(labelPseudo);labelPseudo.appendChild(top.document.createTextNode(top._fillPseudo));
	  inputPseudo=top.document.createElement("input");inputPseudo.name="pseudo";inputPseudo.size="45";inputPseudo.maxLength="45";inputPseudo.className="text";inputPseudo.value=pseudo;liTitle.appendChild(inputPseudo);
	}
	liTitlec=top.document.createElement("LI");ul.appendChild(liTitlec);
	labelTitle=top.document.createElement("label");liTitlec.appendChild(labelTitle);	labelTitle.appendChild(top.document.createTextNode(top._fillTitle));
	tinput=top.document.createElement("input");tinput.name="title";tinput.size="70";tinput.maxLength="70";tinput.className="text";liTitlec.appendChild(tinput);
	liText=top.document.createElement("LI");ul.appendChild(liText);
	labelText=top.document.createElement("label");liText.appendChild(labelText);labelText.appendChild(top.document.createTextNode(top._fillAnswer));
	tArea=top.document.createElement("TEXTAREA");tArea.name="comment";liText.appendChild(tArea);
	liValidate=top.document.createElement("LI");ul.appendChild(liValidate);
	labelCaptcha=top.document.createElement("label");liValidate.appendChild(labelCaptcha);labelCaptcha.appendChild(top.document.createTextNode(top._pleasefillcapt));
	bubbleDiv=top.document.createElement("DIV");bubbleDiv.className="inf";liValidate.appendChild(bubbleDiv);
	bubA=top.document.createElement("A");bubA.href="#";bubbleDiv.appendChild(bubA);
	bubPopup=top.document.createElement("DIV");bubPopup.className="pop-up";bubbleDiv.appendChild(bubPopup);
	bubTop=top.document.createElement("SPAN");bubTop.className="top-bg";bubTop.appendChild(top.document.createTextNode(" "));bubPopup.appendChild(bubTop);
	bubP=top.document.createElement("P");bubPopup.appendChild(bubP);
	bubTxt=top.document.createElement("SPAN");bubTxt.appendChild(top.document.createTextNode(top._humanControl));bubP.appendChild(bubTxt);
	bubBt=top.document.createElement("SPAN");bubBt.className="bt-bg";bubBt.appendChild(top.document.createTextNode(" "));bubPopup.appendChild(bubBt);
	captchaDiv=top.document.createElement("DIV");captchaDiv.className="pic";liValidate.appendChild(captchaDiv);
	captchaImg=top.document.createElement("IMG");captchaImg.src="/captcha";captchaImg.className="captimg";captchaImg.id="captimganswser";captchaDiv.appendChild(captchaImg);
	captchaInput=top.document.createElement("INPUT");captchaInput.className="text";captchaInput.type="text";captchaInput.name="captchacodes";captchaInput.value="";captchaInput.size=5;liValidate.appendChild(captchaInput);	
	liSave=top.document.createElement("LI");ul.appendChild(liSave);
  if(top._thxforparticipating != undefined){labelThx=top.document.createElement("label");liSave.appendChild(labelThx);labelThx.appendChild(top.document.createTextNode(top._thxforparticipating));};
	saveButton=top.document.createElement("INPUT");saveButton.type="submit";saveButton.className="submit";saveButton.value=top._saveComment;liSave.appendChild(saveButton);
	answerAlert=top.document.createElement("DIV");answerAlert.className="editoralert";answerAlert.id="bcAnswer";liSave.appendChild(answerAlert);
	iBefore=tgt.nextSibling;while(iBefore.nodeType!=1){iBefore=iBefore.nextSibling;};
	tgt.parentNode.insertBefore(fAnswer,iBefore);
}
