
// OVERLAY-SACHEN
function bs_screenshot(bs_id, bs_nr, bs_left, bs_top, bs_w, bs_h, overlay, box_border, box_padding, bs_link, fade_left, fade_top){	
	this.nr = bs_nr;
	this.owner_select = '#'+bs_id;
	this.make_overlay = overlay || true;
	this.ownerdiv = document.getElementById(bs_id);
	this.bsleft = bs_left;
	this.bstop = bs_top;		
	this.bsheight = bs_h;
	this.bswidth = bs_w;
	this.bsborder = box_border || 0;
	this.sb_overlay = document.createElement('DIV');
	this.sb_swf_div = document.createElement('DIV');
	this.sb_swf_div2 = document.createElement('DIV');	
	this.bs_id = bs_id;
	this.bs_link = bs_link;
	this.fade_left = fade_left;
	this.fade_top = fade_top;
}

bs_screenshot.prototype.init_stuff = function() {
	var browserName = navigator.appName;
	if (browserName == "Microsoft Internet Explorer") {
		//alert('IE... dislike');	
	}

	this.sb_overlay.id = 'overlay_div_'+this.nr;
	this.sb_overlay.style.visibility = 'hidden';
	this.sb_overlay.style.left = '0px';		
	this.sb_overlay.style.top = '0px';		
	this.sb_overlay.style.width = '100%';		
	this.sb_overlay.style.height = '100%';
	this.sb_overlay.style.backgroundColor = 'black'
	this.sb_overlay.style.position = 'fixed';
	this.sb_overlay.style.zIndex = 100; 
	this.sb_overlay.style.opacity = "0.5";
	this.sb_overlay.style.MozOpacity = "0.5";
	this.sb_overlay.style.filter = "Alpha(opacity=50)";
	
	//x = document.body;
	x = document.getElementById('main');
	x.appendChild(this.sb_overlay);
	x.appendChild(this.sb_swf_div); 
		
	this.sb_swf_div.id = 'swf_div_'+this.nr;
	this.sb_swf_div.style.visibility = 'hidden';	
	this.sb_swf_div.style.position = 'absolute';	
	this.sb_swf_div.style.left = '0px';//this.bsleft+'px';
	this.sb_swf_div.style.top = '0px';//this.bstop+'px';
	this.sb_swf_div.style.width = '0px';//this.bswidth+'px';	
	this.sb_swf_div.style.height = '0px';//this.bsheight+'px';			
	this.sb_swf_div.style.backgroundColor = '#666666';	
	this.sb_swf_div.style.color = '#666666';	
	this.sb_swf_div.style.zIndex = 101; 		
	this.sb_swf_div.style.border = this.bsborder+'px solid #666666';	  
  
	this.sb_swf_div2.id = 'swf_div2_'+this.nr;
	this.sb_swf_div2.style.visibility = 'hidden';	
	this.sb_swf_div2.style.position = 'absolute';			
	this.sb_swf_div2.style.backgroundColor = '#666666';		
	this.sb_swf_div2.style.left = '0px';
	this.sb_swf_div2.style.top = '0px';		
	this.sb_swf_div2.style.width = '100%';	
	this.sb_swf_div2.style.height = '360';	
	this.sb_swf_div2.style.zIndex = 102; 			

	//alert('fade_t: '+this.fade_top+' fade_l: '+this.fade_left);
	
	this.sb_swf_div.appendChild(this.sb_swf_div2);	
	mein_inhalt = "<img src='"+this.bs_link+"' alt='' style='position:relative; height:560px; width:780px'/>";
	$('#swf_div2_'+this.nr).html(mein_inhalt);	
  	$('#swf_div_'+this.nr).prepend("<p id='close_overlay' style='position:absolute; font:bold 12px Arial; right:5px; top:-10px; z-index:5; cursor:pointer'>close</p>");	
	$('#close_overlay').css("color","#666666");				
	$('#close_overlay').html('');	
	
	$('#close_overlay').bind('click',{overlay_id:this.sb_overlay.id, swf_id:this.sb_swf_div.id, swf2_id:this.sb_swf_div2.id,f_top:this.fade_top, f_left:this.fade_left},function(e){			
		var mein_div2 = document.getElementById(e.data.swf2_id);
		mein_div2.style.visibility = 'hidden';	
		$('#close_overlay').html('');			
		$('#close_overlay').css("color","#666666");			
		$('#'+e.data.overlay_id).fadeOut(400);	
		if (!(e.data.f_top != 0)) e.data.f_top = 650;
		if (!(e.data.f_left != 0)) e.data.f_left = 470;		
		$('#'+e.data.swf_id).animate({left:e.data.f_left, top:e.data.f_top, width:1, height:1},"slow");		
		$('#'+e.data.swf_id).fadeOut(400);	
		//$('#'+e.data.swf2_id).html('loading');				
	});
	

	/*Click auf OVERLAY soll Fenster schließen*/
	$('#'+this.sb_overlay.id).bind('click',{overlay_id:this.sb_overlay.id, swf_id:this.sb_swf_div.id, swf2_id:this.sb_swf_div2.id, f_top:this.fade_top, f_left:this.fade_left},function(e){			
		var mein_div2 = document.getElementById(e.data.swf2_id);
		mein_div2.style.visibility = 'hidden';
		$('#close_overlay').html('');	
		$('#close_overlay').css("color","#666666");			
		$('#'+e.data.overlay_id).fadeOut(400);			
		if (!(e.data.f_top != 0)) e.data.f_top = 650;
		if (!(e.data.f_left != 0)) e.data.f_left = 470;	
		$('#'+e.data.swf_id).animate({left:e.data.f_left, top:e.data.f_top, width:1, height:1},"slow");		
		$('#'+e.data.swf_id).fadeOut(400);			
		//$('#'+e.data.swf2_id).html('loading');				
	});
	
	/*Click auf FENSTER selber soll Fenster schließen*/
	$('#'+this.sb_swf_div2.id).bind('click',{overlay_id:this.sb_overlay.id, swf_id:this.sb_swf_div.id, swf2_id:this.sb_swf_div2.id,  f_top:this.fade_top, f_left:this.fade_left},function(e){			
		var mein_div2 = document.getElementById(e.data.swf2_id);
		mein_div2.style.visibility = 'hidden';
		$('#close_overlay').html('');	
		$('#close_overlay').css("color","#666666");			
		$('#'+e.data.overlay_id).fadeOut(400);	
		
		if (!(e.data.f_top != 0)) e.data.f_top = 650;
		if (!(e.data.f_left != 0)) e.data.f_left = 470;	
		$('#'+e.data.swf_id).animate({left:e.data.f_left, top:e.data.f_top, width:1, height:1},"slow");		
		$('#'+e.data.swf_id).fadeOut(400);			
		//$('#'+e.data.swf2_id).html('loading');				
	});
	
	
	/*Click auf kleinen Screen soll Fenster öffnen*/
	$(this.owner_select).bind('click',{overlay_id:this.sb_overlay.id, owner_select:this.owner_select, bsleft:this.bsleft, bstop:this.bstop, bsheight:this.bsheight, bswidth: this.bswidth, swf_id:this.sb_swf_div.id, swf2_id:this.sb_swf_div2.id, f_top:this.fade_top, f_left:this.fade_left},function(e){	
		var mein_div = document.getElementById(e.data.overlay_id);
		$('#close_overlay').css("color","#666666");	
		//$('#'+e.data.swf2_id).html(mein_inhalt);
		$('#'+e.data.overlay_id).fadeOut(0);						
		mein_div.style.visibility = 'visible';
		var temp_h = mein_div.style.height;
		var temp_w = mein_div.style.width;
		$('#'+e.data.overlay_id).fadeIn(400);		
		x = $(e.data.owner_select).offset();		
		bstop = x.top;
		bsleft = x.left;
		bswidth = $(e.data.owner_select).attr('width')-14;
		bsheight = $(e.data.owner_select).attr('height')-14;					
		
		//Jetzt langsam swf - div vergrößern und einblenden!		
		var mein_div2 = document.getElementById(e.data.swf_id);
		mein_div2.style.width = '1px';	
		mein_div2.style.height = '1px';	
		if (!(e.data.f_top != 0)) e.data.f_top = 650;
		if (!(e.data.f_left != 0)) e.data.f_left = 470;	
			
		mein_div2.style.top = e.data.f_top+'px';	
		mein_div2.style.left = e.data.f_left+'px';		
		mein_div2.style.visibility = 'visible';			
		
		var temp_l = 85;
		var temp_t = 20;
		
		$('#'+e.data.swf_id).animate({height:580, width:780, left:temp_l, top:temp_t},"slow", function() {				
			$('#close_overlay').html('close');	
			$('#close_overlay').css("color","#fff");	
			
			mein_div2 = document.getElementById(e.data.swf2_id);
		  	mein_div2.style.top = '20px';			
			mein_div2.style.visibility = 'visible';	
		});	
	});
}

