﻿var CurrentSelectedMainThird=0;
var ObjTimerSM;
var PromoDataCount=0;
var TimerID = 0;
var TimerLeftServices;
var ChannelXml;
var oItemNodeList;
var TextDefine;
var SelectedItem;
var SelectedX, SelectedY;
var MouseX, MouseY;
var PublicCurrentMode;


/* Start */

var LastDiv =null;
var ColTimeOut =null;
var CloseSelf = null;
var CloseSame = null;
var OpenSame = null;
var OpenAnother = null;
var CloseAnother = null;
function getDisc(divID,divName){




	var divData = divName.split("#@#");
	var DivNum = Math.floor((divData[2]-1)/3);
	var DivPos = (DivNum+1)*3;
	var strSummary = divData[3];
	
	//begin added to remove the hide div 
	
		var  modId = "FromSiteNewsImgsDisc"+DivNum;
	if (document.getElementById("FromSiteNewsImgsDisc"+DivNum+""))	
	{	
CloseSame= setTimeout('document.getElementById("'+modId+'").style.display ="none"',200);
	}
	//End added to remove the hide div 
	
	if (ColTimeOut)
	{	
	if (objCheck[LastDiv.id]==1)
	clearTimeout(ColTimeOut);
	}
	
	if (divData[3].length >= 120)
	{
	divData[3] = divData[3].substr(0,120);
	var strLength = divData[3].lastIndexOf(" ");
	strSummary = divData[3].substr(0,strLength) + "...";
	}
	
	var GetNewsDiv = document.getElementById("FromSiteNewsImgsDisc"+DivPos+"");
	var contentInner = "<a href='"+divData[1]+"' class='SingleStringThemes'>"+divData[0]+"</a><br/><span class='SummaryTextContentBold'>"+strSummary+'</span>';
	GetNewsDiv.innerHTML = contentInner;

//setTimeout('document.getElementById("'+GetNewsDiv.id+'").innerHTML = "<a >hi</a>"',200);
	
	

	
	if (LastDiv)
	{
	if (LastDiv.id == GetNewsDiv.id)
		{
		
		if (objCheck[LastDiv.id]==0) // if cursor was on a picture on the same row
		{
		clearTimeout(CloseSame);
		clearTimeout(OpenAnother);
		document.getElementById(LastDiv.id).style.display ="none";
		
		OpenSame = setTimeout('slidedown("'+LastDiv.id+'")',200);
		}
		else //  if cursor was on the div
		{
		clearTimeout(CloseSelf);
		LastDiv.style.display ="block";
		
		}
		objCheck[LastDiv.id] = 0;

		}
		else // if cursor was on another row
		{
		clearTimeout(OpenSame);
		//CloseAnother = setTimeout('document.getElementById("'+LastDiv.id+'").style.display ="none"',300);
		document.getElementById(LastDiv.id).style.display ="none";		
		OpenAnother = 	setTimeout('slidedown("'+GetNewsDiv.id+'")',310);
		objCheck[GetNewsDiv.id]=0;
		
		}
	}
	else //if first time cursor
	{
	slidedown(GetNewsDiv.id);
	objCheck[GetNewsDiv.id]=0;
	}
	
	LastDiv = GetNewsDiv;

	addEventListenerSubStories( GetNewsDiv, "mouseover", listener1, false ); //add listener
	if(divData[2]%3==1)
	GetNewsDiv.style.backgroundPosition =  "-0px 0px";

	if(divData[2]%3==2)
	GetNewsDiv.style.backgroundPosition = "-102px 0px";

	if(divData[2]%3==0)
	GetNewsDiv.style.backgroundPosition ="-205px 0px";
}

