function ShowBoard(myObj){
	var BoardNumber = 1;
	var tmpObj;
	var myObjImage;
	while (myObj.tagName != 'TR') myObj = myObj.parentNode;
	myObjImage = myObj;
	while (myObjImage.firstChild.tagName != 'IMG') myObjImage = myObjImage.firstChild;		
	while (myObj.nextSibling.tagName != 'TR') myObj = myObj.nextSibling;
	var isSet = myObj.nextSibling.style.display;
	while (document.getElementById('Board'+BoardNumber)) {
		tmpObj = document.getElementById('Board'+BoardNumber);
		tmpObj.style.display = 'none';
		tmpObj = tmpObj.previousSibling;
		while(tmpObj.firstChild.tagName != 'IMG') tmpObj = tmpObj.firstChild;
		tmpObj.firstChild.src = '/images/board-arrow.gif';
		BoardNumber++;
	}
	if (isSet == 'none') {
		myObj.nextSibling.style.display = '';
		myObjImage.firstChild.src = '/images/board-arrow_down.gif';
	} else {
		myObj.nextSibling.style.display = 'none';
		myObjImage.firstChild.src = '/images/board-arrow.gif';
	}
}

function GsOpenPopup(Url, Height, Width, Name) {
	if (!Height) Height=480;
	if (!Width) Width=714;
	Width=605;

	if (Width>screen.availWidth) Width=screen.availWidth;

	var x = Math.round((screen.width-Width)/2);
	var y = Math.round((screen.height-Height)/2);

	popupWindow=window.open(Url, '_blank','scrollbars=yes,width='+Width+',height='+Height+',left='+x+',top='+y+',location=no,menubar=no,resizable=no,titlebar=no,status=no,directories=no');
	//if (typeof(popupWindow)!="undefined") return false;
	//else return true;
	return false;
} // GsOpenPopup


function SearchFocus(obj, StandardText) {
	if(obj.value==StandardText) obj.value='';
	obj.style.color="Black";
} // SearchEnabled
function SearchBlur(obj, StandardText) {
	if(obj.value=='') {
		obj.value=StandardText;
		obj.style.color="";
	}
} // SearchDisabled

function HandleWord(ObjectId) {
	var dimX, dimY, posX, posY;
	var varSettings;
	var TermsExplained;
	dimX = 480;
	dimY = 360;
	posX = (screen.availWidth - dimX);
	posY = 0;
	varSettings = 'toolbar=0,menubar=0,resizable=0,scrollbars=1,Width=' + dimX + ',Height=' + dimY + ',left=' + posX + ',top=' + posY;
	var wnd = window.open('/globalsite.aspx?ObjectId='+ObjectId,'NzGlossary',varSettings);
	wnd.focus();
} // HandleWord
var myElement;
function HandleWord2(ObjectId,ThisElement) {
	dwn.startDownload('/globalsite.aspx?ObjectId='+ObjectId,onDone);
	myElement=ThisElement;
} // HandleWord

function onDone(src){
	 var oPopup = window.createPopup();
	 oPopup.document.write(src); 
	 oPopup.show(0, 0, 500, 380,myElement);
}

function AddMyReport() {
	with ( document.forms['GsForm'] ) {
		MyReportAction.value="Add";
		submit();
	}
} // AddMyReport

function AddAllMyReport(ObjectId) {
	with ( document.forms['GsForm'] ) {
		MyReportAction.value="AddObjectAndDescendant";
		MyReportObjectId.value=ObjectId;
		submit();
	}
} // AddMyReport

function DeleteMyReport(ObjectId) {
	with ( document.forms['GsForm'] ) {
		MyReportAction.value="Delete";
		MyReportObjectId.value=ObjectId;
		submit();
	}
} // DeleteMyReport

