var PHP_SELF=window.location.href.replace('http://www.inboxjournal.com','');
	var http_request = false;

onerror=handleErr;
var editor = new Array();
function StripTags(strMod){
    if(arguments.length<3) strMod=strMod.replace(/<\/?(?!\!)[^>]*>/gi, '');
    else{
        var IsAllowed=arguments[1];
        var Specified=eval("["+arguments[2]+"]");
        if(IsAllowed){
            var strRegExp='</?(?!(' + Specified.join('|') + '))\b[^>]*>';
            strMod=strMod.replace(new RegExp(strRegExp, 'gi'), '');
        }else{
            var strRegExp='</?(' + Specified.join('|') + ')\b[^>]*>';
            strMod=strMod.replace(new RegExp(strRegExp, 'gi'), '');
        }
    }
    return strMod;
}

//begin tooltip functions
function toolTip(text,me) {
  theObj=me;
  theObj.onmousemove=updatePos;
  theObj.style.cursor='hand';
  document.getElementById('toolTipBox').innerHTML=text;
  document.getElementById('toolTipBox').style.display="block";
  document.getElementById('toolTipBox').style.width="260px";
  window.onscroll=updatePos;
}
function updatePos() {
  var ev=arguments[0]?arguments[0]:event;
  var x=ev.clientX;
  var y=ev.clientY;
  diffX=24;
  diffY=0;
  document.getElementById('toolTipBox').style.top  = y-2+diffY+Math.max(document.body.scrollTop,document.documentElement.scrollTop)+"px";
  document.getElementById('toolTipBox').style.left = x-2+diffX+document.body.scrollLeft+"px";
  theObj.onmouseout=hideMe;
}
function hideMe() {
  document.getElementById('toolTipBox').style.display="none";
}
//end tooltip functions

function __fncSubmitJournal(journalId){
		var valid = validate(journalId);
		if (canAdd & valid['status']) {
			canAdd=false;
			var Eentry = editor[journalId].getData();
			var Etitle = eval("document.edj"+journalId+".tit"+journalId+".value");
			var Etype_private = eval("document.edj"+journalId+".jType"+journalId+"[0]");
			var Etype_public = eval("document.edj"+journalId+".jType"+journalId+"[1]");
			if (Etype_private.checked){
				Etype="R";
			}else{
				Etype="P";
			}
			var Etags = eval("document.edj"+journalId+".ta"+journalId+".value");
			var Eyear = eval("document.edj"+journalId+".syear"+journalId+".value");
			var Emonth = eval("document.edj"+journalId+".smonth"+journalId+".value");
			var Eday = eval("document.edj"+journalId+".sday"+journalId+".value");
	
			var hp = new HTTPPost();
			var post=new Array;
			post['txtWhat2Do']="SJ";
			post['txtJournalId']=journalId;
			post['m']=PHP_SELF;
			post["entry"+journalId]=Eentry;
			post["title"+journalId]=Etitle;
			post["tags"+journalId]=Etags;
			post["type"+journalId]=Etype;
			post["syear"+journalId]=Eyear;
			post["smonth"+journalId]=Emonth;
			post["sday"+journalId]=Eday;
			__fncKillEditor(journalId);
			hp.postData('/ajax_saveJournal.php',post, ShowEntryDetails, true);
			canAdd=true;
	}else{
		alert(valid['error']);
	}
}
function validate(id){
			var Eentry = editor[id].getData();
			var ret=new Array();
			var Eyear = eval("document.edj"+id+".syear"+id+".value");
			var Emonth = eval("document.edj"+id+".smonth"+id+".value");
			var Eday = eval("document.edj"+id+".sday"+id+".value");
			var input_date = new Date();
			input_date.setFullYear(Eyear,Emonth-1,Eday);
			var currentTime = new Date();
			if(input_date > currentTime){
				ret['status']=false;
				ret['error']="You are trying to save an entry for a future date. Please select a past date or the current date.";
				return ret;
			}else{
				ret['status']=true;
			}
			if (Eentry.length==0){
				ret['error']="You are trying to save an empty Journal.";
				ret['status']=false;
				return ret;
			}else{
				ret['status']=true;
			}
			return ret;
}