function collapseDiv(divId)
{/*Commented to remove the hide div 

	var DivNum = Math.floor((divId-1)/3);
	DivNum = (DivNum+1)*3;
	var  modId = "FromSiteNewsImgsDisc"+DivNum;
	if (document.getElementById("FromSiteNewsImgsDisc"+DivNum+""))	
	{	
CloseSame= setTimeout('document.getElementById("'+modId+'").style.display ="none"',200);
	}*/
	

	
}
function collapseDivObj(divId) //onmouse out of div
{/*Commented to remove the hide div 

//var SummaryDivID=""
if (divId.id == LastDiv.id)
{
	CloseSelf = setTimeout('document.getElementById("'+divId.id+'").style.display="none"',300);
}
else
{
divId.style.display="none";

	for (i=3;i<10; i+=3)
	{
		 if(document.getElementById("FromSiteNewsImgsDisc"+i+""))
		  document.getElementById("FromSiteNewsImgsDisc"+i+"").style.display="none";

	}

}

*/


}
function addEventListenerSubStories( element, event_name, observer, capturing ) {
	if ( element.addEventListener ) // the DOM2, W3C way
		element.addEventListener( event_name, observer, capturing );
	else if ( element.attachEvent ) // the IE way
		element.attachEvent( "on" + event_name, observer );
}			
function listener1(evt) 
{
	clearTimeout(ColTimeOut);	
	clearTimeout(CloseAnother);
	clearTimeout(CloseSame);
	clearTimeout(CloseSelf);		
	//document.getElementById(LastDiv.id).style.display="block";
	for (i=3;i<10; i+=3)
	{
		 if(document.getElementById("FromSiteNewsImgsDisc"+i+""))
		 {
		 var descId = "FromSiteNewsImgsDisc"+i;
		 if (descId != LastDiv.id)
		  document.getElementById("FromSiteNewsImgsDisc"+i+"").style.display="none";
		  }

	}
	setTimeout('document.getElementById("'+LastDiv.id+'").style.display="block"',200);
	objCheck[LastDiv.id] = 1;
}


var timerlen = 5;
var slideAniLen = 250;

var timerIDs = new Array();
var startTime = new Array();
var objs = new Array();
var endHeight = new Array();
var moving = new Array();
var dir = new Array();
var objCheck = new Array();

function slidedown(objname){
        if(moving[objname])
                return;

        if(document.getElementById(objname).style.display != "none")
                return; // cannot slide down something that is already visible

        moving[objname] = true;
        dir[objname] = "down";
        startslide(objname);
}

function slideup(objname){
        if(moving[objname])
                return;

        if(document.getElementById(objname).style.display == "none")
                return; // cannot slide up something that is already hidden

        moving[objname] = true;
        dir[objname] = "up";
        startslide(objname);
}

function startslide(objname){
for (i=3;i<10; i+=3)
	{
		 if(document.getElementById("FromSiteNewsImgsDisc"+i+""))
		 {
		 var descId = "FromSiteNewsImgsDisc"+i;
		 if (descId != objname)
		  document.getElementById("FromSiteNewsImgsDisc"+i+"").style.display="none";
		  }

	}
        objs[objname] = document.getElementById(objname);

        endHeight[objname] = parseInt(objs[objname].style.height );
        startTime[objname] = (new Date()).getTime();

        if(dir[objname] == "down"){
                objs[objname].style.height = "1px";
        }

        objs[objname].style.display = "block";

        timerIDs[objname] = setInterval('slidetick(\'' + objname + '\');',timerlen);
}

function slidetick(objname){
        var elapsed = (new Date()).getTime() - startTime[objname];

        if (elapsed > slideAniLen)
                endSlide(objname);
        else {
                var d =Math.round(elapsed / slideAniLen * 83);
                if(dir[objname] == "up")
                        d = 83 - d;

                objs[objname].style.height = d + "px";
        }

        return;
}

function endSlide(objname){


        clearInterval(timerIDs[objname]);

        if(dir[objname] == "up")
                objs[objname].style.display = "none";

        objs[objname].style.height = 83 + "px";

        delete(moving[objname]);
        delete(timerIDs[objname ]);
        delete(startTime[objname]);
        delete(endHeight[objname]);
        delete(objs[objname]);
        delete(dir[objname]);

        return;
}






///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
// For Up Down Titels


function toTop(id){ 
document.getElementById(id).scrollTop=0 
} 