function ResizeContentField(){
	if ( document.getElementById('ContentArea') ) {
		// Get the horisontal position of the content field. Used to detect if leftmenu is present.
		xPos=eval(document.getElementById('ContentArea')).offsetLeft;
		tempEl=eval(document.getElementById('ContentArea')).offsetParent;
		while(tempEl!=null){
			xPos+=tempEl.offsetLeft;
			tempEl=tempEl.offsetParent;
		}
		// Get the vertical position of the content field. 
		ContentyPos=eval(document.getElementById('ContentArea')).offsetTop;
		tempEl=eval(document.getElementById('ContentArea')).offsetParent;
		while(tempEl!=null){
			ContentyPos+=tempEl.offsetTop;
			tempEl=tempEl.offsetParent;
		}
		var myWidth = document.body.clientWidth-xPos-35;
		mySize = 860-xPos;
		if (myWidth<mySize) {
			document.getElementById('ContentArea').style.width = mySize+'px';
		} else {
			document.getElementById('ContentArea').style.width = myWidth+'px';
		}
		// Find the posistion of the bottommost gif
		yPos=eval(document.getElementById('bottomgif')).offsetTop;
		tempEl=eval(document.getElementById('bottomgif')).offsetParent;
		while(tempEl!=null){
			yPos+=tempEl.offsetTop;
			tempEl=tempEl.offsetParent;
		}
		
		var MatHeight;
		MatHeight=0;
		if (document.getElementById('MaterielTable')) MatHeight=document.getElementById('MaterielTable').offsetHeight;
		// If screen size is larger than bottom gif, set myheight to the different, else set it to 0
		if ( document.body.clientHeight>yPos+20 ) {
			//var myheight = document.body.clientHeight-yPos;
			//myheight = (document.getElementById('ContentArea').offsetHeight+myheight -20);
			//if (myheight>250) document.getElementById('ContentArea').style.height = myheight+'px';
			var myheight = document.body.clientHeight-ContentyPos-20-MatHeight;
			if (myheight>250) document.getElementById('ContentArea').style.height = myheight+'px';
		} else { // If screen size is smaller than bottom gif
			if ( document.body.clientHeight>595 ) { // If screen size is larger than 595
				//var myheight = yPos-document.body.clientHeight;
				//myheight = (document.getElementById('ContentArea').offsetHeight-myheight -20);
				//if (myheight>250) document.getElementById('ContentArea').style.height = myheight+'px';
				if (yPos>document.body.clientHeight) {
					var myheight = yPos-ContentyPos-60-MatHeight;
				} else {
					var myheight = document.body.clientHeight-ContentyPos-20-MatHeight;
				}
				if (myheight>250) document.getElementById('ContentArea').style.height = myheight+'px';
			}
		}
	}
}

