$(document).ready(function() {
	$("#mainmenu ul li:lt(4)").css("background-color", "#920016");
	$("#mainmenu ul li:gt(3)").css("background-color", "#dd0007");
	$("#mainmenu ul li:gt(7)").css("background-color", "#fd6709");
	$("#mainmenu ul li").not(".active").hover(function() {
		$(this).animate({ paddingRight: '20px' }, 360);
	},function(){
		$(this).animate({ paddingRight: '10px' }, 360);
	});
	$("div#teaser_schwarzberlin div").click(function() {
		window.open("http://www.schwarzberlin.com");
	});
	$("form#bewerbung_formular").submit(function() {
		$('body').append('<div id="submit_overlay"><img src="http://www.agenturschwarz.de/assets/images/global/lightbox-ico-loading.gif"><br>Bitte warten...</div>');
	});
	$("a.quicktime").click(function() {
		function ___getPageSize() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = window.innerWidth + window.scrollMaxX;
				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
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth; 
				} else {
					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 = xScroll;		
			} else {
				pageWidth = windowWidth;
			}
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
			return arrayPageSize;
		};
		function ___getPageScroll() {
			var xScroll, yScroll;
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;	
			}
			arrayPageScroll = new Array(xScroll,yScroll) 
			return arrayPageScroll;
		};
		var arrPageSizes = ___getPageSize();
		var arrPageScroll = ___getPageScroll();
		$('<div#jquery-overlay,div#jquery-lightbox').remove();
		$('embed, object, select').css({visibility:'hidden'});
		$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="480" HEIGHT="376" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab"><PARAM name="SRC" VALUE="'+$(this).attr('href')+'"><PARAM name="AUTOPLAY" VALUE="true"><PARAM name="BGCOLOR" VALUE="black"><PARAM name="SCALE" VALUE="ASPECT"><PARAM name="CONTROLLER" VALUE="true"><PARAM name="cache" VALUE="true"><EMBED SRC="'+$(this).attr('href')+'" type="video/quicktime" WIDTH="480" HEIGHT="376" AUTOPLAY="true" scale="ASPECT" CONTROLLER="true" bgcolor="black" cache="true" PLUGINSPAGE="http://www.apple.com/de/quicktime/download/"</EMBED></OBJECT></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="http://www.agenturschwarz.de/assets/images/global/lightbox-btn-close.gif"></a></div></div></div></div>');
		$('<div#jquery-overlay,div#jquery-lightbox').hide();
		$('#jquery-overlay').css({backgroundColor:"#000",opacity:"0.8",width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();
		$('#lightbox-container-image-box').css({width:"500px",height:"396px"});
		$('#lightbox-container-image-data-box').css({width:"480px"});
		$('#jquery-lightbox').css({top:	arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();
		$('#lightbox-secNav-btnClose,#jquery-overlay').click(function() {
			_finish();
			return false;
		});
		$(window).resize(function() {
			var arrPageSizes = ___getPageSize();
			$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});
			var arrPageScroll = ___getPageScroll();
			$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});
		});
		function _finish() {
			$('#jquery-lightbox OBJECT, #jquery-lightbox EMBED').remove();
			$('#jquery-lightbox').remove();
			$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });
			$('embed, object, select').css({ 'visibility' : 'visible' });
		}
		return false;
	});
});