/* PellePlus. V1.5 Av David Lidström <david.lidstrom@home.se> 2002-05-19 - Use freely, but this line may not be removed */

var __pplus__imgPPPlus = new Image(); 
var __pplus__imgPPMinus = new Image(); 


/* Sökvägarna till plus- och minusbilderna */
__pplus__imgPPPlus.src = "plus.gif";
__pplus__imgPPMinus.src = "minus.gif";


var __pplus__PPForceOpen = false;
var __pplus__PlusCount = new Number(1);
var __pplus__CSSPointer = new String("pointer");
var __pplus__BrowserVersion = navigator.appVersion.replace( /(^\d.\d)(.*)/, "$1" );
var __pplus__PPonCollapseEvents = new Array();
var __pplus__PPonExpandEvents = new Array();
var __pplus__groups = new Array();
__pplus_oldcaptionstyle = "PPlusHeader";
__pplus_captionstyle = "PPlusCaption";
__pplus_captionlinkstyle = "PPlusCaption";
__pplus_contentstyle = "PPlusContent";
__pplus__PPForceOpen = true; 
function _pplus_GetObjectEx(vDivID) {if( document.getElementById ) {return eval("document.getElementById('" + vDivID + "')");} else {if( navigator.appName == "Netscape") { return eval("document." + vDivID);} else { return eval("document.all." + vDivID);}}}
if(navigator.appName == "Microsoft Internet Explorer" && navigator.userAgent.indexOf("Opera")==-1  ) {
	if( parseFloat(__pplus__BrowserVersion)<6) {
		__pplus__CSSPointer = "hand";
	}; 
	__pplus__PPForceOpen = false;
}else if (
	 navigator.userAgent.indexOf("Gecko") !=-1){__pplus__PPForceOpen = false;
};
function PellePlus(tCaption, tText) {
	this.Ver = "1.5";
	this.LastUpdated = "2002-08-07"; 
	this.ShowImage = true;
	this.GetPlusStart = PellePlus_getplusstart;
	this.GetPlusEnd = PellePlus_getplusend;
	this.RemoveImage = PellePlus_removeimage;
	this.WritePlus = PellePlus_writeplus;
	this.OnExpand_AddEvent = PellePlus_expandaddevent;
	this.OnCollapse_AddEvent = PellePlus_collapseaddevent;
	this.Style_Caption = "";
	this.Style_CaptionLink = "";
	this.Style_Content = "";
	this.Style_OldHeader = "";
	this.Lock = PellePlus_lock;
	if( !tText ) {tText = "";}
	this.caption = tCaption;
	this.text = tText;
	this.GetPlus = PellePlus_getplus;
	this.AppendRow = PellePlus_appendrow;
	this.Unfold = PellePlus_unfold;
	this.ID = __pplus__PlusCount;
	this.Display = "none";
	this.EventID = this.ID-1;
	this.locked = false;
	this.groupName = "";
	this.SetGroup = PellePlus_setgroup;
	this.SetStyles = PellePlus_setstyles; __pplus__PPonCollapseEvents[this.EventID] = new Array();__pplus__PPonCollapseEvents[this.EventID][0] = "";__pplus__PPonExpandEvents[this.EventID] = new Array();__pplus__PPonExpandEvents[this.EventID][0] = "";
}

function PellePlus_expandaddevent(vNewEvent) {	
	__pplus__PPonExpandEvents[this.EventID][__pplus__PPonExpandEvents[this.EventID].length] = vNewEvent;
}
function PellePlus_collapseaddevent(vNewEvent) {
	__pplus__PPonCollapseEvents[this.EventID][__pplus__PPonCollapseEvents[this.EventID].length] = vNewEvent;
}
function PellePlus_setstyles( CaptionStyle, CaptionLinkStyle, ContentStyle, OldHeaderStyle ) {
	this.Style_Caption = CaptionStyle;
	this.Style_CaptionLink = CaptionLinkStyle;
	this.Style_Content = ContentStyle;
	this.Style_OldHeader = OldHeaderStyle;
}
function PellePlus_setgroup( vGroupName ) {this.groupName = vGroupName}
function PellePlus_lock() {this.locked = true;}
function PellePlus_appendrow(vNewText) {this.text+=vNewText + "<br>";}
function PellePlus_unfold() {this.Display = "block";}
function PP_SwitchOpen(vObjID, theImageToo, EventID, GroupName) {
	theImageToo = (theImageToo==1)?true:false;
	if( GroupName ) {
		if( __pplus__groups[GroupName] ) {
			var group_members = __pplus__groups[GroupName].split(",");
			for( var s=0; s<group_members.length; s++) {
				if( group_members[s] !=vObjID ) {	
					var Ob =_pplus_GetObjectEx("psp" + group_members[s]);if( Ob ) {Ob.style.display = "none";if( theImageToo ) {var ObImage =_pplus_GetObjectEx("pspimage" + group_members[s]); if(ObImage ) {ObImage.src = __pplus__imgPPPlus.src; }}}
				}
			}
		}
	}
	Object =_pplus_GetObjectEx("psp" + vObjID);
	if( theImageToo ) {ObjectImage =_pplus_GetObjectEx("pspimage" + vObjID);}
	stil = Object.style.display;
	if( stil=="" || stil=="block" ) {
		if( theImageToo ) {ObjectImage.src = __pplus__imgPPPlus.src;}
		Object.style.display = "none";
		for( var i=0; i<__pplus__PPonCollapseEvents[EventID].length; i++) {
			eval(__pplus__PPonCollapseEvents[EventID][i]);
		}
	} else {
		if( theImageToo == true) {	ObjectImage.src = __pplus__imgPPMinus.src;}
		Object.style.display = "block";
		for( var i=0; i<__pplus__PPonExpandEvents[EventID].length; i++) {
			eval( __pplus__PPonExpandEvents[EventID][i] )
		}
		
	}
}
function PPEvent_OnExpand(EventID) {
}
function PPEvent_OnCollapse(EventID) {
}
//__pplus__PPonCollapseEvents[this.EventID][0] = "";
//__pplus__PPonExpandEvents[this.EventID][0] = "";

