function setElementOpacity(oElem, nOpacity)
{
	var p = getOpacityProperty();
	(setElementOpacity = p=="filter"?new Function('oElem', 'nOpacity', 'nOpacity *= 100;	var oAlpha = oElem.filters["DXImageTransform.Microsoft.alpha"] || oElem.filters.alpha;	if (oAlpha) oAlpha.opacity = nOpacity; else oElem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")";'):p?new Function('oElem', 'nOpacity', 'oElem.style.'+p+' = nOpacity;'):new Function)(oElem, nOpacity);
}

function getOpacityProperty()
{
	var p;
	if (typeof document.body.style.opacity == 'string') p = 'opacity';
	else if (typeof document.body.style.MozOpacity == 'string') p =  'MozOpacity';
	else if (typeof document.body.style.KhtmlOpacity == 'string') p =  'KhtmlOpacity';
	else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) p =  'filter';

	return (getOpacityProperty = new Function("return '"+p+"';"))();
}


function fadeOpacity(sElemId, sRuleName, bBackward)
{
	var elem = document.getElementById(sElemId);
	if (!elem || !getOpacityProperty() || !fadeOpacity.aRules[sRuleName]) return;

	var rule = fadeOpacity.aRules[sRuleName];
	var nOpacity = rule.nStartOpacity;

	if (fadeOpacity.aProc[sElemId]) {clearInterval(fadeOpacity.aProc[sElemId].tId); nOpacity = fadeOpacity.aProc[sElemId].nOpacity;}
	if ((nOpacity==rule.nStartOpacity && bBackward) || (nOpacity==rule.nFinishOpacity && !bBackward)) return;

	fadeOpacity.aProc[sElemId] = {'nOpacity':nOpacity, 'tId':setInterval('fadeOpacity.run("'+sElemId+'")', fadeOpacity.aRules[sRuleName].nDalay), 'sRuleName':sRuleName, 'bBackward':Boolean(bBackward)};
}

	fadeOpacity.addRule = function(sRuleName, nStartOpacity, nFinishOpacity, nDalay){fadeOpacity.aRules[sRuleName]={'nStartOpacity':nStartOpacity, 'nFinishOpacity':nFinishOpacity, 'nDalay':(nDalay || 30),'nDSign':(nFinishOpacity-nStartOpacity > 0?1:-1)};};

	fadeOpacity.back = function(sElemId){fadeOpacity(sElemId,fadeOpacity.aProc[sElemId].sRuleName,true);};

	fadeOpacity.run = function(sElemId)
{
	var proc = fadeOpacity.aProc[sElemId];
	var rule = fadeOpacity.aRules[proc.sRuleName];

	proc.nOpacity = Math.round(( proc.nOpacity + .1*rule.nDSign*(proc.bBackward?-1:1) )*10)/10;
	setElementOpacity(document.getElementById(sElemId), proc.nOpacity);

	if (proc.nOpacity==rule.nStartOpacity || proc.nOpacity==rule.nFinishOpacity) clearInterval(fadeOpacity.aProc[sElemId].tId);
}
	
fadeOpacity.aProc = {};
fadeOpacity.aRules = {};

fadeOpacity.addRule('oR1', 1, 0, 30);

//----------���
function getcommentform(commentid) {
	document.getElementById('commentform'+commentid).style.display='block';
var lastparent=document.getElementById('parent').value;
document.getElementById('text').innerHTML="";
if (lastparent!=commentid) {
	document.getElementById('commentform'+commentid).innerHTML=document.getElementById('commentform'+lastparent).innerHTML;
	document.getElementById('commentform'+lastparent).innerHTML=document.getElementById('lasttextcomment').value;
	document.getElementById('lasttextcomment').value="";
}
document.getElementById('parent').value=commentid;
return false;
}

function geteditform(commentid) {
var lastparent=document.getElementById('parent').value;
var textcomment=document.getElementById('commentform'+commentid).innerHTML;

document.getElementById('text').innerHTML="Loading...";
if (lastparent!=commentid) {


	document.getElementById('commentform'+commentid).innerHTML=document.getElementById('commentform'+lastparent).innerHTML;

document.getElementById('commentform'+lastparent).innerHTML=document.getElementById('lasttextcomment').value;

document.getElementById('lasttextcomment').value=textcomment;

document.getElementById('parent').value=commentid;
}

return false;
}