function __reloadJournal(journalId){
		if (canAdd) {
			canAdd=false;
			var hp = new HTTPPost();
			var post=new Array;
			post['txtWhat2Do']="reload";
			post['txtJournalId']=journalId;
			hp.postData('/ajax_saveJournal.php',post, ShowEntryDetails, true);
			canAdd=true;
	}
}


	function ShowEntryDetails(http_request){
		if (http_request.readyState == 4){
			if (http_request.status == 200){
				//alert(http_request.responseText);
				results = http_request.responseText.split("?^?^");
				if (results[0]=='ok'){
					did=results[1];
					dentryType=results[2];
					djournal=results[3];
					ddate=results[4];
					dtitle=results[5];
					dtags=results[6];
					if (dentryType=='R') document.getElementById('priv_ico'+did).style.display='inline';
					else document.getElementById('priv_ico'+did).style.display='none';
					document.getElementById('ddate'+did).innerHTML=ddate;
					document.getElementById('entr'+did).innerHTML=djournal;
					document.getElementById('titld'+did).innerHTML=dtitle;
					document.getElementById('titld'+did).style.display='block';
					document.getElementById('ta'+did).innerHTML=dtags;
				}
			} else {
				alert('There was a problem with the request.');
				document.write(http_request.status);
			}
		}
	}

function __fncKillEditor(id){
	var editorid='entr'+id;
	var titleDisplay='titld'+id;
	var titleEditor='titlee'+id;
	var titleed='tit'+id;
	var tagsid='ta'+id;
	var subbut='bts'+id;
	var radiotype='etype'+id;
	var datebox='dat'+id;
	document.getElementById(editorid).innerHTML='';
	document.getElementById(titleEditor).innerHTML='';
	document.getElementById(titleEditor).style.display='none';
	document.getElementById(tagsid).innerHTML='';
	document.getElementById(subbut).style.display="none";
	document.getElementById(radiotype).style.display="none";
	document.getElementById(datebox).style.display="none";
	editor[id] = null;
	
}




function __fncShowEditor(id,ckwidth){
	if (!ckwidth) var ckwidth=400;
	var editorid='entr'+id;
	var titleDisplay='titld'+id;
	var titleEditor='titlee'+id;
	var titleed='tit'+id;
	var tagsid='ta'+id;
	var tagb='tagb'+id;
	var subbut='bts'+id;
	var radiotype='etype'+id;
	var datebox='dat'+id;
	// Create a new editor inside the <div id="editor">
	if (editor[id]) {
		document.getElementById(editorid).innerHTML='';
		document.getElementById(titleEditor).innerHTML='';
		document.getElementById(titleEditor).style.display="none";
		document.getElementById(tagsid).innerHTML='';
		document.getElementById(subbut).style.display="none";
		document.getElementById(radiotype).style.display="none";
		document.getElementById(datebox).style.display="none";

		//editor[id].destroy(); //this is not working solo in IE - focus is necessary
		editor[id] = null;
		__reloadJournal(id);
		return;
	}else{
		var entryHTML = document.getElementById(editorid).innerHTML;
		var titleHTML = document.getElementById(titleDisplay).innerHTML;
		document.getElementById(titleDisplay).innerHTML="";
		var tagsHTML = document.getElementById(tagsid).innerHTML;
		document.getElementById(titleEditor).innerHTML='Title:<input name="tit'+id+'" type="text" value="'+titleHTML+'">';
		document.getElementById(titleEditor).style.display='block';
		document.getElementById(tagsid).innerHTML='<input name="ta'+id+'" type="text" value="'+StripTags(tagsHTML)+'">';
		document.getElementById(tagb).style.display='block';
		document.getElementById(subbut).style.display="block";
		document.getElementById(radiotype).style.display="block";
		document.getElementById(datebox).style.display="block";
		document.getElementById(editorid).innerHTML="";
		editor[id] = CKEDITOR.appendTo(editorid,{
				toolbar : 'short',
        uiColor : '#9AB8F3',
        height	:	300,
        width	:	ckwidth
    });
	editor[id].setData(entryHTML);
	
	}
	/*
		var Iscomment =document.getElementById("comment_detail_"+id);
		if(Iscomment.innerHTML==""){
			var hp = new HTTPPost();
			document.getElementById("comment_detail_"+id).style.display="block";
			hp.postData('/showcomment.php', 'jID='+id, ShowCommentDetails, true);
		}else{
			__fncCloseCommentDetail(id);
			//__fncShowCommentTextarea(id);
		}
		*/
}