defaultStep=1
step=defaultStep 
function scrollDivDown(id,Obj,ObjS,SValue)
{ 
	document.getElementById(id).scrollTop+=step
	if (SValue!=null)
	{
		if (eval(SValue)==eval(document.getElementById(id).scrollTop))
		{
			clearTimeout(timerDown);
		}
		else
		{
			timerDown=setTimeout(function (){
				scrollDivDown(id,Obj,ObjS,document.getElementById(id).scrollTop)
			},10)
		}
	}
	else
	{
		timerDown=setTimeout(function (){
				scrollDivDown(id,Obj,ObjS,document.getElementById(id).scrollTop)
			},10)
	}
} 
function scrollDivLeft(id,Obj,ObjS,SValue)
{ 
	document.getElementById(id).scrollLeft+=step
	if (SValue!=null)
	{
		if (eval(SValue)==eval(document.getElementById(id).scrollLeft))
		{
			clearTimeout(timerDown);
		}
		else
		{
			timerDown=setTimeout(function (){
				scrollDivLeft(id,Obj,ObjS,document.getElementById(id).scrollLeft)
			},10)
		}
	}
	else
	{
		timerDown=setTimeout(function (){
				scrollDivLeft(id,Obj,ObjS,document.getElementById(id).scrollLeft)
			},10)
	}
} 
function scrollDivUp(id,Obj,ObjS,SValue)
{
	document.getElementById(id).scrollTop-=step
	if (SValue!=null)
	{
		if (eval(SValue)==eval(document.getElementById(id).scrollTop))
		{
			clearTimeout(timerUp);
		}
		else
		{
			timerUp=setTimeout(function (){
				scrollDivUp(id,Obj,ObjS,document.getElementById(id).scrollTop)
			},10)
		}
	}
	else
	{
		timerUp=setTimeout(function (){
				scrollDivUp(id,Obj,ObjS,document.getElementById(id).scrollTop)
			},10)	
	}
} 
function scrollDivRight(id,Obj,ObjS,SValue)
{
	document.getElementById(id).scrollLeft-=step
	if (SValue!=null)
	{
		if (eval(SValue)==eval(document.getElementById(id).scrollLeft))
		{
			clearTimeout(timerDown);
		}
		else
		{
			timerDown=setTimeout(function (){
				scrollDivRight(id,Obj,ObjS,document.getElementById(id).scrollLeft)
			},10)
		}
	}
	else
	{
		timerDown=setTimeout(function (){
				scrollDivRight(id,Obj,ObjS,document.getElementById(id).scrollLeft)
			},10)	
	}
} 
function toBottom(id){ 
document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight 
} 

function toPoint(id){ 
document.getElementById(id).scrollTop=100 
} 

var Spry;
if (!Spry) Spry = {};
if (!Spry.Widget) Spry.Widget = {};

Spry.Widget.CollapsiblePanel = function(element, opts)
{
	this.element = this.getElement(element);
	this.focusElement = null;
	this.hoverClass = "CollapsiblePanelTabHover";
	this.openClass = "CollapsiblePanelOpen";
	this.closedClass = "CollapsiblePanelClosed";
	this.focusedClass = "CollapsiblePanelFocused";
	this.enableAnimation = true;
	this.enableKeyboardNavigation = true;
	this.animator = null;
	this.hasFocus = false;
	this.contentIsOpen = true;

	this.openPanelKeyCode = Spry.Widget.CollapsiblePanel.KEY_DOWN;
	this.closePanelKeyCode = Spry.Widget.CollapsiblePanel.KEY_UP;

	Spry.Widget.CollapsiblePanel.setOptions(this, opts);

	this.attachBehaviors();
};

Spry.Widget.CollapsiblePanel.prototype.getElement = function(ele)
{
	if (ele && typeof ele == "string")
		return document.getElementById(ele);
	return ele;
};

Spry.Widget.CollapsiblePanel.prototype.addClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1))
		return;
	ele.className += (ele.className ? " " : "") + className;
};

Spry.Widget.CollapsiblePanel.prototype.removeClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1))
		return;
	ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};

Spry.Widget.CollapsiblePanel.prototype.hasClassName = function(ele, className)
{
	if (!ele || !className || !ele.className || ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)
		return false;
	return true;
};

Spry.Widget.CollapsiblePanel.prototype.setDisplay = function(ele, display)
{
	if( ele )
		ele.style.display = display;
};

Spry.Widget.CollapsiblePanel.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
{
	if (!optionsObj)
		return;
	for (var optionName in optionsObj)
	{
		if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
			continue;
		obj[optionName] = optionsObj[optionName];
	}
};

Spry.Widget.CollapsiblePanel.prototype.onTabMouseOver = function(e)
{
	this.addClassName(this.getTab(), this.hoverClass);
	return false;
};

Spry.Widget.CollapsiblePanel.prototype.onTabMouseOut = function(e)
{
	this.removeClassName(this.getTab(), this.hoverClass);
	return false;
};