function init(){
	if (document.getElementById) {
		if (document.getElementById('DropDownText')) {
			myHeight = document.getElementById('DropDownText').offsetHeight;
			if (myHeight<159) {
				document.getElementById('DropDownBackground').style.height = myHeight+20;
				document.getElementById('DropDownText').style.height = myHeight;
				document.getElementById('DropDownContainer').style.height = myHeight+20;
				document.getElementById('DropDownText2').style.top = myHeight;
			} else {
				document.getElementById('DropDownBackground').style.height = 179;
				document.getElementById('DropDownText').style.height = 159;
				document.getElementById('DropDownContainer').style.height = 179;
				document.getElementById('DropDownText2').style.top = 159;
			}
		}
		if (document.getElementById('AreaDDText')) {
			myHeight = document.getElementById('AreaDDText').offsetHeight;
			if (myHeight<159) {
				document.getElementById('AreaDDBackground').style.height = myHeight;
				document.getElementById('AreaDDText').style.height = myHeight;
				document.getElementById('AreaDDContainer').style.height = myHeight;
			} else {
				document.getElementById('AreaDDBackground').style.height = 159;
				document.getElementById('AreaDDText').style.height = 159;
				document.getElementById('AreaDDContainer').style.height = 159;
			}
		}
		myResize();
	}
}
function DDOver(myObj){
	myObj.style.backgroundColor = '#4E5349';
}
function DDOut(myObj){
	myObj.style.backgroundColor = 'transparent';
}
function DDhide(){
	document.getElementById('DropDownContainer').style.visibility = 'hidden';
	document.getElementById('DropDownCatchLayer').style.visibility = 'hidden';
	//document.getElementById('AreaDDContainer').style.visibility = 'hidden';
}
function DDclick(){
	if (document.getElementById('DropDownContainer').style.visibility == 'visible') {
		document.getElementById('DropDownContainer').style.visibility = 'hidden';
		document.getElementById('DropDownCatchLayer').style.visibility = 'hidden';
	} else {
		document.getElementById('DropDownContainer').style.visibility = 'visible';
		document.getElementById('DropDownCatchLayer').style.visibility = 'visible';
	}
}
function AreaDDclick(){
	if (document.getElementById('AreaDDContainer').style.visibility == 'visible') {
		document.getElementById('AreaDDContainer').style.visibility = 'hidden';
		document.getElementById('DropDownCatchLayer').style.visibility = 'hidden';
	} else {
		document.getElementById('AreaDDContainer').style.visibility = 'visible';
		document.getElementById('DropDownCatchLayer').style.visibility = 'visible';
	}
}
// Function myResize. Called onresize.
function myResize() {
	var yPos;
	var xPos;
	// Call function ResizeContentField()
	ResizeContentField();
	// Set position for the my report dropdown
	if (document.getElementById('dropdownimage')){
		xPos=eval(document.getElementById('dropdownimage')).offsetLeft;
		tempEl=eval(document.getElementById('dropdownimage')).offsetParent;
		while(tempEl!=null){
			xPos+=tempEl.offsetLeft;
			tempEl=tempEl.offsetParent;
		}
		yPos=eval(document.getElementById('dropdownimage')).offsetTop;
		tempEl=eval(document.getElementById('dropdownimage')).offsetParent;
		while(tempEl!=null){
			yPos+=tempEl.offsetTop;
			tempEl=tempEl.offsetParent;
		}
		document.getElementById('DropDownContainer').style.top = (yPos+20)+'px';
		
		document.getElementById('DropDownContainer').style.left = (xPos-199)+'px';
		document.getElementById('DropDownContainer').style.right = '';
	}
	// Set position for area dropdown
	if (document.getElementById('dropdownimage2')){
		xPos=eval(document.getElementById('dropdownimage2')).offsetLeft;
		tempEl=eval(document.getElementById('dropdownimage2')).offsetParent;
		while(tempEl!=null){
			xPos+=tempEl.offsetLeft;
			tempEl=tempEl.offsetParent;
		}
		yPos=eval(document.getElementById('dropdownimage2')).offsetTop;
		tempEl=eval(document.getElementById('dropdownimage2')).offsetParent;
		while(tempEl!=null){
			yPos+=tempEl.offsetTop;
			tempEl=tempEl.offsetParent;
		}
		
		document.getElementById('AreaDDContainer').style.top = (yPos+20)+'px';
		document.getElementById('AreaDDContainer').style.left = (xPos-192)+'px';
		document.getElementById('AreaDDContainer').style.right = '';
	}
	if (yPos) {
		if (document.getElementById('DropDownCatchLayer'))
			document.getElementById('DropDownCatchLayer').style.top = (yPos+20)+'px';
	}
	if (document.getElementById('ArticleImage')) {
		NumberOfColumns=2;
	}
	if (document.getElementById(LayerName) && document.getElementById('divSizer')) {
		// Get the content HTML the first time, ColomnText is a Global variable
		if (ColomnText=='') ColomnText = document.getElementById(LayerName).innerHTML;
		// Show the divsizer, so the script can size the html.
		document.getElementById('divSizer').style.display = "";
		// Clear the content HTML, make room for the columns
		document.getElementById(LayerName).innerHTML = "";
		document.getElementById(LayerName).style.overflow = 'hidden';
		document.getElementById(LayerName).style.padding = '0px';
		// Get the height of the content layer, withdraw 60 from that number for margins.
		myHeight = document.getElementById(LayerName).offsetHeight;
		myHeight = myHeight -myHeighDif;
		// Get the width of the content layer, withdraw 10 from each seperationline, 
		// and divide the number with the number of columns
		tmpWidth = document.getElementById(LayerName).offsetWidth;
		tmpWidth = tmpWidth-(10*(NumberOfColumns-1));
		myWidth = Math.floor((tmpWidth)/NumberOfColumns);
		// Split the HTML into an array
		document.getElementById("divSizer").innerHTML = ColomnText;
		SetWidthHeight(document.getElementById("divSizer").childNodes,myWidth,myHeight);
		ColomnText = document.getElementById("divSizer").innerHTML;
		document.getElementById("divSizer").innerHTML = "";
		
		document.getElementById('divSizer').style.paddingRight='10px';
		document.getElementById('divSizer').style.paddingTop='10px';
		document.getElementById('divSizer').style.paddingBottom='10px';
		myArray = Columns.splitText(ColomnText, myWidth, myHeight);
		// Clear and hide the sizer again
		document.getElementById('divSizer').innerHTML = ColomnText;
		document.getElementById(LayerName).className = "PrintOff";
		document.getElementById('divSizer').style.display = "none";
		// Call function DrawText() to make the columns.
		DrawText(0,myArray.length,NumberOfColumns);
		// Reset the page counter
		CurrentPage=0;
		// If more columns than showed, show the next and previous arrow. And give them colors.
		if (myArray.length > NumberOfColumns) {
			document.getElementById('NextArrow').style.color = "#5D6B77";
			document.getElementById('PreviousArrow').style.color = "#B8B9BA";
			document.getElementById('NextArrow').style.display = "";
			document.getElementById('PreviousArrow').style.display = "";
		} else {
			document.getElementById('NextArrow').style.display = "none";
			document.getElementById('PreviousArrow').style.display = "none";
		}
	}
}
// Function for the next column arrow.
function leftClick(){
	if ((CurrentPage+1)*NumberOfColumns < myArray.length) {
		CurrentPage += 1;
		document.getElementById(LayerName).innerHTML = "";
		DrawText((CurrentPage*NumberOfColumns),myArray.length,((CurrentPage+1)*NumberOfColumns));
		document.getElementById('PreviousArrow').style.color = "#5D6B77";
		if ((CurrentPage+1)*NumberOfColumns >= myArray.length) {
			document.getElementById('NextArrow').style.color = "#B8B9BA";
		}
	}
}
// Function for the previous column arrow.
function previousClick(){
	if (CurrentPage > 0) {
		CurrentPage -= 1;
		document.getElementById(LayerName).innerHTML = "";
		DrawText((CurrentPage*NumberOfColumns),myArray.length,((CurrentPage+1)*NumberOfColumns));
		document.getElementById('NextArrow').style.color = "#5D6B77";
		if (CurrentPage == 0) {
			document.getElementById('PreviousArrow').style.color = "#B8B9BA";
		}
	}
}
function DrawText(myStart,myEnd,myEnd2){
	for(i=myStart;i<myEnd && i!=myEnd2;i++) {
		if (myArray[i] != '') {
			if (myEnd2==(i+1)) {
				document.getElementById(LayerName).innerHTML += '<div style="height: '+myHeight+'px;width:'+myWidth+'px;float:left;"><div style="float:left;padding-left:0px;padding-right:10px;padding-top:10px;padding-bottom:10px;">'+myArray[i]+'</div></div>';
				//document.getElementById(LayerName).innerHTML += '<div style="text-align:right;float:left;height:15px;border-top:1px solid #D8DADC;width:'+(myWidth)+'px;">test</div>';
			} else {
				document.getElementById(LayerName).innerHTML += '<div style="height: '+myHeight+'px;width:'+myWidth+'px;float:left;"><div style="float:left;padding-left:0px;padding-right:10px;padding-top:10px;padding-bottom:10px;">'+myArray[i]+'</div></div>';
				document.getElementById(LayerName).innerHTML += '<div style="background-color:#D8DADC;height: '+(myHeight+myHeighDif)+'px;width:1px;float:left;margin-right:9px;"></div>';
			}
		}
	}
}
// Global variables
var myTimeOut;
var myArray;
var ColomnText = '';
var CurrentPage=0;
var LayerName = 'ContentArea';
var NumberOfColumns=3;
var myHeight;
var myWidth;
var myHeighDif = 15;

