var widgets = { 
  0: '#tagcloud', 
  1: '#recentcomments',
  2: '.twitterwidget', 
  3: '#social',
  4: '#archive'
};

function start_gallery() {
	var totalWidth = 0;
	var timerId = 0;
	
	jQuery('.gallery-item').each(function() {
		totalWidth += jQuery(this).outerWidth();
	});
	jQuery('.scroll_wrapper').css('overflow', 'hidden');
	jQuery('.gallery').css('width', totalWidth);
	jQuery('.gallery').css('position', 'relative');

	jQuery('.scroll_wrapper').live('mousemove', function(e) {
			clearInterval(timerId);
			var element = jQuery(this);
			var amount = -2;
			var offsetLeft = jQuery(this).offset().left;
			timerId = window.setInterval(function() {
					var relativeX = e.pageX - offsetLeft - element.width()/2;
					var left = parseFloat(element.children('.gallery').css('left'))+(amount*relativeX/100);
					element.children('.gallery').css('left', left);
			}, 100);
		});
		
	jQuery('.scroll_wrapper').mouseleave(function(e) {
		clearInterval(timerId);
		return false;
	});
}

function bind_close(el){
	jQuery(el).click(function() {
		jQuery(this).unbind('click');
		jQuery(this).click(function() {
			return false;
		});
		jQuery(this).fadeTo('fast', 0, function() {
			jQuery(this).parent().siblings('.post_bottomright').children('.new_content').fadeTo('slow', 0, function() {
				jQuery(this).animate({
					height: '0px'
				}, 1000, function() {
					jQuery(this).css('display', 'none');
					jQuery(this).siblings('.entry').css('height', 'auto');
					var thisHeight = jQuery(this).siblings('.entry').height();
					jQuery(this).siblings('.entry').css('height', '0px');
					jQuery(this).siblings('.entry').animate({
						height: thisHeight
					}, 1000, function() {
						jQuery(this).css('display', 'block');
						jQuery(this).fadeTo('slow', 1);
						jQuery(this).parent().siblings('.post_topleft').children('.close_this_post').fadeTo('fast', 0, function() {
							jQuery(this).css('display', 'none');
							jQuery(this).siblings('.open_this_post').css('display', 'block');
							jQuery(this).siblings('.open_this_post').fadeTo('fast', 0.2);
							bind_open(jQuery(this).siblings('.open_this_post'));
						});
					});
				});
			});
		});
		return false;
	});
}
function bind_open(el) {
	jQuery(el).click(function() {
		jQuery(this).unbind('click');
		jQuery(this).click(function() {
			return false;
		});
		jQuery(this).parent().siblings('.post_bottomright').children('.entry').fadeTo('slow', 0, function() {
			link = jQuery(this).find('h2').children('a').attr('href');
			jQuery(this).animate({
				height: '0'
			}, 1000, function(){
				jQuery(this).css('display', 'none');
				if(jQuery(this).parent().find('.new_content').length == 0) {
				jQuery(this).after('<div class="new_content"></div>');
				}
				jQuery(this).siblings('.new_content').fadeTo(0, 0);
				jQuery(this).siblings('.new_content').empty();
				jQuery(this).siblings('.new_content').load(link+' .entry', function() {
					jQuery(this).find('embed').attr('width', '518px');
					jQuery(this).find('embed').attr('height', '323px');
					jQuery(this).find('small').remove();
					jQuery(this).find('.single_config').remove();
					jQuery(this).find('.tags').remove();
					jQuery(this).find('.post_category').remove();
					if(jQuery.cookie('widgets') == 0) {
						jQuery(this).find('p').animate({
							width: '+=220'
						}, 0);
					}
					if(jQuery.cookie('dernobs_categories') == 0) {
						jQuery(this).find('p').animate({
							width: '+=135'
						}, 0);
					}
					jQuery(this).find('p').css('float', 'none');
					jQuery(this).find('h2').css('marginLeft', '0px');
					jQuery(this).find('h2').css('paddingLeft', '0px');
					jQuery(this).find('.icon_enlarge').fadeTo(0, 0.2);
					
					jQuery(this).find('.post_gallery').fadeTo(0,0);
					if(jQuery.cookie('widgets') == 0) {
						jQuery(this).find('.post_gallery').animate({
							width: '+=220'
						}, 0);
					}
					if(jQuery.cookie('widgets') == 0) {
						jQuery(this).find('.gallery-wrap').animate({
							width: '+=220'
						}, 0);
					}
					if(jQuery.cookie('dernobs_categories') == 0) {
						jQuery(this).find('.post_gallery').animate({
							width: '+=135'
						}, 0);
					}
					if(jQuery.cookie('dernobs_categories') == 0) {
						jQuery(this).find('.gallery-wrap').animate({
							width: '+=135'
						}, 0);
					}
					jQuery(this).css('height', 'auto');
					var contentheight = jQuery(this).height();
					jQuery(this).css('height', '0px');
					jQuery(this).animate({
						height: contentheight
					}, 1000, function() {
						jQuery(this).fadeTo('slow', 1);
					});
					jQuery(this).css('height', 'auto');
					jQuery('.pp_pic_holder').remove();
					jQuery('.pp_overlay').remove();
					jQuery('.ppt').remove();
					start_lightbox();
					jQuery(this).parent().siblings('.post_topleft').children('.open_this_post').fadeTo('fast', 0, function() {
						jQuery(this).css('display', 'none');
						jQuery(this).after('<a href="#" class="close_this_post" title="Diesen Beitrag zuklappen"><img src="'+jQuery('link[rel="index"]').attr('href')+'/wp-content/themes/dernobs_standard/img/icons/icon_b_arr_u.png" alt="Diesen Beitrag aufklappen"/></a>');
						jQuery(this).siblings('.close_this_post').fadeTo(0, 0);
						jQuery(this).siblings('.close_this_post').fadeTo('fast', 0.2);
						bind_close(jQuery(this).siblings('.close_this_post'));
						jQuery(this).parent().siblings('.post_bottomright').find('.post_gallery').fadeTo('slow',1, function() {
							//start_parallax(513, 180);
						});
					});
				});
			});
		});
		return false;
	});
}
	


