﻿// JScript File

// #############################################################################
// function to toggle the collapse state of an object, and save to a cookie
function toggle_collapse(objid)
{
	obj =  document.getElementById("h_" + objid);	
	img =  document.getElementById("img_" + objid);
	
	if (!obj)
	{
		// nothing to collapse!
		if (img)
		{
			// hide the clicky image if there is one
			img.style.display = "none";
		}
		return false;
	}

	if (obj.style.display == "none")
	{
		obj.style.display = "";
		if (img)
		{
			img_re = new RegExp("_collapsed\\.gif$");
			img.src = img.src.replace(img_re, '.gif');
		}
		
	}
	else
	{
		obj.style.display = "none";
		if (img)
		{
			img.src = img.src.replace('aaa.gif', '_collapsed.gif');
		}
	}
}

function collapse(objid)
{
    //Panel1 id for bgimg
    //Panel1_Text this.id
    //Panel1_Panel body id
    var strmain=objid.substring(0,6);
    var head =  document.getElementById(strmain);
    var body =  document.getElementById(strmain+'_Panel');		
	if (body.style.display == "none")
	{
		body.style.display = "";
		head.className='panelbarHeaderExpand';
	}
	else
	{
		body.style.display = "none";
		head.className='panelbarHeaderCollapsed';
	}
}
function expand(ctrl,image)
{
    var control=document.getElementById('tr_'+ctrl);
    var image=document.getElementById(image);
    if(control.style.display=='none')
    {
        control.style.display='';
        image.src='../../app_themes/main/img/images/collapse.jpg';
    }
    else
    {
        control.style.display='none';
        image.src='../../app_themes/main/img/images/expand.jpg';
    }
}
function ExpandCollapse(ctrl,image)
{
    var control=document.getElementById('tr_'+ctrl);
    if(control.style.display=='none')
    {
        control.style.display='';
        if(image)
        {
            image.src.replace('expand.jpg', 'collapse.jpg');
            image.title='بسته';
        }
    }
    else
    {
        control.style.display='none';
        if(image)
        {
            image.src.replace('collapse.jpg', 'expand.jpg');
            image.title='باز';
        }
    }
}