function defaultset() {
	
	
	//Bilderzoom
	var allimg = (document.getElementById('col3').getElementsByTagName('img'));
	var imglength = allimg.length;
	for (i=0; i<imglength; i++) {
		allimg[i].setAttribute('onmouseover', 'findbigimg(this)');
	}
	

	
	
}
function findbigimg(bildobjekt) {
	var img = new Image();
	img.onload = function (evt){
		bildobjekt.className = 'zoomin';
		bildobjekt.setAttribute('onclick', 'showbigimg(this)');
	}
	img.src = bildobjekt.src.replace("img_kl", 'img_gr');
}

function showbigimg(bildobjekt) {
	var img = new Image();
	img.src = bildobjekt.src.replace("img_kl", 'img_gr');

	openpopup(img.height, img.width, true);
	document.getElementById('popupcontent').innerHTML = '<img id="popupimg" src="http://shop.biocontrol.ch/WebPortal/config/layout/page/default/js/thickbox/loadingAnimation.gif"></div>';
	document.getElementById('popupimg').src = img.src;	
		
}

function show_youtube(youtubelink) {
	var width = 800;
	var height = 625;
	
	//alert(width/-2);
	openpopup(height, width, false);
	

	document.getElementById('popupcontent').innerHTML = '<object width="'+width+'" height="'+height+'" style="z-index:10;"><param name="movie" value="http://www.youtube.com/v/'+youtubelink+'&hl=de_DE&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="opaque" /><embed src="http://www.youtube.com/v/'+youtubelink+'&hl=de_DE&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+width+'" height="'+height+'" wmode="opaque"></embed></object>';
}

function show_pdf(pdflink) {
	var width = 800;
	var height = 600;
	
	//alert(width/-2);
	openpopup(height, width, false);
	document.getElementById('popupcontent').innerHTML = '<iframe src="media/pdf/'+pdflink+'" width="'+width+'" height="'+height+'" frameborder="0" style="margin-top:11px;"></iframe>';
	
}

function hidepopup() {
	document.body.removeChild(document.getElementById('popup'));
	document.body.removeChild(document.getElementById('popupcloseimg'));
	document.body.style.overflow = "auto";
	//location.reload(true);
}

function openpopup (height, width, animation) {
	var closeimgsrc = 'layout/bt_close_popup.png';
	var closeimgwidth = 38;
	var closeimgheight = 38;
	
	
	var popupdiv = document.createElement('div');
	popupdiv.setAttribute('id', 'popup');
	document.body.appendChild(popupdiv);
	
	
	var subpopupdiv = document.createElement('div');
	subpopupdiv.setAttribute('id', 'popupcontent');
	subpopupdiv.style.marginTop = (height/-2)+'px';
	subpopupdiv.style.background = 'white';
	subpopupdiv.style.zIndex = 100;
	subpopupdiv.style.width = width+'px';
	subpopupdiv.style.height = height+'px';
	subpopupdiv.style.marginLeft = (width/-2)+'px';
	document.getElementById('popup').appendChild(subpopupdiv);
	
	
	var closeimg = document.createElement('img');
	closeimg.src = closeimgsrc;
	closeimg.setAttribute('onclick', "hidepopup(this)");
	closeimg.setAttribute('id', 'popupcloseimg');
	closeimg.style.cursor = 'pointer';
	closeimg.style.marginTop = ((height/-2)-(closeimgheight/2))+'px';
	closeimg.style.marginLeft = ((width/2)-(closeimgwidth/2))+'px';
	closeimg.style.zIndex = 1000;
	document.body.appendChild(closeimg);
	
	if(animation) {
		document.getElementById('popupcontent').style.opacity = 0;
		$("#popupcontent").fadeTo("slow", 1);
		$("#popupcloseimg").hide();
		
		$("#popupcloseimg").show('slow');
	}
	
}
function change_rg_adr() {
	if( document.getElementById('seprgadr').checked !== true) {
		$('#rechnung_adresse').fadeTo('slow', 1);
	}
	else {
		$('#rechnung_adresse').fadeOut('slow');
	}
}