function PellePlus_removeimage() {this.ShowImage = false;}
function PellePlus_writeplus() {   document.write(this.GetPlus());}

function PellePlus_getplus(varExtra) {
	var img;
	var displ;
	var tata = this.ShowImage?1:2;
	var style_caption
	var style_captionlink
	var style_content;
	var style_oldheader;
	
 	style_caption = (this.Style_Caption)?this.Style_Caption:__pplus_captionstyle;
	style_captionlink = (this.Style_CaptionLink)?this.Style_CaptionLink:__pplus_captionlinkstyle;
	style_content = (this.Style_Content)?this.Style_Content:__pplus_contentstyle;
	style_oldheader = (this.Style_OldHeader)?this.Style_OldHeader:__pplus_oldcaptionstyle;
	
	displ = 'display: ' + this.Display + ';';
	if( __pplus__PPForceOpen ) { 
		displ = ""; 
		this.Display = "block";
	}
	img = (this.Display != "block") ? __pplus__imgPPPlus.src:__pplus__imgPPMinus.src;__pplus__PlusCount++;
	this.ID = __pplus__PlusCount;
	if( this.groupName!="" ) {__pplus__groups[this.groupName] = ((__pplus__groups[this.groupName])?(__pplus__groups[this.groupName])+",":"") + this.ID;}
	var HTMLOutput;
	if( !varExtra ) {varExtra=-1;}
	HTMLOutput = "";
	if( !__pplus__PPForceOpen ) {	// If the browser supports the display-attribute of layers..
		
		var OPENCODE = new String();
		if( !this.locked ) {
			OPENCODE = ' onclick="PP_SwitchOpen('+ this.ID +', '+tata+', '+this.EventID+',\'' + this.groupName + '\');  return false"';
		}
		
		
		if( this.ShowImage ) {
			IMAGE_CODE = '<img border="0" src="' + img + '" width="9" height="9" id="pspimage'+this.ID+'" ' + OPENCODE + ' style="cursor:' + __pplus__CSSPointer + ';"> ';
		} else {
			IMAGE_CODE = '';
		}
		if( varExtra==-1 || varExtra==1) { 

			HTML_AStart = '<a href="JavaScript:void(0)" class="' + style_captionlink + '" style="cursor:' + __pplus__CSSPointer + ';" ' + OPENCODE + '>';
			HTML_AEnd = '</a>';
			HTML_FullCaption = this.caption;
			if( HTML_FullCaption.indexOf("<a>")==-1) {
				HTML_FullCaption = IMAGE_CODE + "<a>" + HTML_FullCaption + "</a>";
			} else {
				HTML_FullCaption = IMAGE_CODE + HTML_FullCaption
			}
			HTML_FullCaption = HTML_FullCaption.replace(/(.*)(<a>)(.*)(<\/a>)(.*)/gi, "<span class=\"" + style_caption + "\">$1</span>" + HTML_AStart + "$3" + HTML_AEnd + "<span class=\"" + style_caption + "\">$5</span>");
			HTMLOutput = '' + HTML_FullCaption + '<br>';
			HTMLOutput+= '<div id="psp' + this.ID + '" class="' + style_content + '" style="position:relative;left:9px;'+displ+'">'+this.text;
		}
		if( varExtra==-1 || varExtra==2) { 
			HTMLOutput+= '</div>\n\n'; 
		}
		return HTMLOutput;
	} else {
		HTMLOutput = "";
			HTML_FullCaption = this.caption;
			HTML_FullCaption = HTML_FullCaption.replace(/(<[^>]*>)/gi, "");
			if( varExtra==-1 || varExtra==1) { 
				HTMLOutput+= '<span class="' + style_oldheader + '" valign=absmiddle>' +  HTML_FullCaption + '</span>'; 
				HTMLOutput+= '<table border="0" cellspacing="0" cellpadding="0"><tr><td width="9"><font face="Verdana,Geneva,Sans-Serif" size="1">&nbsp;</font></td><td><div class="PPlusContent">'+ this.text;
			}

		if( varExtra==-1 || varExtra==2) { HTMLOutput+='</div></td></tr></table>';}
		return HTMLOutput;
	}
}

function PellePlus_getplusstart() {
	return this.GetPlus(1);
}
function PellePlus_getplusend() {
	return this.GetPlus(2);
}

//function_pplus_GetObjectEx(vDivID) {if( document.getElementById ) {return eval("document.getElementById('" + vDivID + "')");} else {if( navigator.appName == "Netscape") { return eval("document." + vDivID);} else { return eval("document.all." + vDivID);}}}