function submitSearch() {
	var theForm=document.getElementById('searchForm');
	var wordsStr=document.getElementById('searchKeyword').value;
	wordsStr=wordsStr.replace(/(^\s*)|(\s*$)/g,'') //trim spaces
	wordsStr=wordsStr.replace(/\s+/g,' ');
	wordsStr=wordsStr.replace(/ /g, '_');	//replace all spaces with underscore
	theForm.action = '/publicjournal/search/'+wordsStr;
  	theForm.submit();
}
function criteriaSearch() {
	var theForm=document.getElementById('cSearch');
	var age=document.getElementById('age').value;
	var gender=document.getElementById('gender').value;
	var country=document.getElementById('country').value;
	var criteriaURL='';
	if (age){
		criteriaURL=criteriaURL+'/age/'+age;
	}
	if (gender)	{
		criteriaURL=criteriaURL+'/gender/'+gender;
	}
	if (country)	{
		criteriaURL=criteriaURL+'/country/'+country;
	}
	theForm.action = '/publicjournal'+criteriaURL;
  	theForm.submit();
}
function isText(evt){
         var charCode = (evt.which) ? evt.which : event.keyCode
         if ((charCode > 48 && charCode < 57) || (charCode > 63 && charCode < 91) || (charCode > 96 && charCode < 123) || charCode == 8 || charCode == 127|| charCode == 32)
            return true;
         return false;
}
function handleErr(msg,url,l){
	txt="We are trying to improve this site for You, but errors happen.<br>Please be patient will be fixed soon.<br><br>";
	txt+="Error: " + msg + "<br>";
	txt+="URL: " + url + "<br>";
	txt+="Line: " + l + "<br><br>";
	txt+="Click OK to continue.<br><br>";
	var mess=document.getElementById('error_message');
	if (mess) {
		mess.innerHTML=txt;
		mess.style.display="block";
		setTimeout("document.getElementById('error_message').style.display='none'",8000);
	}
	return false;
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return false;
}
var avoid_url=document.location.href;
if (!avoid_url.match("http://www.inboxjournal.com/id/")){
	addEvent = function (obj, evType, fn){ 
	 if (obj.addEventListener){ 
	   obj.addEventListener(evType, fn, false); 
	   return true; 
	 } else if (obj.attachEvent){ 
	   var r = obj.attachEvent("on"+evType, fn); 
	   return r; 
	 } else { 
	   return false; 
	 } 
	}
}
var userID=0;
var gotUserID=false;
getUserID();

function getUserID() {
	var hp = new HTTPPost();
	hp.postData('/uid.php', '', setUserID, true,true);		
}

function setUserID(req) {
	if (req.readyState == 4) {
		if (req.status == 200) {
			userID=req.responseText;
			if (userID=="") userID=0;
			gotUserID=true;
		}
	}
}

function fncCheckFriend(cback) {
	if (gotUserID) {
		if (userID!=userDetailsID) {
			var hp = new HTTPPost();
			hp.postData('/friend.php', 'todo=cF&uid1='+userID+'&uid2='+userDetailsID+'&cback='+cback, proceedFriend, true,true);
		}	else {
			sFriendRowSet=true;
		}
	} else {
		setTimeout("fncCheckFriend('"+cback+"');",100);
	}
}

var sFriendRow=false;
var sFriendRowSet=false;

function addFriendLIShow(r) {
	sFriendRowSet=true;
	if ((r=="false") || true) {
		document.getElementById('addFriendLI').className="dLI";
		document.getElementById('sendMessageLI').className="dLI";
		sFriendRow=true;
	}
}