function sendcomment() 
{
	if (document.getElementById('itsusername').value=="") 
	{
		document.getElementById('itsusername').style.border="2px solid red";
		document.getElementById('itsusername').focus();
		return false;
	}
	if (document.getElementById('itsemail').value=="") 
	{
		document.getElementById('itsemail').style.border="2px solid red";
		document.getElementById('itsemail').focus();
		return false;
	}
	var username=document.getElementById('itsusername').value;
	var email=document.getElementById('itsemail').value;
	var keystring=document.getElementById('keystring').value;

	document.getElementById('thiscomment').value=document.getElementById('text').value;

	var lastparent=document.getElementById('parent').value;
	if (lastparent.indexOf("-")==-1) document.getElementById('answer'+lastparent).style.display='none';

	document.getElementById('commentform-1').innerHTML=document.getElementById('commentform'+lastparent).innerHTML;

	document.getElementById('commentform'+lastparent).innerHTML='';

	document.getElementById('parent').value=-1;

	if (lastparent.indexOf("-")==-1) document.getElementById('newcomment'+lastparent).innerHTML='<img src="/components/com_idoblog/assets/images/indicator.gif">';
	else
		document.getElementById('commentform'+lastparent).innerHTML='<img src="/components/com_idoblog/assets/images/indicator.gif">';

	xajax_addcomment(document.getElementById('thiscomment').value,document.getElementById('idarticle').value,lastparent,document.getElementById('created_by').value,document.getElementById('shabpath').value, username, email, keystring);
}


function smile(symbol)
{
	if (navigator.appName.indexOf("Microsoft")!=-1) 
	{
		//for ie
		obj_ta=document.getElementById('text');
		obj_ta.focus();
		var sel=document.selection;
		var rng=sel.createRange();
		rng.colapse;
		var podst=rng.text+symbol;
		rng.text=podst;
	}
	else 
	{
		//for mozilla and opera
		var es = document.getElementById('text').selectionEnd; //
		var txt1 = document.getElementById('text').value.substring(0,es); //  txt1
		var txt2 = document.getElementById('text').value.substring(es,document.getElementById('text').value.length); //  txt2 ,
		document.getElementById('text').value = txt1 + symbol + txt2;
	}

}

function bbcode(symbol)
  {
if (navigator.appName.indexOf("Microsoft")!=-1) {
//for ie
  obj_ta=document.getElementById('text');
  obj_ta.focus();
  var sel=document.selection;
  var rng=sel.createRange();
  rng.colapse;
   if (symbol=='URL')   var podst="["+symbol+"=http://]"+rng.text+"[/"+symbol+"]";
  else var podst="["+symbol+"]"+rng.text+"[/"+symbol+"]";
  rng.text=podst;
}
else {
//for mozilla and opera
var ee = document.getElementById('text').selectionEnd;
var es = document.getElementById('text').selectionStart;
   var txt1 = document.getElementById('text').value.substring(0,es); //  txt1
    var txt2 = document.getElementById('text').value.substring(es,ee); //  txt2 ,
   var txt3 = document.getElementById('text').value.substring(ee,document.getElementById('text').value.length); //  txt2 ,
   if (symbol=='URL') document.getElementById('text').value = txt1 + "["+symbol+"=http://]" + txt2 + "[/"+symbol+"]" + txt3;
   else document.getElementById('text').value = txt1 + "["+symbol+"]" + txt2 + "[/"+symbol+"]" + txt3;
}

  }


function mysel(id) {if (document.getElementById('user'+id).checked == true)
	{
	document.getElementById('user'+id).checked = false;
	document.getElementById('u'+id).style.background = "";
	}
	else
    {	document.getElementById('u'+id).style.background = "#CCC";
    document.getElementById('user'+id).checked = true;
    }
}


function showbookmarks(url, title) {
document.getElementById('tooltip').innerHTML='<img src="/components/com_idoblog/assets/images/indicator.gif">';
xajax_showbookmarks(url,title);
}