var ns = document.layers ? true : false;
var ie = document.all && !window.opera ? true : false;;    // IEs
var dom = document.getElementById && !ie ? true : false;  // DOM-Browser

var subheight=100;
var activeboxes;
function changeSize() {  
	if($('layout_footer') && $('layout_header')) subheight=26+$('layout_footer').getHeight()+$('layout_header').getHeight();
	else subheight+=0;
	if($('navigation_top')) subheight+=$('navigation_top').getHeight();
	
	
	//var finheight=document.viewport.getHeight()-subheight;
	
	if($('hauptinhalt')) var finheight=$('hauptinhalt').getHeight();
	//var finheight=0;
	var leftheight=0;
	var rightheight=0;
	
	if($('navigation_links')) leftheight+=$('navigation_links').getHeight();
	if($('navigation_block')) leftheight+=$('navigation_block').getHeight();
	if($('teaser_links')) leftheight+=$('teaser_links').getHeight();
	
	if($('rightheight')) rightheight+=$('rightheight').getHeight();
	if($('ekatalog_lnk')) rightheight+=310;
	if(finheight<rightheight){
		finheight=rightheight;
		$('mainBody').setStyle({overflow:'auto'});
	} else if($('mainBody')) $('mainBody').setStyle({overflow:'hidden'});
	if($('mainBody')) $('mainBody').setStyle({overflow:'auto'});
	if($('main_frame')) $('main_frame').setStyle({height: finheight +'px'});
	if($('content_left_table')) $('content_left_table').setStyle({height: finheight+'px'});
	if($('maincontent')) $('maincontent').setStyle({height: finheight+'px'});
	if(ie){
		finheight-=2;
		
	}
	if($('maincontent')) $('maincontent').setStyle({height: finheight+'px'});
	
	if($('content_left')) $('content_left').setStyle({height: finheight+'px'});
	if($('content_middle')) $('content_middle').setStyle({height: finheight+'px'});
	if($('content_right')) $('content_right').setStyle({height: finheight+'px'});
	
	if($('page_iframe')) {
		$('page_iframe').setStyle({height: finheight-40+'px'});
	}
	
	if($('scalebg')){
		$('scalebg').setStyle({'height':$('center_div').getHeight()+'px','width':$('center_div').getWidth()+'px'});	
	}
	//sizeToSession(document.viewport.getWidth(), document.viewport.getHeight());
	
	if(activeboxes > 0) {		
		if($('gb_'+activeid)) centerElementAndOverlay('gb_'+activeid);
	}
}

function onLoadFunctions() {
	changeSize();
}

function onResizeFunctions() {
	changeSize();
}

Event.observe(window, 'load', function() {
	onLoadFunctions();
});

Event.observe(window, 'resize', function() {
	onResizeFunctions();
});


var gbloading = "<img src='images/loading.gif' hspace='20' vspace='20' />";

function warenkorbPos() {
/*	$('warenkorb_overlay').clonePosition($('warenkorb_position'));
	posy = parseInt($('warenkorb_overlay').style.top.replace("px",""));
	posx = parseInt($('warenkorb_overlay').style.left.replace("px",""));
	posx+=84;
	posy+=111;
	$('warenkorb_overlay').style.top = posy+"px";
	$('warenkorb_overlay').style.left = posx+"px";
	$('warenkorb_overlay').show();
	*/
}

function changeFilter(eid,wert,pk){
	new Ajax.Request("ajax/changefilter.php?eid="+eid+"&wert="+escape(wert)+"&pk="+pk+"&search="+escape($('filter_search').value), {
		method: "get",
		onSuccess: function(t) {
			if($('hiddenDiv')) $('hiddenDiv').update(t.responseText);
		},
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
}

function openWK(step){
	window.location.href="?kat=14&step="+step;	
}

function loginPos() {
	var pos = $('image_right').positionedOffset();
	$('login_layer').style.top = pos[1]+84+"px";
	$('login_layer').style.left = pos[0]+100+"px";
}

function languagePos() {
	var pos = $('image_right').positionedOffset();
	var lnpos = $('language_td').positionedOffset();
	$('language_div').style.top = lnpos[1]+pos[1]+106+"px";
	$('language_div').style.left = lnpos[0]+pos[0]+100+"px";
	$('language_div').style.width = $('language_td').getWidth()+15+"px";
	
}

function tryLogin(e,msg){
	$("login_info").update(msg);
	new Ajax.Request("ajax/login.php", {
		method: "post",
		postBody: e.serialize(),
		onSuccess: function(t) {
			$("login_info").update(t.responseText);
		},
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}
	});
}
function tryLogout(msg){
	new Ajax.Request("ajax/login.php", {
		method: "post",
		postBody: "logout=1",
		onSuccess: function(t) {
			/* neulden */
			$("gb_container").update(t.responseText);
		},
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}
	});
}