function fncBookmark_friends(cback) {
	if (gotUserID) {
		if (userID!=userDetailsID) {
			var hp = new HTTPPost();
			hp.postData('/friend.php', 'todo=cF&uid1='+userID+'&uid2='+userDetailsID+'&cback='+cback, proceedFriend, true,true);		
		} else {
			sFriendRowSet=true;
		}
	} else {
		setTimeout("fncBookmark_friends('"+cback+"');",100);
	}
}

function bookmarkFriendLIShow(r) {
	sFriendRowSet=true;
	if ((r=="false") || true) {
		document.getElementById('bookmarkFriendLI').className="dLI";
		document.getElementById('sendMessageLI').className="dLI";
		sFriendRow=true;
	}
}

function friendAccess(uid1,cback) {
	var hp = new HTTPPost();
	hp.postData('/friend.php', 'todo=fA&uid1='+uid1+'&cback='+cback, proceedFriend, true,true);		
}

function proceedFriend(req) {
	if (req.readyState == 4) {
		if (req.status == 200) {
			var r=req.responseText;
			r=r.split("|");
			if (typeof(r[1])!="undefined") setTimeout(r[1]+"('"+r[0]+"')",1);
		}
	}
}

function showPrivPostLink(show) {
	if (show=="true") document.getElementById('privPostLink').className="dTR";
}

//display form with no slide
function displayForm2(jId) {
	if (gotUserID) {
		var addH=0;
		var H=0;
		if (userID==0) {
			var i='Username:&nbsp;<input type="text" name="user'+jId+'"><br>Password:&nbsp;&nbsp;<input type="password" name="pass'+jId+'"><br><input type="button" id="addComm_'+jId+'" name="addcomment" value="Add Comment"  onclick="this.style.display=\'none\'; __fncAddComment1(\''+jId+'\',\'0\')">';
			H=290+addH;
		} else {
			var i='<input type="button" id="addComm_'+jId+'" name="addcomment" value="Add Comment"  onclick="this.style.display=\'none\';  __fncAddComment(\''+jId+'\',\''+userID+'\')">';
			H=220+addH;
		}
		document.getElementById("formRow"+jId).innerHTML=i;
		document.getElementById("txtarea_"+jId).style.display="none";
	} else {
		setTimeout("displayForm2('"+jId+"');",100);
		document.getElementById("txtarea_"+jId).style.display="none";
	}
}



