function MM_findObj(n, d) { //v3.0

var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;

}


function MM_showHideLayers() { //v3.0

var i,p,v,obj,args=MM_showHideLayers.arguments;

for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];

if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }

obj.visibility=v; }

}


dom = (document.getElementById)? true : false;

ie4 = (document.all && !dom)? true : false;

function menuClick(elemId) {

if (dom || ie4) {

var currElement = (dom)? document.getElementById(elemId) : document.all[elemId];

currElement.style.display = (currElement.style.display == 'none')? 'block' : 'none';

return false;

} else return true;

}


function showHide (elemId, act)
{
	if (dom || ie4) {
	var x = (dom)? document.getElementById(elemId) : document.all[elemId];
	
	if (act == 'del')
		x.innerHTML = '';
	else
		x.style.display = (act == 'show')? 'block' : 'none';
}
}


function sure (txt, f)
{
	if (confirm(txt))
		f.submit();
}

function selectAll (f)
{
	x = f.getElementsByTagName('input');
	for (i=0;i<f.elements.length;i++)
	{
		j = x[i].type;
		if (j == 'checkbox')
			x[i].checked = true;
	}
}

function deselectAll (f)
{
	x = f.getElementsByTagName('input');
	for (i=0;i<f.elements.length;i++)
	{
		j = x[i].type;
		if (j == 'checkbox')
			x[i].checked = false;
	}
}

function showResp (divId,info)
{
	document.getElementById(divId).innerHTML = info;
}


function getIdValue (elemId)
{
	var replace = new Array;
	replace[0] = ",";
	replace[1] = "\n";
	replace[2] = "%";
	
	var replaceTo = new Array;
	replaceTo[0] = ":comma:";
	replaceTo[1] = ":return:";
	replaceTo[2] = ":percent:";
	
	var strReplaceAll = document.getElementById(elemId).value;
	
	for (i=0;i<replace.length;i++)
	{
		var intIndexOfMatch = strReplaceAll.indexOf( replace[i] );
 
		while (intIndexOfMatch != -1){
			strReplaceAll = strReplaceAll.replace( replace[i], replaceTo[i] )
			intIndexOfMatch = strReplaceAll.indexOf( replace[i] );
		}
	}
	
	return strReplaceAll;
}


function saveEditor ()
{
	myNicEditor.nicInstances[0].saveContent();
	//myNicEditor.nicInstances[0].getContent();
}

function htmlEditor (name)
{
	area2 = new nicEditor({fullPanel : true , iconsPath : 'http://dl.qvi.az/js/nicEditorIcons.gif'}).panelInstance(name);
}

function txtEditor (name) {
	if (!area2)
		area2 = null;
	area2.removeInstance(name);
}

function hoverColor (f)
{
	f.style.backgroundColor='#E2F3DA';
}


function hoverUncolor (f)
{
	f.style.backgroundColor='white';
}

function hideMe (id)
{
	setTimeout("showHide('"+id+"', 'hide');", 3000);
}


var periodNames = new Array;	
periodNames['day'] = 1;
periodNames['week'] = 7;
periodNames['month'] = 30;
periodNames['year'] = 365;
periodNames[''] = '';

