function koinor_gallery(el,pid,img) {			
	if (img!=1) {
		document.getElementById("koinor_picture1_"+el).src = document.getElementById("koinor_picture2_"+el).src;
		document.getElementById("koinor_picture1_"+el).alt = document.getElementById("koinor_picture2_"+el).alt;
		document.getElementById("koinor_picture1_"+el).title = document.getElementById("koinor_picture2_"+el).title;	
		fade_pics(1,10);
		window.clearTimeout(to1);
		window.clearTimeout(to2);	
	  var to1 = setTimeout("change_images('"+el+"','"+pid+"')",50);
		var to2 = setTimeout("fade_pics(0,2000)",250);		
	}
	hide_alltext();
	document.getElementById("producttext_"+pid).className = 'producttext';
	document.getElementById("gal_"+pid).className = 'gallink_act';
	return false;
}

function hide_alltext() {
	var allElems = document.getElementsByTagName('*');
	for (var i = 0; i < allElems.length; i++) {
		var thisElem = allElems[i];
		if (thisElem.className && thisElem.className == 'producttext') {
			thisElem.className = 'hidtext';
		}
		if (thisElem.className && thisElem.className == 'gallink_act') {
			thisElem.className = 'gallink';
		}
	}
}

function fade_pics(ord,del){
	if (ord==1) {
		tDiv = "picholder2";
		vDiv = "picholder1";
	} else {
		tDiv = "picholder1";
		vDiv = "picholder2";		
	}		
	if($(tDiv).fx){$(tDiv).fx.stop();}
	if($(vDiv).fx){$(vDiv).fx.stop();}		
	$(tDiv).fx = $(tDiv).effect('opacity', {duration: del}).start(0);
	$(vDiv).fx = $(vDiv).effect('opacity', {duration: del}).start(1);		
}

function change_images(el,pid) {
	//document.getElementById("picholder2").style.opacity = 0;	
	document.getElementById("koinor_picture2_"+el).src = imagesrc[el][pid];
	document.getElementById("koinor_picture2_"+el).alt = alt[el][pid];
	document.getElementById("koinor_picture2_"+el).title = title[el][pid];		
}