function editDelPost(id,s) {
	if (gotUserID) {
		if (typeof(s)=="undefined") s="dTR";
		if ((userID!=0) && (userID==userDetailsID)) document.getElementById(id).className=s;
	} else {
		setTimeout("editDelPost('"+id+"');",100);
	}
}
	function __fncViewJournal1(id,order,photo,photo_status,keyword){
	     http_request = false;
	if (window.XMLHttpRequest){
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            return false;
        }
        http_request.onreadystatechange = alertContents;
        http_request.open('POST', 'http://www.inboxjournal.com/publicjournalaction.php', true);
           http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http_request.send('txtWhat2Do=VIEW&txtJournalId='+id+'&txtOrderType='+order+'&photo='+photo+'&photo_status='+photo_status+'&keyword='+keyword);
	}
	function alertContents(){
		if (http_request.readyState == 4){
			if (http_request.status == 200){
				results = http_request.responseText.split("?^?^");
				//alert(results[0]);
				document.getElementById(eval(results[1])).innerHTML ="" ;
				document.getElementById(eval(results[1])).innerHTML ='<font color="#000000">'+results[0]+'</font>' ;
			} else {
				alert('There was a problem with the request.');
				document.write(http_request.status);
			}
		}
	}
	function __fncViewJournal(journalId,gender,country,age,strOrder){
		document.frmDisplayJournallist.txtWhat2Do.value				=	'VIEW';
		document.frmDisplayJournallist.txtOrderType.value 			= strOrder;
		document.frmDisplayJournallist.txtJournalId.value			=	journalId;
		document.frmDisplayJournallist.cboAge.value					=	age;
		document.frmDisplayJournallist.cboGender.value				=	gender;
		document.frmDisplayJournallist.cboCountry.value				=	country;
		document.frmDisplayJournallist.submit();
	}
	function __fncMoreJournal(journalId,userId){
		document.frmDisplayJournallist.txtWhat2Do.value				=	'VIEW';
		document.frmDisplayJournallist.txtJournalId.value			=	journalId;
		document.frmDisplayJournallist.txtuserID.value			    =	userId;
		document.frmDisplayJournallist.submit();
	}
	function __fncPagingSearchbykeyword(s1,searchkeyword){
		document.frmsearchkey.s.value =	s1;
		document.frmsearchkey.searchbykeyword.value	=	searchkeyword;
		document.frmsearchkey.action="http://www.inboxjournal.com/publicjournal_old.php"
		document.frmsearchkey.submit();
	}
	function __fncPagingSearch(s1,age,gender,country){
		document.frmSearch.c.value =	s1;
		document.frmSearch.cboAge.value	=	age;
		document.frmSearch.cboGender.value	=	gender;
		document.frmSearch.cboCountry.value	=	country;
		document.frmSearch.action="http://www.inboxjournal.com/publicjournal_old.php"
		document.frmSearch.submit();
	}
	function __fncPagingSearchbytag(s1,tag){
		document.frmsearchtag.t.value =	s1;
		document.frmsearchtag.searchbytag.value	=	tag;
		document.frmsearchtag.action="http://www.inboxjournal.com/publicjournal_old.php"
		document.frmsearchtag.submit();
	}
	function __fncSearch(){
		document.frmSearch.action = 'publicjournal_old.php';
		document.frmSearch.submit();
	}
	function __fncSearchbykeyword(){
		if(document.frmsearchkey.searchbykeyword.value==""){
			alert("Please enter the keyword for search");
			document.frmsearchkey.searchbykeyword.focus();
			return false;
		}
		document.frmsearchkey.action = 'publicjournal.php';
		document.frmsearchkey.submit();
	}
	function __fncSearchbytag(){
		if(document.frmsearchtag.searchbytag.value==""){
			alert("Please enter the tag for search");
			document.frmsearchtag.searchbytag.focus();
			return false;
		}
		document.frmsearchtag.submit();
	}
	function __fnckeytag(tag){
		result=tag.split("(");
		document.frmsearchtag.searchbytag.value=result[0];
		document.frmsearchtag.action	=	'/publicjournal.php';
		document.frmsearchtag.submit();
	}
	function __fnckeytagSR(tag){
		result=tag.split("(");
		document.frmsearchtag.searchbytag.value=result[0];
		document.frmsearchtag.action	=	'/searchresults.php';
		document.frmsearchtag.submit();
	}
	function __fncviewmore(len){
		test5popupactivate(document.forms['form5'].test5,'anchor5')
	}
	function __fncviewless(){
		if(document.getElementById("mainsearchbox1test"))
		document.getElementById("mainsearchbox1test").id='mainsearchboxtest';
		else
		document.getElementById("mainsearchbox2test").id='mainsearchbox1test';
		document.getElementById("without_more").style.display='none';					
		document.getElementById("with_more").style.display='inline';
		}	

	var canAdd=true;
	function __fncAddComment(journalId,userId){
	if (canAdd) {
		canAdd=false;
		var text = eval("document.frmAddComment"+journalId+".txtcomment_"+journalId+".value");
		var tag = eval("document.frmAddComment"+journalId+".newtag"+journalId+".value");
		var hp = new HTTPPost();
		var post=new Array;
		post['txtWhat2Do']="ADDCOMMENT";
		post['txtJournalId']=journalId;
		post['txtuserID']=userId;
		post['m']=PHP_SELF;
		post["txtcomment_"+journalId]=text;
		post["newtag"+journalId]=tag;
		hp.postData('/showcomment.php', post, ShowCommentDetails, true);
	}
	}
	function __fncAddComment1(journalId,userId){
	if (canAdd) {
		canAdd=false;
		var text = eval("document.frmAddComment"+journalId+".txtcomment_"+journalId+".value");
		var tag = eval("document.frmAddComment"+journalId+".newtag"+journalId+".value");
		var user = eval("document.frmAddComment"+journalId+".user"+journalId+".value");
		var pass = eval("document.frmAddComment"+journalId+".pass"+journalId+".value");

		var hp = new HTTPPost();
		var post=new Array;
		post['txtWhat2Do']="ADDCOMMENT1";
		post['txtJournalId']=journalId;
		post['txtuserID']=userId;
		post['m']=PHP_SELF;
		post["txtcomment_"+journalId]=text;
		post["newtag"+journalId]=tag;
		post["user"+journalId]=user;
		post["pass"+journalId]=pass;
		
		hp.postData('/showcomment.php',post, ShowCommentDetails, true);
	}
	}

	/*****************For commenting feature*********************/
	