onresize=myResize;
onload=init;



/* Columns script: */

//=======================================================\\
//                    13thparallel.org                   \\
//                   Copyright (c) 2002                  \\ 
//   see (13thparallel.org/?title=about) for more info   \\
//=======================================================\\

// Columns object to split a load of innerHTML into columns.
// 08/04/02
var Columns = {
	singleTags : ["br", "img", "hr", "input", "!--","li"],
	pairTags : ["tr"],
	devmode : "off",		// "on" or "off", if set to "on" some info will be displayed in the statusbar.
	cols : new Array(),		// Stores the columns during calculations.
	onSplitStart : new Function(),
	onSplitEnd : new Function(),
	onSplit : new Function()
}


// The chop array holds strings that should be removed from the start of every column.
// Don't remove only one part of a tag pair, like </p>, always remove whole pairs, like <p></p>.

Columns.chop = [
'<SPAN class=colbreak></SPAN>',
'<span class="colbreak"></span>',
'<BR>',
'<br>',
'<br/>',
'<br />',
'<p></p>',
'<P></P>'
]


// Splits a load of text into fragments that will fit in the
// specified width and height and returns them in an array.
// It automatically closes unclosed tags and creates opening tags for the following columns.

Columns.splitText = function(text, width, height) {
	if (!document.getElementById 
	|| !document.getElementById("divSizer") 
	|| typeof document.getElementById("divSizer").innerHTML == "undefined") return;
	
	this.onSplitStart(text, width, height);

	this.cols = new Array();
	this.innerHTMLHits = 0;
	var startDate = new Date();
	var x = "";
	var LoopSaver=0;
	for (var i = 0; text != ""; i++) {
		LoopSaver++;
		if (LoopSaver==50) break;
		
		
		// put a fitting fragment in cols array and slice it from the text
		this.cols[i] = this.getFragment(text, width, height);
		text = text.slice(this.cols[i].length);
		
		// remove chop strings from the start of the text
		for (var j = 0; j < this.chop.length; j++) {
			if (text.charAt(0) == "\n") text = text.slice(1);
			x = this.chop[j];
			while (text.indexOf(x) == 0) text = text.slice(x.length);
		}
		
		// add tags from opentags array
		for (var k = this.openTags.length - 1; k >= 0; k--) {
			this.cols[i] += "</" + this.openTags[k].split(" ")[0] + ">";
			if (text != "") text = "<" + this.openTags[k] + ">" + text;
		}
		
		// remove chop strings from the start of the text again
		for (var m = 0; m < this.chop.length; m++) {
			if (text.charAt(0) == "\n") text = text.slice(1);
			x = this.chop[m];
			while (text.indexOf(x) == 0) text = text.slice(x.length);
		}
		
		// fire onSplit event
		this.onSplit(this.cols[i]);
	}
	
	if (this.devmode == "on") {
		var endDate = new Date();
		var message = "Time taken for splitting text = " + (endDate-startDate)/1000 + " seconds";
		message += " Number of unclosed tags found = " + this.openTags.length;
		message += " innerHTMLHits = " + this.innerHTMLHits;
		defaultStatus = message;
	}
	
	this.onSplitEnd(this.cols);
	return this.cols;
}


