/* FAQ */
var AuktionFAQ = {

	prefixElement:   "closedId_",
	element:         null,

	toggle: function(id) {
		if(id) {
			var imgId = "faq:img" + id; 
			id = "faq:1st" + id;
		}
		else return;
		if (!document.getElementById(this.prefixElement + id)) {
			return;
		}
		this.element = document.getElementById(this.prefixElement + id);
		if (this.element.className.search(/closed/) != -1){
			this._replaceClass(this.element, "closed", "open");
			this._replaceClass(document.getElementById(id), "normal", "current");
			document.getElementById(imgId).src='/_common/img/but/faq_less.gif';	
		} else {
			this._replaceClass(this.element, "open", "closed");
			this._replaceClass(document.getElementById(id), "current", "normal");
			document.getElementById(imgId).src='/_common/img/but/faq_more.gif';
		} 
	},
	_replaceClass: function(obj, oldName, newName) {
		var classNames = obj.className.split(" ");
		for (var i=0; i < classNames.length; i++) {
			if (classNames[i] == oldName) {
				classNames[i] = newName;
			}
		}
		obj.className = classNames.join(" ");
	}
} 
var startIndex = 1;

function changeImage(direction) {
	if(direction == 1) {
		if(startIndex==countImage) startIndex = 1;
		else startIndex++;
	} else if(direction == 0) {
		// first call
    	document.getElementById('number_of_images').firstChild.nodeValue = countImage;
	} else if(direction == -1) {
		if(startIndex == 1) startIndex = countImage;
		else startIndex--;
	}
	document.getElementById('shown-image').innerHTML = document.getElementById('image'+startIndex).innerHTML;
	document.getElementById('currentImageN').firstChild.nodeValue = startIndex;
}