Spry.Widget.CollapsiblePanel.prototype.open = function()
{
	this.contentIsOpen = true;
	if (this.enableAnimation)
	{
		if (this.animator)
			this.animator.stop();
		this.animator = new Spry.Widget.CollapsiblePanel.PanelAnimator(this, true, { duration: this.duration, fps: this.fps, transition: this.transition });
		this.animator.start();
	}
	else
		this.setDisplay(this.getContent(), "");

	this.removeClassName(this.element, this.closedClass);
	this.addClassName(this.element, this.openClass);
};

Spry.Widget.CollapsiblePanel.prototype.close = function()
{
	this.contentIsOpen = false;
	if (this.enableAnimation)
	{
		if (this.animator)
			this.animator.stop();
		this.animator = new Spry.Widget.CollapsiblePanel.PanelAnimator(this, false, { duration: this.duration, fps: this.fps, transition: this.transition });
		this.animator.start();
	}
	else
		this.setDisplay(this.getContent(), "none");

	this.removeClassName(this.element, this.openClass);
	this.addClassName(this.element, this.closedClass);
};

Spry.Widget.CollapsiblePanel.prototype.onTabClick = function(e)
{

	if (this.isOpen())
		this.close();
	else
		this.open();

	this.focus();

	return this.stopPropagation(e);
};

Spry.Widget.CollapsiblePanel.prototype.onFocus = function(e)
{
	this.hasFocus = true;
	this.addClassName(this.element, this.focusedClass);
	return false;
};

Spry.Widget.CollapsiblePanel.prototype.onBlur = function(e)
{
	this.hasFocus = false;
	this.removeClassName(this.element, this.focusedClass);
	return false;
};

Spry.Widget.CollapsiblePanel.KEY_UP = 38;
Spry.Widget.CollapsiblePanel.KEY_DOWN = 40;

Spry.Widget.CollapsiblePanel.prototype.onKeyDown = function(e)
{
	var key = e.keyCode;
	if (!this.hasFocus || (key != this.openPanelKeyCode && key != this.closePanelKeyCode))
		return true;

	if (this.isOpen() && key == this.closePanelKeyCode)
		this.close();
	else if ( key == this.openPanelKeyCode)
		this.open();
	
	return this.stopPropagation(e);
};

Spry.Widget.CollapsiblePanel.prototype.stopPropagation = function(e)
{
	if (e.preventDefault) e.preventDefault();
	else e.returnValue = false;
	if (e.stopPropagation) e.stopPropagation();
	else e.cancelBubble = true;
	return false;
};

Spry.Widget.CollapsiblePanel.prototype.attachPanelHandlers = function()
{
	var tab = this.getTab();
	if (!tab)
		return;

	var self = this;
	Spry.Widget.CollapsiblePanel.addEventListener(tab, "click", function(e) { return self.onTabClick(e); }, false);
	Spry.Widget.CollapsiblePanel.addEventListener(tab, "mouseover", function(e) { return self.onTabMouseOver(e); }, false);
	Spry.Widget.CollapsiblePanel.addEventListener(tab, "mouseout", function(e) { return self.onTabMouseOut(e); }, false);

	if (this.enableKeyboardNavigation)
	{
		// XXX: IE doesn't allow the setting of tabindex dynamically. This means we can't
		// rely on adding the tabindex attribute if it is missing to enable keyboard navigation
		// by default.

		// Find the first element within the tab container that has a tabindex or the first
		// anchor tag.
		
		var tabIndexEle = null;
		var tabAnchorEle = null;

		this.preorderTraversal(tab, function(node) {
			if (node.nodeType == 1 /* NODE.ELEMENT_NODE */)
			{
				var tabIndexAttr = tab.attributes.getNamedItem("tabindex");
				if (tabIndexAttr)
				{
					tabIndexEle = node;
					return true;
				}
				if (!tabAnchorEle && node.nodeName.toLowerCase() == "a")
					tabAnchorEle = node;
			}
			return false;
		});

		if (tabIndexEle)
			this.focusElement = tabIndexEle;
		else if (tabAnchorEle)
			this.focusElement = tabAnchorEle;

		if (this.focusElement)
		{
			Spry.Widget.CollapsiblePanel.addEventListener(this.focusElement, "focus", function(e) { return self.onFocus(e); }, false);
			Spry.Widget.CollapsiblePanel.addEventListener(this.focusElement, "blur", function(e) { return self.onBlur(e); }, false);
			Spry.Widget.CollapsiblePanel.addEventListener(this.focusElement, "keydown", function(e) { return self.onKeyDown(e); }, false);
		}
	}
};