Columns.getFragment = function(text, width, height) {
	var objSizer = document.getElementById("divSizer");
	objSizer.style.width = width + "px";	
	
	var i = 0;
	var limit = 0;
	var add = 0;
	var doloop = false;
	var j;
	this.openTags = new Array();
	
	objSizer.innerHTML = text;
	if (objSizer.offsetHeight <= height) i = text.length;
	else {
		doloop = true;
		limit = text.length;
	}
	
	
	// This loop determines the raw piece of text that fits in the specified width and height.
	// It is the most powerhungry part of the script because of the repeated innerHTML manipulation.
	// It uses a binary search between 0 and text.length.
	while (doloop) {
		add = Math.round((limit - i) / 2);
		if (add <= 1) doloop = false;
		i += add;
		objSizer.innerHTML = text.substr(0, i);
		
		if (objSizer.offsetHeight > height){
			limit = i;
			i -= add;
		}
		this.innerHTMLHits ++;
	}
	/*
	if (i != text.length) {
		j=i;
		doloop = true;
		var countMe=0;
		var SmallSteps=1;
		var Change=5;
		var tmpHeight=objSizer.offsetHeight-height;
		if (tmpHeight<0) tmpHeight=0;
		while(doloop) {
			countMe++;
			j+=SmallSteps;
			objSizer.innerHTML = text.substr(0, j);
			if (((objSizer.offsetHeight-height)-tmpHeight) > Change) {
				doloop = false;
			}
			tmpHeight=objSizer.offsetHeight-height;
			if (tmpHeight<0) tmpHeight=0;
			if (countMe>100) break;
		}
		i=j-(SmallSteps*3);
	}
*/
	// Making sure there are no broken words or tags like "<img" at the end of this fragment.
	// This also ensures there will be no broken words or tags at the start of the next fragment.
	if (text.substr(0, i) != text) {
		var lastSpace = text.substr(0, i).lastIndexOf(" ");
		var lastNewline = text.substr(0, i).lastIndexOf("\n")
		var lastGreater = text.substr(0, i).lastIndexOf(">");
		var lastLess = text.substr(0, i).lastIndexOf("<");
		if (lastLess <= lastGreater && lastNewline == i - 1) i = i;
		else if (lastSpace != -1 && lastSpace > lastGreater && lastGreater > lastLess) i = lastSpace + 1;
		else if (lastLess > lastGreater) i = lastLess;
		else if (lastGreater != -1)  i = lastGreater + 1;
		
		for (var k=0; k<this.pairTags.length; k++) {
			lastGreater = text.substr(0, i).toLowerCase().lastIndexOf("/"+this.pairTags[k]+">");
			lastLess = text.substr(0, i).toLowerCase().lastIndexOf("<"+this.pairTags[k]);
			if (lastLess > lastGreater) i = lastLess;	
		}
	}
//	alert('i: '+i+' j:'+j+' P:'+lastPTag+"\n"+text.substr(0, j));

	// Doing the column breaks.
	text = text.substr(0, i).split('<SPAN class=colbreak></SPAN>')[0];
	text = text.substr(0, i).split('<span class="colbreak"></span>')[0];
	
	// Seeking unclosed tag pairs in this fragment and storing them in the openTags array.
	var doPush = true;
	var tags = text.split("<");
	tags.shift();
	
	for (var j=0; j<tags.length; j++) {
	 	// Splitting at ">" and taking the first item.
		// Now we have the whole tag with its attributes and without "<" and ">".
		tags[j] = tags[j].split(">")[0];
		
		// If it's a selfclosing xhtml or xml tag there's no need to do anything with it.
		if (tags[j].charAt(tags[j].length-1) == "/") continue;
		
		if (tags[j].charAt(0) != "/") {
			for (var k=0; k<this.singleTags.length; k++) {
				if (tags[j].split(" ")[0].toLowerCase() == this.singleTags[k]) doPush = false;
			}
			if (doPush) this.openTags.push(tags[j]);
			doPush = true;
		}
		else this.openTags.pop();
	}
	
	return text;
}