function sucheNavi() {
	horpos = $('horbar').positionedOffset();
	$('suche_navi').style.top = horpos[1]+"px";
	$('suche_navi').style.left = horpos[0]+$('horbar').getWidth()+"px";
}

function callOnLoad() {
	callOnResize();
}

function to_session(k,v){
	request('get','ajax/to_session.php?'+k+'='+v,'hiddenDiv');
}

function switchFH(id){
	if($("fhhead"+id)){
		ns=($("fhhead"+id).className.indexOf('off')>0?"on":"off");
		$("fhhead"+id).className="fhclass_"+ns;
		// hier könnte man noch was mit slide-effekten machen...
		if(ns=="on") $("fhdiv"+id).show();
		else $("fhdiv"+id).hide();
		to_session("fh_classes_"+id,ns);
	}
}

function callOnResize() {
	$('suche_layer').clonePosition($('suche_link'), true, true, false, false);
	var or_pos=$('suche_layer').cumulativeOffset();
	$('suche_layer').style.top=(or_pos[1]-51)+"px";
	
	//$('suche_layer').hide();
	warenkorbPos();
	scrollContent();
	loginPos();
	languagePos();
	sucheNavi()
	if($('userdata')){
		var user_pos=$('user_pos').cumulativeOffset();
	//	alert(user_pos);
		$('userdata').style.left=Math.floor(user_pos[0]+586)+"px";
		$('userdata').style.top =Math.floor(user_pos[1]-10)+"px";
		//alert($('userdata').cumulativeOffset().join(","));
		//$('userdata').update(user_pos.join(",") + " offset: "+$('userdata').cumulativeOffset().join(","))
	}
}

function scrollContent(){
	if($('inhalt_scroll')){
	var pgSz=getPageSize();
	var inh_scr=$('inhalt').getHeight();
	if(inh_scr<400) inh_scr=400;
	var fspacer=258;
	if((pgSz[1]-fspacer) > inh_scr) pgs = inh_scr;
	else pgs = (pgSz[1]-fspacer);
	$('inhalt_scroll').style.height=pgs+"px";	
	}
}

function request(method,url,ziel,postform,loadingani,newserialize){
	if($(loadingani)) $(loadingani).show();
	if(method=='post' || method=='POST'){
		//alert(postform);
		if(newserialize) var pbody=$(postform).serialize(true);
		var pbody=$(postform).serialize();
	}else var pbody="";
	new Ajax.Request(url, {
		method: method,
		postBody: pbody,
		onSuccess: function(t) {
			$(ziel).update(t.responseText);
			if($(loadingani)) $(loadingani).hide();
		},
		onFailure: function(t) {
			$(ziel).update('Error ' + t.status + ' -- ' + t.statusText);
			if($(loadingani)) $(loadingani).hide();
		},
		evalScript: true,
		asynchronous: true
		}
	);
	window.setTimeout("callOnLoad();",500);
}

function doAjax(method,url,ziel,postform,loadingani,newserialize){
	

//alert("request('"+method+"','"+url+"','"+ziel+"','"+postform+"',"+newserialize+")");
	var ajaxString=escapeTxt("request('"+method+"','"+url+"','"+ziel+"','"+postform+"','"+loadingani+"',"+newserialize+")");
	if($('hiddenFrame')){
		$('hiddenFrame').src='history.php?request='+ajaxString;
		//alert("OK");
	}
/*
	if(method=='post' || method=='POST'){
		if(newserialize) var pbody=postform.serialize(true);
		var pbody=postform.serialize();
	}else var pbody="";
	new Ajax.Request(url, {
		method: method,
		postBody: pbody,
		onSuccess: function(t) {
			$(ziel).update(t.responseText);
		},
		onFailure: function(t) {
			$(ziel).update('Error ' + t.status + ' -- ' + t.statusText);
		},
		evalScript: true,
		asynchronous: true
		}
	);
	*/
}