Spry.Widget.CollapsiblePanel.addEventListener = function(element, eventType, handler, capture)
{
	try
	{
		if (element.addEventListener)
			element.addEventListener(eventType, handler, capture);
		else if (element.attachEvent)
			element.attachEvent("on" + eventType, handler);
	}
	catch (e) {}
};

Spry.Widget.CollapsiblePanel.prototype.preorderTraversal = function(root, func)
{
	var stopTraversal = false;
	if (root)
	{
		stopTraversal = func(root);
		if (root.hasChildNodes())
		{
			var child = root.firstChild;
			while (!stopTraversal && child)
			{
				stopTraversal = this.preorderTraversal(child, func);
				try { child = child.nextSibling; } catch (e) { child = null; }
			}
		}
	}
	return stopTraversal;
};

Spry.Widget.CollapsiblePanel.prototype.attachBehaviors = function()
{
	var panel = this.element;
	var tab = this.getTab();
	var content = this.getContent();

	if (this.contentIsOpen || this.hasClassName(panel, this.openClass))
	{
		this.addClassName(panel, this.openClass);
		this.removeClassName(panel, this.closedClass);
		this.setDisplay(content, "");
		this.contentIsOpen = true;
	}
	else
	{
		this.removeClassName(panel, this.openClass);
		this.addClassName(panel, this.closedClass);
		this.setDisplay(content, "none");
		this.contentIsOpen = false;
	}

	this.attachPanelHandlers();
};

Spry.Widget.CollapsiblePanel.prototype.getTab = function()
{
	//return this.getElementChildren(this.element)[0];
	//alert(this.getElementChildren(this.element)[0])
	
	return this.getElementChildren(this.element)[0].imgMaxMin;
};

Spry.Widget.CollapsiblePanel.prototype.getContent = function()
{
	return this.getElementChildren(this.element)[1];
};

Spry.Widget.CollapsiblePanel.prototype.isOpen = function()
{
	return this.contentIsOpen;
};

Spry.Widget.CollapsiblePanel.prototype.getElementChildren = function(element)
{
	var children = [];
	var child = element.firstChild;
	while (child)
	{
		if (child.nodeType == 1 /* Node.ELEMENT_NODE */)
			children.push(child);
		child = child.nextSibling;
	}
	return children;
};

Spry.Widget.CollapsiblePanel.prototype.focus = function()
{
	if (this.focusElement && this.focusElement.focus)
		this.focusElement.focus();
};

/////////////////////////////////////////////////////

Spry.Widget.CollapsiblePanel.PanelAnimator = function(panel, doOpen, opts)
{
	this.timer = null;
	this.interval = 0;

	this.fps = 60;
	this.duration = 500;
	this.startTime = 0;

	this.transition = Spry.Widget.CollapsiblePanel.PanelAnimator.defaultTransition;

	this.onComplete = null;

	this.panel = panel;
	this.content = panel.getContent();
	this.doOpen = doOpen;

	Spry.Widget.CollapsiblePanel.setOptions(this, opts, true);

	this.interval = Math.floor(1000 / this.fps);

	var c = this.content;

	var curHeight = c.offsetHeight ? c.offsetHeight : 0;
	this.fromHeight = (doOpen && c.style.display == "none") ? 0 : curHeight;

	if (!doOpen)
		this.toHeight = 0;
	else
	{
		if (c.style.display == "none")
		{
			// The content area is not displayed so in order to calculate the extent
			// of the content inside it, we have to set its display to block.

			c.style.visibility = "hidden";
			c.style.display = "";
		}

		// Clear the height property so we can calculate
		// the full height of the content we are going to show.

		c.style.height = "";
		this.toHeight = c.offsetHeight;
	}

	this.distance = this.toHeight - this.fromHeight;
	this.overflow = c.style.overflow;

	c.style.height = this.fromHeight + "px";
	c.style.visibility = "visible";
	c.style.overflow = "hidden";
	c.style.display = "";
};