function simpleSwitch(obj) {
	//alert(obj);
	var el = document.getElementById(obj);
	if ( el.style.display!= 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'block';
	}
}


function searchSwitch(obj) {
	//alert(obj);
	var el = document.getElementById(obj);
	if ( el.style.display!= 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'block';
	}
} 
	
	function __fncAddTag(tag,journal){
		comment_tag = document.getElementById("newtag"+journal);
		if(comment_tag.value=="")
		comment_tag.value=tag;
		else
		comment_tag.value+=', '+tag;
	}
	function __fncShowCommentTextarea(textareaId){
		//setTimeout("collapse"+textareaId+".slideit()",500);
		simpleSwitch("txtarea_"+textareaId);
	}
	function __fncCloseCommentTextarea(textareaId){
		document.getElementById('txtarea_'+textareaId).style.display = 'none';
	}
	function __fncCloseCommentDetail(id){
		//var collapseTmp=new animatedcollapse("comment_detail_"+id, 1000, false,"block");
		//collapseTmp.slideup("comment_detail_"+id);
		setTimeout("clearComment('comment_detail_"+id+"')",10);
		document.getElementById("comment_detail_"+id).style.display="none";
		//document.getElementById("comment_detail_"+id).visibility="hidden";
	}
	function clearComment(id) {
		var obj=document.getElementById(id);
		//obj.style.position="absolute";
		//obj.style.left="-10000px";
		obj.innerHTML="";
		//obj.style.height="";
	}
	function __fncShowCommentDetail(id){
		var Iscomment =document.getElementById("comment_detail_"+id);
		if(Iscomment.innerHTML==""){
			var hp = new HTTPPost();
			document.getElementById("comment_detail_"+id).style.display="block";
			hp.postData('/showcomment.php', 'jID='+id, ShowCommentDetails, true);
		}else{
			__fncCloseCommentDetail(id);
			//__fncShowCommentTextarea(id);
		}				
	}
	function ShowCommentDetails(http_request){
		if (http_request.readyState == 4){
			if (http_request.status == 200){
				results = http_request.responseText.split("?^?^");
				var commentid = document.getElementById("comment_detail_"+results[2]);
				if (commentid && commentid.innerHTML != null){
				if ((commentid.innerHTML!="") || (results[3]=="d")) {
					__fncCloseCommentDetail(results[2]);
				} else {
					if (results[0]=="Sorry the Selected comment Details does not exists.") {
						commentid.innerHTML="&nbsp;";
						if(document.getElementById("TcommentsNum"+results[2])) document.getElementById("TcommentsNum"+results[2]).style.display="none";
					} else {
						commentid.innerHTML = results[0];
						if (results[3]=="s") {
							document.getElementById("comment_detail_"+results[2]).style.display="block";
							document.getElementById("txtarea_"+results[2]).style.display="none";
						}
					}
				}
					if (typeof(results[4])=="undefined") results[4]="";
					document.getElementById("commentsNum"+results[2]).innerHTML=results[4];
					if(document.getElementById("TcommentsNum"+results[2])) document.getElementById("TcommentsNum"+results[2]).style.display="";
				}

				canAdd=true;
				var obj=document.getElementById("addComm_"+results[2]);
				if (obj) {
					if (obj.style.display=="none") obj.style.display="block";
				}
			} else {
				alert('There was a problem with the request.');
				document.write(http_request.status);
			}
		}
	}

	function __fncDelComAJAX(jId,commentId) {
		var hp = new HTTPPost();
		hp.postData('/deletecomment.php', 'cID='+commentId, ShowCommentDetails, true);
	}
	function __fncDeleteAll(jId) {
		var hp = new HTTPPost();
		hp.postData('/deleteallcomment.php', 'jID='+jId, ShowCommentDetails, true);
	}
	function __fncLoginMessage(){
		document.getElementById('notlogin').style.display='none';
		document.getElementById('loginmessage').style.display='inline';
	}
	function __fncshowmoreoptions(session){
			if(document.getElementById("mainsearchbox2test"))
				document.getElementById("mainsearchbox2test").id='mainsearchbox3test';
			else if(document.getElementById("mainsearchbox3test"))
				document.getElementById("mainsearchbox3test").id='mainsearchbox2test';
			else
				document.getElementById("mainsearchbox1test").id='mainsearchbox3test';
			if(session){
				if(document.getElementById("login").style.display=='none')
				document.getElementById("login").style.display='inline';
				else
				document.getElementById("login").style.display='none';
			}else{
				if(document.getElementById("not_login").style.display=='none')
				document.getElementById("not_login").style.display='inline';
				else
				document.getElementById("not_login").style.display='none';
				}		
		}
	function __show_result(){
		for(i=0;i < document.frmDisplayJ_sort.custom_type.length;i++){
			if(document.frmDisplayJ_sort.custom_type[i].checked)
				var found_val=document.frmDisplayJ_sort.custom_type[i].value;
		}			
		if(found_val==4){
			document.getElementById("other_custom_criteria").style.display='inline';
		}else{
			document.frmDisplayJ_sort.submit();	
		}	
	}	
	var newwindow;
	function openwindow(){
		newwindow = window.open('/articles/friends_definition.php','FRIENDS','width=490,height=300,menubar=yes,status=yes');
		var w=window.screen.width - 200;
		var h=window.screen.height - 100;
	}					
	function __fncSort(strColoumnName){
		document.frmDisplayJournallist.txtOrderCol.value = strColoumnName;
		document.frmDisplayJournallist.submit();
	}