// Array and String prototypes.
// Internet Explorer 5 didn't have Push, Pop and Shift so here we create them.
// Split and Join are normally supported by every DHTML capable browser, 
// but they were broken in IE5/MacOSX, madness.

// push appends new elements to an array, and returns the new length
if (Array.prototype && !Array.prototype.push) {
	Array.prototype.push = function() {
		for (var i=0; i<arguments.length; i++) this[this.length] = arguments[i];
		return this.length;
	};
}

// pop removes the last element from an array and returns it
if (Array.prototype && !Array.prototype.pop) {
	Array.prototype.pop = function() {
		var lastitem = this.length > 0 ? this[this.length - 1] : undefined;
		if (this.length > 0) this.length--;
		return lastitem;
	};
}

// shift removes the first element from an array and returns it
if (Array.prototype && !Array.prototype.shift) {
	Array.prototype.shift = function() {
		var firstitem = this.length > 0 ? this[0] : undefined;
		for (var i=0; i<this.length-1; i++) this[i] = this[i + 1];
		if (this.length > 0) this.length--;
		return firstitem;
	};
}

// join returns a string value consisting of all the elements of an array 
// concatenated together and separated by the separator argument
if (Array.prototype && !Array.prototype.join) {
	Array.prototype.join = function(separator) {
		if (typeof separator != "string") separator = ",";
		var s = "";
		for (var i=0; i<this.length; i++) {
			if (this[i] != null && this[i] != undefined) s += this[i];
			if (i != this.length - 1) s += separator;
		}
		return s;
	};
}