function start_lightbox() {
	jQuery('a[rel^=lightbox]').prettyPhoto({
            animationSpeed: wppp_speed,
            padding: wppp_padding,
            opacity: wppp_opacity,
            showTitle: wppp_title,
            allowresize: wppp_resize,
            counter_separator_label: wppp_counterlabel,
            theme: wppp_theme,
            wmode: wppp_wmode,
            autoplay: wppp_autoplay,
            hideflash: wppp_hideflash,
            modal: wppp_modal,
            changepicturecallback: wppp_picturecallback,
            callback: wppp_callback,
            markup: wppp_markup,
            image_markup: wppp_imarkup,
            flash_markup: wppp_fmarkup,
            quicktime_markup: wppp_qmarkup,
            iframe_markup: wppp_frmmarkup,
            inline_markup: wppp_inmarkup
	});
}

function sort_widgets() {
	var missingWidgets = new Array();
	var missingIndex = 0;
	var widgetPos = new Array();
	jQuery.each(widgets, function(index, name) {
		widgetID = '#widget_'+index;
		if(!jQuery.cookie('widget_'+index+'_pos')) {
			missingWidgets[missingIndex] = widgetID;
			missingIndex++;
		} else {
			widgetPos[jQuery.cookie('widget_'+index+'_pos')] = widgetID;
		}
	});
	jQuery.each(widgetPos, function(pos, id) {
		var save = jQuery(id);
		jQuery(id).remove();
		jQuery('#right').children('ul').append(save);
	});
	jQuery.each(missingWidgets, function(index, id) {
		var save = jQuery(id);
		jQuery(id).remove();
		jQuery('#right').children('ul').append(save);
	});
}

