function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// custom
function switch_img(img_url,active) {
	if(!active) active = 0;

	if(img_url)	document.getElementById('c_img').src=img_url;

	for(i=0;i<=10;i++) {
			if(document.getElementById("zoom_box_"+i))  document.getElementById("zoom_box_"+i).style.borderColor = "#fff7d8";
	}
	if(document.getElementById("zoom_box_"+active)) document.getElementById("zoom_box_"+active).style.borderColor = "#DD3703";
}
//////////////////////////////////////////////////////////////////////////////////
/// INIT FLASH SCRIPT
	function init_flash(img_only) {
		active_pic_interval = new Array();
		active_pic = new Array();
		var x=1;
		while(document.getElementById('flash_'+x)) {
			if(document.getElementById('flash_'+x)) set_flash(x,img_only);
			x++;
		}
	}
	
	function set_flash(flash_id,img_only) {
		// INIT
		var flash_out;
		var pics="";
		var pic;
		active_pic[flash_id]=1;
				for(i=1;i<eval("pic_"+flash_id).length;i++) {
					pics+=eval("pic_"+flash_id)[i]+";";
				}	
				pic = "<img src=\""+eval("pic_"+flash_id)[1]+"\" border=\"0\" width=\""+flash_breite+"\" height=\""+flash_hoehe+"\" alt=\"\" id=\"pic_"+flash_id+"\"onLoad=\"change_flash_pic("+flash_id+")\">";
				flash_out ="<object  type=\"application/x-shockwave-flash\" data=\"img/flash/pic_switcher.swf?pix="+pics+"fade_speed=2&wait_msek=4000&wait_firstmsek=0\" width=\""+flash_breite+"\" height=\""+flash_hoehe+"\" ALIGN=\"\" /><param name=\"movie\" VALUE=\"img/flash/pic_switcher.swf?pix="+pics+"fade_speed=2&wait_msek=4000&wait_firstmsek=0\" /><param name=\"quality\" VALUE=\"high\" />"+pic+"</object>";
				//flash_out =pic;
				//alert('flash_'+flash_id+"\n\n"+flash_out);
				if(img_only) 	document.getElementById('flash_'+flash_id).innerHTML = pic;
				else 			document.getElementById('flash_'+flash_id).innerHTML = flash_out;
	}
			
	function change_flash_pic(flash_id) {
		active_pic[flash_id]+=1;
		if(active_pic[flash_id]>=eval("pic_"+flash_id).length) active_pic[flash_id]=1;
		active_pic_interval[flash_id] = window.setInterval("change_flash_pic_start("+flash_id+")",4000);
	}
	function change_flash_pic_start(flash_id) {
		window.clearInterval(active_pic_interval[flash_id]);
		//var test = eval("pic_"+active_pic[flash_id]);
		var test = eval("pic_"+flash_id)[eval(active_pic[flash_id])];
		//alert(flash_id+"\n"+eval(active_pic[flash_id])+"\n"+test+"\n\n"+active_pic);
		document.getElementById('pic_'+flash_id).src=test;
	}
	