// split returns the array that results when a string is separated into substrings
if (String.prototype && !String.prototype.split) {
	String.prototype.split = function(separator, limit) {
		var s = "" + this;
		var a = new Array();
		var sepIndex;
		
		if (typeof separator != "string") return new Array(s);
		if (separator == "") {
			while (s.length) {
				a[a.length] = s.substring(0, 1);
				s = s.substring(1);
				if (typeof limit == "number" && a.length >= limit) break;
			}
		}
		else {
			while (s.length) {
				sepIndex = s.indexOf(separator);
				a[a.length] = s.substring(0, sepIndex);
				s = s.substring(sepIndex+separator.length);
				if (typeof limit == "number" && a.length >= limit) break;
				if (s.length == 0) a[a.length] = s;
			}
		}
		return a;
	};
}
function SetWidthHeight(myChildren,width,height){
	var j;
	for (j=0;j<myChildren.length;j++) {
		if (myChildren.item(j).tagName == 'IMG') {
			if (myChildren.item(j).width>width) {
				var tmpWidth = myChildren.item(j).width/width;
				myChildren.item(j).width=width-20; 
				myChildren.item(j).height = Math.floor(myChildren.item(j).height/tmpWidth)-20;
			}
			if (myChildren.item(j).height>height) {
				var tmpheight = myChildren.item(j).height/height;
				myChildren.item(j).height=height-20;
				myChildren.item(j).width = Math.floor(myChildren.item(j).width/tmpheight)-20;
			}
		}
		if (myChildren.item(j).childNodes.length > 0) SetWidthHeight(myChildren.item(j).childNodes,width,height);
	}
}
// end

//CookieName is the name of the cookie, CookieValue is the Value and ExpireTime is the expiretime in minutes from now
function WriteCookie(CookieName,CookieValue,ExpireTime) {
	var ExpireDate = new Date();
  	ExpireDate.setTime(ExpireDate.getTime() + (ExpireTime*60*1000));
	document.cookie = CookieName + "=" + CookieValue + "; expires=" + ExpireDate.toGMTString();
}