function init() {

	jQuery('.bookmark').jFav();
	
	jQuery('#cat_bottomleft').html('<a href="#" title="Kategorien ausblenden"><img src="'+jQuery('link[rel="index"]').attr('href')+'/wp-content/themes/dernobs_standard/img/icons/icon_b_arr_l.png" alt="Kategorien ausblenden"/></a>');
	jQuery('#cat_bottomleft a').fadeTo(0, 0);
	
	jQuery('.widget_bottomright').html('<a class="close_this_widget" href="#" title="Dieses Widget ausblenden"><img src="'+jQuery('link[rel="index"]').attr('href')+'/wp-content/themes/dernobs_standard/img/icons/icon_b_arr_u.png" alt="Dieses Widget ausblenden"/></a>');
	
	jQuery('#right').append('<a id="close_all_widgets" href="#" title="Alle Widgets ausblenden"><img src="'+jQuery('link[rel="index"]').attr('href')+'/wp-content/themes/dernobs_standard/img/icons/icon_b_darr_r.png" alt="Alle Widgets ausblenden"/></a>');
	jQuery('#close_all_widgets').fadeTo(0, 0);
	
	jQuery('.post_topleft').html('<a class="open_this_post" href="#" title="Diesen Beitrag aufklappen"><img src="'+jQuery('link[rel="index"]').attr('href')+'/wp-content/themes/dernobs_standard/img/icons/icon_b_arr_d.png" alt="Diesen Beitrag aufklappen"/></a>');
	jQuery('.post_topleft a').fadeTo(0, 0);
	
	
	jQuery.each(widgets, function(key, value) {
		jQuery('#right').find(value).parents('li').attr('id', 'widget_'+key);
		jQuery('#right').find(value).parents('li').attr('class', 'widget');
	});
	
	sort_widgets();
	
	if(!jQuery.cookie('dernobs_categories')) {
		jQuery.cookie('dernobs_categories', '1', {expires: 356, domain: 'dernobs.at'});
	} else if(jQuery.cookie('dernobs_categories') == 0) {
		jQuery('#left').css('width', '0px');
		jQuery('#left').css('display', 'none');
		if(jQuery('#show_categories').length < 1) {
			jQuery('#left').after('<a id="show_categories" href="#" title="Kategorien einblenden"></a>');
			jQuery('#show_categories').fadeTo(0,0);
			jQuery('#show_categories').fadeTo('slow',0.2);
		}
		jQuery('#content').animate({
				width: '+=135'
			}, 0);
			jQuery('.post_bottomright').animate({
				width: '+=135'
			}, 0);
			jQuery('.post_bottomright .entry p, blockquote p, .entry h2, .post_gallery, .gallery-wrap').animate({
				width: '+=135'
			}, 0);
	}
	
	jQuery.each(widgets, function(key, value) {
		thisWidget = 'widget_'+key;
		if(!jQuery.cookie(thisWidget)) {
			jQuery.cookie(thisWidget, '1', {expires: 356, domain: 'dernobs.at'});
			jQuery('li[id='+thisWidget+']').find('.close_this_widget').fadeTo('slow', 0.2);
		} else if(jQuery.cookie(thisWidget) == 0) {
			thisHeight = jQuery('li[id='+thisWidget+']').find('.widget_topright').height();
			window[thisWidget] = thisHeight;
			jQuery('li[id='+thisWidget+']').find('.widget_topright').children('ul, div').css('display', 'none');
			jQuery('li[id='+thisWidget+']').find('.widget_topright').css('height', '20px');
			jQuery('li[id='+thisWidget+']').find('.widget_bottomleft').css('height', '40px');
			jQuery('li[id='+thisWidget+']').find('.widget_bottomleft').css('marginTop', '-20px');
			jQuery('li[id='+thisWidget+']').find('.close_this_widget').fadeTo(0, 0, function() {
				jQuery('li[id='+thisWidget+']').find('.close_this_widget').css('display', 'none');
			});
			jQuery('li[id='+thisWidget+']').find('.widget_bottomright').append('<a class="open_this_widget" href="#" title="Dieses Widget ausblenden"></a>');
			jQuery('li[id='+thisWidget+']').find('.open_this_widget').fadeTo(0, 0);
			jQuery('li[id='+thisWidget+']').find('.open_this_widget').fadeTo('fast', 0.2);
		} else if(jQuery.cookie(thisWidget) == 1) {
			jQuery('li[id='+thisWidget+']').find('.close_this_widget').fadeTo(0, 0);
			jQuery('li[id='+thisWidget+']').find('.close_this_widget').fadeTo('slow', 0.2);
		}
	});
	
	if(!jQuery.cookie('widgets')) {
		jQuery.cookie('widgets', '1', {expires: 356, domain: 'dernobs.at'});
	} else if(jQuery.cookie('widgets') == 0) {
		jQuery('#right').css('width', '0px');
		jQuery('#right').css('display', 'none');
		if(jQuery('#open_all_widgets').length < 1) {
			jQuery('#right').after('<a id="open_all_widgets" href="#" title="Alle Widgets einblenden"><img src="'+jQuery('link[rel="index"]').attr('href')+'/wp-content/themes/dernobs_standard/img/icons/icon_b_darr_l.png" alt="Alle Widgets einblenden"/></a>');
			jQuery('#open_all_widgets').fadeTo(0,0);
			jQuery('#open_all_widgets').fadeTo('slow',0.2);
		}
		jQuery('#content').animate({
				width: '+=220'
			}, 0);
			jQuery('.post_bottomright').animate({
				width: '+=220'
			}, 0);
			jQuery('.post_bottomright .entry p, blockquote p, .entry h2, .post_gallery, .gallery-wrap').animate({
				width: '+=220'
			}, 0);
	}
	
	jQuery('#right').children('ul').sortable({
			placeholder: 'ui-state-highlight',
			update: function(event, ui) {
				var result = jQuery('#right').children('ul').sortable('toArray');
				jQuery.each(result, function(index, name) {
					jQuery.cookie(name+'_pos', index, {expires: 356, domain: 'dernobs.at'});
				});
			}
		});
	jQuery('#right').children('ul').disableSelection();

}	