Spry.Widget.CollapsiblePanel.PanelAnimator.defaultTransition = function(time, begin, finish, duration) { time /= duration; return begin + ((2 - time) * time * finish); };

Spry.Widget.CollapsiblePanel.PanelAnimator.prototype.start = function()
{
	var self = this;
	this.startTime = (new Date).getTime();
	this.timer = setTimeout(function() { self.stepAnimation(); }, this.interval);
};

Spry.Widget.CollapsiblePanel.PanelAnimator.prototype.stop = function()
{
	if (this.timer)
	{
		clearTimeout(this.timer);

		// If we're killing the timer, restore the overflow property.

		this.content.style.overflow = this.overflow;
	}

	this.timer = null;
};

Spry.Widget.CollapsiblePanel.PanelAnimator.prototype.stepAnimation = function()
{
	var curTime = (new Date).getTime();
	var elapsedTime = curTime - this.startTime;

	if (elapsedTime >= this.duration)
	{
		if (!this.doOpen)
			this.content.style.display = "none";
		this.content.style.overflow = this.overflow;
		this.content.style.height = "auto";
		if (this.onComplete)
			this.onComplete();
		return;
	}

	var ht = this.transition(elapsedTime, this.fromHeight, this.distance, this.duration);

	this.content.style.height = ((ht < 0) ? 0 : ht) + "px";

	var self = this;
	this.timer = setTimeout(function() { self.stepAnimation(); }, this.interval);
};

Spry.Widget.CollapsiblePanelGroup = function(element, opts)
{
	this.element = this.getElement(element);
	this.opts = opts;

	this.attachBehaviors();
};

Spry.Widget.CollapsiblePanelGroup.prototype.setOptions = Spry.Widget.CollapsiblePanel.prototype.setOptions;
Spry.Widget.CollapsiblePanelGroup.prototype.getElement = Spry.Widget.CollapsiblePanel.prototype.getElement;
Spry.Widget.CollapsiblePanelGroup.prototype.getElementChildren = Spry.Widget.CollapsiblePanel.prototype.getElementChildren;

Spry.Widget.CollapsiblePanelGroup.prototype.setElementWidget = function(element, widget)
{
	if (!element || !widget)
		return;
	if (!element.spry)
		element.spry = new Object;
	element.spry.collapsiblePanel = widget;
};

Spry.Widget.CollapsiblePanelGroup.prototype.getElementWidget = function(element)
{
	return (element && element.spry && element.spry.collapsiblePanel) ? element.spry.collapsiblePanel : null;
};

Spry.Widget.CollapsiblePanelGroup.prototype.getPanels = function()
{
	if (!this.element)
		return [];
	return this.getElementChildren(this.element);
};

Spry.Widget.CollapsiblePanelGroup.prototype.getPanel = function(panelIndex)
{
	return this.getPanels()[panelIndex];
};

Spry.Widget.CollapsiblePanelGroup.prototype.attachBehaviors = function()
{
	if (!this.element)
		return;

	var cpanels = this.getPanels();
	var numCPanels = cpanels.length;
	for (var i = 0; i < numCPanels; i++)
	{
		var cpanel = cpanels[i];
		this.setElementWidget(cpanel, new Spry.Widget.CollapsiblePanel(cpanel, this.opts));
	}
};

Spry.Widget.CollapsiblePanelGroup.prototype.openPanel = function(panelIndex)
{
	var w = this.getElementWidget(this.getPanel(panelIndex));
	if (w && !w.isOpen())
		w.open();
};

Spry.Widget.CollapsiblePanelGroup.prototype.closePanel = function(panelIndex)
{
	var w = this.getElementWidget(this.getPanel(panelIndex));
	if (w && w.isOpen())
		w.close();
};

Spry.Widget.CollapsiblePanelGroup.prototype.openAllPanels = function()
{
	var cpanels = this.getPanels();
	var numCPanels = cpanels.length;
	for (var i = 0; i < numCPanels; i++)
	{
		var w = this.getElementWidget(cpanels[i]);
		if (w && !w.isOpen())
			w.open();
	}
};

Spry.Widget.CollapsiblePanelGroup.prototype.closeAllPanels = function()
{
	var cpanels = this.getPanels();
	var numCPanels = cpanels.length;
	for (var i = 0; i < numCPanels; i++)
	{
		var w = this.getElementWidget(cpanels[i]);
		if (w && w.isOpen())
			w.close();
	}
};