//index.php specific
	function __fncPwdRecovery(){
		document.frmLogin.txtWhat2Do.value	=	'PWDRECOVERY';
		window.location='login.php?txtWhat2Do=PWD';
	}
	function __fncFind(){
		if(!__fncCheckEMail(document.frmFind.txtEmail.value, 'Please Enter Email ID in Correct Format')){
			document.frmFind.txtEmail.focus();
			return;
		}
		document.frmFind.txtWhat2Do.value	=	'FIND';
		document.frmFind.submit();
	}
	function __fncCheck(){
		if(document.frmLogin.txtUsername.value	==	''	||	document.frmLogin.txtUsername.value	==	null){
			alert("Please enter email id");
			return;
		}
		if(document.frmLogin.txtPwd.value	==	''	||	document.frmLogin.txtPwd.value	==	null){
			alert("Please enter password");
			return;
		}
		document.frmLogin.txtWhat2Do.value	=	'LOGIN';
		document.frmLogin.submit();
	}
	function __fncCheckEMail(email, strMessage){
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(email)){
			testres=true
			return(testres)
		}else{
			alert(strMessage);
			testres=false
			return(testres)
		}
	}
	function __fncDeleteComment(JournalId,CommentId){
		var result=confirm('Confirm deleting of comment(s)?');
		if(result){
			document.frmDeleteCommentlist.txtCommentId.value 	 = CommentId;
			document.frmDeleteCommentlist.txtJournalId.value 	 = JournalId;
			document.frmDeleteCommentlist.txtWhat2Do.value  	 = 'DELETECOMMENT';
			document.frmDeleteCommentlist.submit();
		}
	}
	function __fncDelCom(CommentId){
		var result=confirm('Confirm deleting of comment?');
		if(result){
			document.frmDeleteCommentlist.txtCommentId.value 	 = CommentId;
			document.frmDeleteCommentlist.txtWhat2Do.value  	 = 'DELCOM';
			document.frmDeleteCommentlist.submit();
		}
	}

