$(document).ready(function() {
	
	if(!(jQuery.browser.msie && jQuery.browser.version.substr(0,1)=="6")) {
	
		$(function() {
			$.Lightbox.construct({
				show_info: true,
				show_extended_info: true,
				download_link: false,
				colorBlend: false,
				show_linkback: false,
				auto_scroll: 'ignore',
				opacity: 0.8,
				auto_relify: true,
		
				text: {
					// For translating
					image:		'Bild',
					of:			'von',
					close:		'Schlie&szlig;en',
					closeInfo:	'',
					download:	'',
					help: {
						close:		'',
						interact:	''
					},
					about: {
						text: 	'ZEEB Innenausbau GmbH',
						title:	'',
						link:	'http://www.zeeb.de'
					}
				}
			});
		});
	}


	$('.defus').defuscate();
	$('.ref').each(function(){
		var turl = $('a',this).attr('href');
		var valu = $('a',this).html();
		var test_cnnt = "";
		$('a',this).remove();
		$('p:first',this).append('<span class="icon link">'+valu+'</span>');
		$(this).append('<div class="insertref"></div>');
		
		$(this).toggle(

			function() {
				// open
				/* test_cnnt = $('.insertref',this).html(); */
				$('.rowref',this).addClass('active');
				var ic= $('.icon:first',this);
				$(ic).css("background-image","url(/css/img/ic_timer.gif)");
				
				$.scrollTo(this,{duration:2000,offset:{top:-34}});

				$('.insertref',this).hide().load(turl+"&page=getdetail.htm",{},function(){
					// $.scrollTo(this,{duration:2000,offset:{top:-64}});
					$(ic).css("background-image","url(/css/img/ic_close.gif)");
					$(this).slideDown("slow");
					$('.lightbox',this).lightbox();
				});

			},
			function() {
				$.scrollTo(this,{duration:2000,offset:{top:-34}});
				$('.rowref',this).removeClass('active');
				$('.insertref',this).slideUp("slow",function(){
					$(this).html("");
				});

				$('.icon:first',this).css("background-image","url(/css/img/ic_ok.gif)");

			}
		);
		
	});
	
	$('.rowref').hover(
		function () {
			$(this).addClass('rhover'); // ('color','#fff');
		}, 
		function () {
			$(this).removeClass('rhover'); // ('color','#666');
		}
	);
	
	var inthash = location.hash;
	// trigger
	
	if(inthash&&inthash!='#') {
		$(inthash).trigger('click');
	}
});