function escapeTxt(os){
var ns='';
var t;
var chr='';
var cc='';
var tn='';
for(i=0;i<256;i++){
tn=i.toString(16);
if(tn.length<2)tn="0"+tn;
cc+=tn;
chr+=unescape('%'+tn);
}
cc=cc.toUpperCase();
os.replace(String.fromCharCode(13)+'',"%13");
for(q=0;q<os.length;q++){
t=os.substr(q,1);
for(i=0;i<chr.length;i++){
if(t==chr.substr(i,1)){
t=t.replace(chr.substr(i,1),"%"+cc.substr(i*2,2));
i=chr.length;
}}
ns+=t;
}
return ns;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight =  yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


function getArt(gid){
	if(gid>0){
		var pBody=$('eigform'+gid).serialize();
		if($('eig2form'+gid)) pBody=pBody+"&"+$('eig2form'+gid).serialize();
		if($('eig3form'+gid)) pBody=pBody+"&"+$('eig3form'+gid).serialize();
		pBody=pBody+"&gid="+gid;
	}
	else var pBody="";
	new Ajax.Request('../ajax/eigenschaften2art.php',
	{
		method: 'post',
		postBody: pBody,
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {
		  // $('loading'+gid).hide();	
		   $('ajaxlayer').update(t.responseText);
		  // alert(t.responseText);
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);	
}

function updateImage(targetImage,fileRequest,w,h){
	if(targetImage){
		//
		// loadingLayer > cloneposition von targetImage
		// laden anzeigen
		// wenn bild da ist, ersetzen und laden ausblenden
		// wenn nicht, fehler?
		if($('loadingLayer')){
			with($('loadingLayer')){
				clonePosition(targetImage);
				update("<img src='images/loading.gif'><img src='images/loading_font.gif'>");
				show();
			}
		}
		new Ajax.Request('../ajax/makeThumb.php?f='+fileRequest+'&w='+w+'&h='+h,
		{
			method: 'get',
			asynchronous: true,
			evalScript: true,
			onComplete: function(t) {
			  // $('loading'+gid).hide();	
			   targetImage.src=t.responseText;
			   $('loadingLayer').hide();
			  // alert(t.responseText);
			},
			// Handle other errors
			onFailure: function(t) {
				alert('Error ' + t.status + ' -- ' + t.statusText);
				$('loadingLayer').hide();
			}		
		}
		);	
	}
}
function add2wk(form){
	new Ajax.Request('ajax/warenkorb.php',
		{
			method: 'post',
			postBody: 'action=add&'+form.serialize(),
			asynchronous: true,
			evalScript: true,
			onComplete: function(t) {
			//alert(t.responseText);
			   userdata(t.responseText);
			   //alert(t.responseText);
			},
			// Handle other errors
			onFailure: function(t) {
				alert('Error ' + t.status + ' -- ' + t.statusText);
			}		
		}
	);
}
function number_format (zahl,decimal_num,dec_point,mill_sep) {
  var sign = '';
  if(zahl < 0) {sign = '-';}
  zahl = Math.abs(zahl);
  var divisor = 1;
  for(var i = 0; i < decimal_num; i++) {zahl *= 10; divisor *= 10;}
  zahl = Math.floor(zahl);
  var decimals= zahl % divisor;
  decimals = '' + decimals;
  for(var i = 0; i < decimal_num; i++) {zahl /= 10;}
  zahl = Math.floor(zahl);
  zahl = '' + zahl;
  zahl_grp = '';
  
  while(zahl.length > 3) {
    zahl_grp = mill_sep + zahl.substr(zahl.length-3,3) + zahl_grp;
    zahl = zahl.substr(0,zahl.length-3);
  }
  var str = zahl + zahl_grp;
  if(decimal_num > 0) {
    str = str + dec_point;
	//alert(decimals.length + " - " + decimal_num);
    //while(decimals.length != decimal_num) {decimals= decimals+ '0';}
	while(decimals.length < decimal_num) {decimals+='0';}
    str = str + decimals
  }
  return sign + str;
}
function openLogin() {
	showGrayBox();
	$('gray_box_content').update(gbloading);
	new Ajax.Request('ajax/login.php',
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {	
		   $('gray_box_content').update(t.responseText);
		   center('gray_box_content');
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
}

function myaccount() {
	showGrayBox();
	$('gray_box_content').update(gbloading);
	new Ajax.Request('modules_gb/myaccount.php',
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {	
		   $('gray_box_content').update(t.responseText);
		   center('gray_box');
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
}


function logout(){
	userdata("&logout=true");	
}

function userdata(){
	var typus = "";
	if($('userdata')){
		if(userdata.arguments.length>0){
			var pBody="&message="+userdata.arguments[0];
		}
		else if($('loginform')){
			var pBody=$('loginform').serialize();
			typus = "login";
		}	else if(userdata.arguments[0]) {
			var pBody="highlight="+userdata.arguments[0];
		}
		
		else var pBody="";
		new Ajax.Request('ajax/userdata.php',
		{
			method: 'post',
			postBody: pBody,
			asynchronous: true,
			evalScript: true,
			onComplete: function(t) {
				if(typus == "login") $('login_result').update(t.responseText);
				else $('userdata').update(t.responseText);
			},
			onFailure: function(t) {
				$('userdata').update('Error '+t.status+' -- '+t.statusText);
			}
		}
		);	
	}
}
var udatatimeout;
function userdata_message(msg){
	//alert(msg);
	if(udatatimeout) window.clearTimeout(udatatimeout);
	var ud_pos=$('userdata').cumulativeOffset();
	//alert(ud_pos);
	$('userdata_message').style.top=Math.floor(ud_pos[1]+37)+"px";
	$('userdata_message').style.left=ud_pos[0]+"px";
	var oldBorder=$('userdata').style.borderBottom;
	//alert(oldBorder);
	$('userdata').style.borderBottomStyle='none';
	//$('userdata_message').style.width=$('userdata').getWidth()+"px";o
	//$('userdata_message').clonePosition($('userdata'), true, true, false, 21);
	//alert($('userdata_message').cumulativeOffset());
	
	//$('userdata_message').show();
	//var or_pos=$('wkimg'+art).cumulativeOffset();
	//$('wkbox'+art).style.left=(or_pos[0]-158)+"px";
	
	//
	// effect slide funzt nicht...position TOP ok...
	//
	
	//$('userdata_message').show();
	//alert($('userdata_message') + '\n' + $('userdata_message').style.display)
	$('userdata_message').update("<table border='0' cellspacing='0' cellpadding='0' width='100%'><tr><td align='left'><div>"+Base64.decode(msg)+"</div></td></tr></table>");
	//Effect.toggle('userdata_message');
	Effect.SlideDown('userdata_message',{
	 duration:1,
	 afterFinish: function(){ 
	 udatatimeout=window.setTimeout("userdata_messageUP();",5000);
	 udataborder=window.setTimeout("$('userdata').style.borderBottom='"+oldBorder+"';",6000);
	 
	 }
	 }
	 );
}
function userdata_messageUP(){
	//Effect.toggle('userdata_message');
	Effect.SlideUp('userdata_message');
}

function openLanguageLayer() {
	showLanguage();
}

var languageAktiv = false;
var languageTimeout;

function showLanguage() {	
	if(languageAktiv == false) {
		window.clearTimeout(languageTimeout);
		$('language_div').show();
		Effect.toggle('language_inner','slide', {duration: 0.5});
		languageTimeout=window.setTimeout("language_inner = true;",500);
	} else {
		window.clearTimeout(languageTimeout);
		Effect.toggle('language_inner','slide', {duration: 0.5, afterFinish: language_inner});
		languageTimeout=window.setTimeout("language_inner = false;",500);
	}
}

function hideLanguage() {
	$('language_div').hide();
}

function openSucheLayer() {
	showSuche();
}

function searchSite(offset) {
	new Ajax.Request('ajax/searchToSession.php?search='+Base64.encode($('search').value),
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {	
		   //loadModule(10, '&offset='+offset);
			if(offset == -1) {
				Effect.toggle('suche_inner','slide', {duration: 0.5, afterFinish: hideSuche});
				sucheAktiv = false;
			}
			location.href = "?kat=15&offset="+offset;
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);	
	
}

var sucheAktiv = false;
var sucheTimeout;

function showSuche() {	
	if(sucheAktiv == false) {
		window.clearTimeout(sucheTimeout);
		$('suche_layer').show();
		Effect.toggle('suche_inner','slide', {duration: 0.5});
		sucheTimeout=window.setTimeout("sucheAktiv = true;",500);
	} else {
		window.clearTimeout(sucheTimeout);
		Effect.toggle('suche_inner','slide', {duration: 0.5, afterFinish: hideSuche});
		sucheTimeout=window.setTimeout("sucheAktiv = false;",500);
	}
}

function hideSuche() {
	$('suche_layer').hide();
}

function pwVergessen() {
	$('gray_box_content').innerHTML = gbloading;
	new Ajax.Request('modules_gb/lostpw.php',
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {	
		   $('gray_box_content').update(t.responseText);
		   center('gray_box');
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
}

function changepw() {
	$('gray_box_content').innerHTML = gbloading;
	new Ajax.Request('modules_gb/changepw.php',
	{
		method: 'get',
		asynchronous: true,
		evalScript: true,
		onComplete: function(t) {	
		   $('gray_box_content').update(t.responseText);
		   window.setTimeout("center('gray_box');", 100);
		},
		// Handle other errors
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		}		
	}
	);
}

function showLegend(p){
	if(!$('gray_box').visible()) showGrayBox();
	if(showLegend.arguments.length>0){
		new Ajax.Request('ajax/legend.php?seite='+p,
			 {
				 method:'GET',
				 asynchronous:true,
				 evalScript:true,
				 onComplete: function(t){
					 $('gray_box_content').update(t.responseText);
					 center('gray_box');
				 },
				 onFailure: function(t){
					alert('Error ' + t.status + ' -- ' + t.statusText); 
				 }
			 }
			 );
	}else{
		new Ajax.Request('ajax/legend.php',
			 {
				 method:'GET',
				 asynchronous:true,
				 evalScript:true,
				 onComplete: function(t){
					 $('gray_box_content').update(t.responseText);
					 center('gray_box');
				 },
				 onFailure: function(t){
					alert('Error ' + t.status + ' -- ' + t.statusText); 
				 }
			 }
			 );
	}
}

function empfehlen(pdf,ext,send){
	///alert(pdf);
	showGrayBox();
	if(empfehlen.arguments.length>2) {
		new Ajax.Request('ajax/empfehlen.php?pdf='+pdf+'&ext='+escape(unescape(ext)),
		{
			method:'post',
			postBody: $('form_mailPage').serialize(),
			asynchronous: true,
			evalScript: true,
			onComplete: function(t) {
			   $('gray_box_content').update(t.responseText);
			   center('gray_box');
			},
			// Handle other errors
			onFailure: function(t) {
				alert('Error ' + t.status + ' -- ' + t.statusText);
			}		
		}
		);			
	}else{
		new Ajax.Request('ajax/empfehlen.php?pdf='+pdf+'&ext='+escape(unescape(ext)),
		{
			method: 'get',
			asynchronous: true,
			evalScript: true,
			onComplete: function(t) {	
			   $('gray_box_content').update(t.responseText);
			   center('gray_box');
			},
			// Handle other errors
			onFailure: function(t) {
				alert('Error ' + t.status + ' -- ' + t.statusText);
			}		
		}
		); 
	}
}
function mailPage(pdf){
	empfehlen(pdf);
}

function openEbook(){
	window.open('ekatalog.php?l=d','','width=1000,height=750');
}

function getContent(url) {
	$('loadinglayer').clonePosition('maintd');
	$('loadinglayer').show();
	
	new Ajax.Request(url, {
		method: "get",
		onSuccess: function(t) {
			if($('maincontent')) $('maincontent').update(t.responseText);
			$('loadinglayer').hide();
		},
		onFailure: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
			$('loadinglayer').hide();
		},
		evalScript: true,
		asynchronous: true
		}
	);
}

function changePage(module,spalte,richtung,offset) {
	getContent(module+'&offset='+offset);
}

function changeProduktBild(img) {
	$('gruppenbild').src = img;							 
}

function pos(e){
	if(!e) e = window.event;
	x = e.clientX+document.documentElement.scrollLeft;
    y = e.clientY+document.documentElement.scrollTop;
	
	if($('hover')) {
		$('hover').style.left=(x+10)+'px';
		$('hover').style.top=(y+10)+'px';
	}
}

document.onmousemove=pos;

function popup(hovertxt) {
		
	if(hovertxt != '') {
		var content="<table border='0' cellspacing='0' cellpadding='0' class='popup'>"+
		"<tr><td align=left class='popup'>" + hovertxt + "</td></tr>"+
		"</table>";
		$("hover").innerHTML=content;
		$('hover').show();
	}
}

function kill(){
	$('hover').hide();			
}

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];}
}