function fadeOutStuff() {
	jQuery('.icon_enlarge').fadeTo(0, 0);
	jQuery('.post_bottomleft a').fadeTo(0, 0);
	jQuery('#searchform').fadeTo(0, 0);
	//jQuery('.post_gallery').fadeTo(0, 0);
}

function start_stuff() {
	jQuery('.icon_enlarge').fadeTo('slow', 0.2);
	jQuery('.post_bottomleft a').fadeTo('slow', 0.2);
	jQuery('#config a').fadeTo('slow', 0.2);
	jQuery('#cat_bottomleft a').fadeTo('slow', 0.2);
	jQuery('#close_all_widgets').fadeTo('slow', 0.2);
	jQuery('.post_topleft a').fadeTo('slow', 0.2);
	jQuery('#searchform').fadeTo('slow', 0.2);
	
	jQuery('#config a').hover(function() {
		jQuery(this).fadeTo('fast', 1);
	},
	function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('#searchform').hover(function() {
		jQuery(this).fadeTo('fast', 1);
	},
	function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('#s').focus(function() {
		jQuery(this).attr('value', '');
	});
	
	jQuery('#cat_bottomleft a').hover(function() {
		jQuery(this).fadeTo('fast', 1);
	},
	function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('.close_this_widget').hover(function() {
		jQuery(this).fadeTo('fast', 1);
	},
	function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('#close_all_widgets').live('mouseover', function() {
		jQuery(this).fadeTo('fast', 1);
	});
	jQuery('#close_all_widgets').live('mouseout', function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('#open_all_widgets').live('mouseover', function() {
		jQuery(this).fadeTo('fast', 1);
	});
	jQuery('#open_all_widgets').live('mouseout', function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('.open_this_post').hover(function() {
		jQuery(this).fadeTo('fast', 1);
	},
	function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('.close_this_post').live('mouseover', function() {
		jQuery(this).fadeTo('fast', 1);
	});
	jQuery('.close_this_post').live('mouseout', function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	bind_open(jQuery('.open_this_post'));
	
	jQuery('.post_bottomleft a').hover(function() {
		jQuery(this).fadeTo('fast', 1);
	},
	function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('.icon_enlarge').live('mouseover', function() {
		jQuery(this).fadeTo('fast', 1);
	});
	jQuery('.icon_enlarge').live('mouseout', function() {
		jQuery(this).fadeTo('fast', 0.2);
	});
	
	jQuery('#cat_bottomleft a').click(function() {
		if(jQuery.cookie('dernobs_categories') == 1) {
			jQuery.cookie('dernobs_categories', '0', { expires: 356, domain: 'dernobs.at'});
		jQuery('#left').fadeTo('slow', 0, function() {
			jQuery('.new_content').css('height', 'auto');
			jQuery('#left').animate({
				width: '0'
			  }, 1000, function() {
				jQuery('#left').css('display', 'none');
				jQuery('#content, .post_bottomright, .post_bottomright .entry p, .entry h2, blockquote p, .post_gallery, .gallery-wrap').animate({
					width: '+=135'
				}, 1000, function() {
					if(jQuery('#show_categories').length == 0) {
						jQuery('#left').after('<a id="show_categories" href="#" title="Kategorien einblenden"></a>');
						jQuery('#show_categories').fadeTo(0,0);
						jQuery('#show_categories').fadeTo('slow',0.2);
					}
				});
			  });
		});
		}
		return false;
	});
	
	jQuery('#show_categories').live('click', function() {
		if(jQuery.cookie('dernobs_categories') == 0) {
			jQuery.cookie('dernobs_categories', '1', { expires: 356, domain: 'dernobs.at'});
			jQuery('#show_categories').fadeTo('slow',0, function() {
				jQuery('#left').fadeTo(0, 0);
				jQuery('#show_categories').remove();
				jQuery('#content').animate({
						width: '-=135'
					}, 1000);
					jQuery('.post_bottomright').animate({
						width: '-=135'
					}, 1000);
					jQuery('.post_bottomright .entry p, blockquote p, .entry h2, .post_gallery, .gallery-wrap').animate({
						width: '-=135'
					}, 1000);
					jQuery('#left').animate({
						width: '135'
					  }, 1000, function() {
						jQuery('#left').fadeTo('slow', 1);
					  });
			});
		return false;
		}
	});
	
	jQuery('#show_categories').live('mouseover', function() {
		jQuery(this).fadeTo('fast', 1);
		return false;
	});
	
	jQuery('#show_categories').live('mouseout', function() {
		jQuery(this).fadeTo('fast', 0.2);
		return false;
	});
	
	jQuery('.close_this_widget').live('click', function() {
		thisWidget = jQuery(this).parents('li').attr('id');
		if(jQuery.cookie(thisWidget) == 1) {
			jQuery.cookie(thisWidget, '0', {expires: 356, domain: 'dernobs.at'});
			thisHeight = jQuery(this).parent().siblings('.widget_topright').height();
			thisID = jQuery(this).parents('li').attr('id');
			window[thisID] = thisHeight;
			jQuery(this).parent().siblings('.widget_topright').children('ul, div').fadeTo('slow', 0, function() {
				jQuery(this).parent().animate({
					height: '20'
				  }, 1000, function() {
					jQuery(this).children('ul, div').css('display', 'none');
				  });
				 jQuery(this).parent().siblings('.widget_bottomleft').animate({
					height: '40',
					marginTop: '-20'
				 }, 1000, function() {
					jQuery(this).siblings('.widget_bottomright').children('.close_this_widget').fadeTo('slow', 0, function() {
						jQuery(this).css('display', 'none');
						if(jQuery(this).siblings('.open_this_widget').length < 1) {
							jQuery(this).after('<a href="#" title="Widget einblenden" class="open_this_widget"></a>');
						}
						jQuery(this).siblings('.open_this_widget').fadeTo(0,0);
						jQuery(this).siblings('.open_this_widget').css('display', 'block');
						jQuery(this).siblings('.open_this_widget').fadeTo('fast', 0.2);
					});
				 });
			});
		}
		return false;
	});
	
	jQuery('.open_this_widget').live('click', function() {
		thisWidget = jQuery(this).parents('li').attr('id');
		if(jQuery.cookie(thisWidget) == 0) {
			jQuery.cookie(thisWidget, '1', {expires: 356, domain: 'dernobs.at'});
			thisID = jQuery(this).parents('li').attr('id');
			thisHeight = window[thisID];
			jQuery(this).parent().siblings('.widget_bottomleft').animate({
				height: '60',
				marginTop: '-40'
			}, 1000);
			jQuery(this).parent().siblings('.widget_topright').animate({
				height: thisHeight
			}, 1000, function() {
				jQuery(this).children('ul, div').css('display', 'block');
				jQuery(this).children('ul, div').fadeTo('slow', 1, function() {
					jQuery(this).parents('li').find('.open_this_widget').fadeTo('fast', 0, function() {
						jQuery(this).css('display', 'none');
						jQuery(this).siblings('.close_this_widget').css('display', 'block').fadeTo('fast', 0.2);
					});
				});
			});
		}
		return false;
	});
	
	jQuery('.open_this_widget').live('mouseover', function() {
		jQuery(this).fadeTo('fast', 1);
		return false;
	});
	
	jQuery('.open_this_widget').live('mouseout', function() {
		jQuery(this).fadeTo('fast', 0.2);
		return false;
	});

	
	jQuery('#close_all_widgets').click(function() {
		if(jQuery.cookie('widgets') == 1) {
			jQuery.cookie('widgets', '0', {expires: 356, domain: 'dernobs.at'});
			doneOnce = false;
			jQuery('#right').fadeTo('slow', 0, function() {
				jQuery(this).css('width', '0px');
				jQuery('.new_content').css('height', 'auto');
				jQuery('#content, .post_bottomright, .post_bottomright .entry p, blockquote p, .entry h2, .post_gallery, .gallery-wrap').animate({
						width: '+=220'
					}, 1000, function() {
						if(!doneOnce) {
							jQuery('#right').css('display', 'none');
							if(jQuery('#open_all_widgets').length < 1) {
								jQuery('#right').after('<a id="open_all_widgets" href="#" title="Alle Widgets einblenden"><img src="'+jQuery('link[rel="index"]').attr('href')+'/wp-content/themes/dernobs_standard/img/icons/icon_b_darr_l.png" alt="Alle Widgets einblenden"/></a>');
							}
							jQuery('#open_all_widgets').fadeTo(0,0);
							jQuery('#open_all_widgets').css('display', 'block');
							jQuery('#open_all_widgets').fadeTo('slow', 0.2);
							doneOnce = true;
						}
					});
			});
		}
		
		return false;
	});
	
	jQuery('#open_all_widgets').live('click', function() {
		if(jQuery.cookie('widgets') == 0) {
			jQuery.cookie('widgets', '1', {expires: 356, domain: 'dernobs.at'});
			doneOnce = false;
			jQuery(this).fadeTo('slow', 0, function() {
				jQuery(this).css('display', 'none');
				jQuery('#content, .post_bottomright, .post_bottomright .entry p, blockquote p, .entry h2, .post_gallery, .gallery-wrap').animate({
						width: '-=220'
					}, 1000, function() {
						if(!doneOnce) {
							jQuery('#right').css('display', 'block');
							jQuery('#right').css('width', '220px');
							jQuery('#right').fadeTo('slow', 1);
						doneOnce = true;
						}
					});
			});
		}
		return false;
	});
	
}

function start_parallax(cont_width, cont_height) {
	width = 200;
	margin = 0;
	height = 0;
	jQuery('.gallery-wrap').css({
		'overflow':'hidden',
		'width' : cont_width, 
		'height' : cont_height
	});
	jQuery('.gallery').css({
		'position' : 'relative', 
		'overflow' : 'hidden',
		'width':cont_width,
		'height':cont_height
	});
	jQuery('.gallery li').css({
		'position' : 'absolute'
	});
	jQuery('.gallery .gallery-item').css('textAlign', 'left');
	jQuery('.gallery li').each(
		function(intIndex) {
			jQuery(this).css('width', 'auto');
			jQuery(this).css('left', width);
			width += jQuery(this).width()+10;
		}
	);
	jQuery('.gallery li').css({
		'width' : width-(cont_width - 200)
	});
	jQuery('.gallery li img').css({
		'padding' : 0
	});
	jQuery('.gallery li a').fadeTo(0, 0.5);
	jQuery('.gallery li a').hover(function() {
		jQuery(this).fadeTo('fast', 1);
	},
	function()
	{
		jQuery(this).fadeTo('fast', 0.5);
	});
	jQuery('.gallery li img').each(
		function(intIndex) {
		var height = jQuery(this).height();
		var margin = (cont_height - height)/2;
			jQuery(this).css('marginTop', margin);
		}
	);
	jQuery('.gallery').jparallax({yparallax: false});
	jQuery('.gallery').fadeTo('slow', 1);
}


jQuery(document).ready(function() {
	init();
	fadeOutStuff();
});

jQuery(window).load(function() {
	cont_width = 0;
	cont_height = 0;
	//start_parallax(565, 180);
	start_stuff();
	start_lightbox();
	//start_gallery();
});
