var invals = new Array(); 

function buttonover(id) {
if (document.getElementById('bp'+id)) {
window.clearInterval(invals[id]);
invals[id] = window.setInterval("settransp('"+id+"',100)",40);
}
}

function buttonout(id) {
if (document.getElementById('bp'+id)) {
window.clearInterval(invals[id]);
invals[id] = window.setInterval("settransp('"+id+"',30)",20);
}
}

function settransp(id,target) {
var h = document.getElementById('bp'+id).style.opacity * 100;
if (!h) {
	h = document.getElementById('bp'+id).style.filter;
}
if (h == target) {
	window.clearInterval(invals[id]);
} else {
	if (h < target) {
		document.getElementById('bp'+id).style.opacity = (h+10)/100;
		document.getElementById('bp'+id).style.filter = 'alpha(opacity=' + (h+5) + ')';
	} else {
		document.getElementById('bp'+id).style.opacity = (h-10)/100;
		document.getElementById('bp'+id).style.filter = 'alpha(opacity=' + (h-5) + ')';
	}
}

}



function showpreview(textur,path,col,fam) {
if (document.getElementById('preview')) {
	if (fam == 1) {
		var so = new SWFObject("flash/vorschau.swf", "vorschauswf", "780", "310", "7", "#FFFFFF");
		so.addVariable("textur", textur);
		so.addVariable("path", path);
		so.addVariable("col", col);
		so.write("preview");
		document.getElementById('preview').style.textAlign = 'center';
	} else {		
		info = (textur.substr(0,textur.indexOf("."))).split("_");
		info[2] = (info[2] == 1) ? "-" : info[2];
		document.getElementById('preview').innerHTML = '<div class="kolprev"><div class="kolprevm" style="background-image:url('+path+'/muster/'+textur+')"><a href="javascript:musterpu('+"'"+path+"','"+textur+"','"+col+"'"+')" style="display: block; width: 100%; height: 100%"></a></div><div class="kolprevi"><table border="0" cellspacing="4" cellpadding="0"><tr><td colspan="2"><b>Stoffmuster Information:</b></td></tr><tr><td width="140">Kollektion:</td><td>'+col+'</td></tr><tr><td>Stoffartikelnummer:</td><td>'+info[1]+'</td></tr><tr><td>Rapport:</td><td>'+info[2]+'</td></tr><tr><td colspan="2">(Klicken Sie zur Vergr&ouml;sserung)</td></tr></table></div></div>';
		document.getElementById('preview').style.textAlign = 'center';
	}
}
}

function musterpu(path,muster,col) {
nw = window.open('musterpu.php?p='+path+'&m='+muster+'&c='+col, 'mwin', 'location=0,menubar=1,statusbar=0,toolbar=0,resizable=1,scrollbars=0,width=720,height=280,left=0,top=0');
}

function galpopup(path) {
nw = window.open(path, 'galwin', 'location=0,menubar=0,statusbar=0,toolbar=0,resizable=1,scrollbars=0,width=400,height=300,left=0,top=0');
}

function maxpopup() {
	var newwidth = screen.availWidth;
	var newheight = screen.availHeight;
	if (newheight > 0 && newwidth > 0) {
		resizeTo(newwidth,newheight);
	}
}
