/**
 * jQuery SWF Plugin
 * Copyright (c) 2009 Jonathan Neal
 */
 
(function(F,C){var D=function(H){var G,I=[];for(G in H){if(/string|number/.test(typeof H[G])&&H[G]!==""){I.push(G+'="'+H[G]+'"')}}return I[A]("")},E=function(I){var G,K,J=[],H;if(typeof I=="object"){for(G in I){if(typeof I[G]=="object"){H=[];for(K in I[G]){H.push([K,"=",encodeURIComponent(I[G][K])][A](""))}I[G]=H[A]("&amp;")}if(I[G]){J.push(['<param name="',G,'" value="',I[G],'" />'][A](""))}}I=J[A]("")}return I},B=false,A="join";F[C]=(function(){try{var G="0,0,0",H=navigator.plugins["Shockwave Flash"]||ActiveXObject;G=H.description||(function(){try{return(new H("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}catch(J){}}())}catch(I){}G=G.match(/^[A-Za-z\s]*?(\d+)[\.|,](\d+)(?:\s+[d|r]|,)(\d+)/);return{available:G[1]>0,activeX:H&&!H.name,version:{major:G[1]*1,minor:G[2]*1,release:G[3]*1},hasVersion:function(K){var N=this.version,L="major",M="minor",J="release";K=(/string|number/.test(typeof K))?K.toString().split("."):K||[0,0,0];K=[K[L]||K[0]||N[L],K[M]||K[1]||N[M],K[J]||K[2]||N[J]];return(K[0]<N[L])||(K[0]==N[L]&&K[1]<N[M])||(K[0]==N[L]&&K[1]==N[M]&&K[2]<=N[J])},expressInstall:"expressInstall.swf",create:function(J){if(!F[C].available||B||!typeof J=="object"||!J.swf){return false}if(J.hasVersion&&!F[C].hasVersion(J.hasVersion)){J={swf:J.expressInstall||F[C].expressInstall,attrs:{id:J.id||"SWFObjectExprInst",name:J.name,height:Math.max(J.height||137),width:Math.max(J.width||214)},params:{flashvars:{MMredirectURL:location.href,MMplayerType:(F[C].activeX)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}};B=true}else{J=F.extend(true,{attrs:{id:J.id,name:J.name,height:J.height||180,width:J.width||320},params:{wmode:J.wmode||"opaque",flashvars:J.flashvars}},J)}if(F[C].activeX){J.attrs.classid=J.attrs.classid||"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";J.params.movie=J.params.movie||J.swf}else{J.attrs.type=J.attrs.classid||"application/x-shockwave-flash";J.attrs.data=J.attrs.data||J.swf}return["<object ",D(J.attrs),">",E(J.params),"</object>"][A]("")}}}());F.fn[C]=function(G){if(typeof G=="object"){this.each(function(){var I=document.createElement(C);var H=F[C].create(G);if(H){I.innerHTML=H;if(I.childNodes[0]){this.appendChild(I.childNodes[0])}}})}else{if(typeof G=="function"){this.find("object").andSelf().filter("object").each(function(){var I=this,H="jsInteractionTimeoutMs";I[H]=I[H]||0;if(I[H]<660){if(I.clientWidth||I.clientHeight){G.call(this)}else{setTimeout(function(){F(I)[C](G)},I[H]+66)}}})}}return this}}(jQuery,"flash"));


$(function() {
	$(".homeevent").each(function() {
		$(".eventInformation .bg", this).animate({opacity: 0.7}, 0);
		$(this).hover(function() {
			$(".hover", this).fadeIn("fast");
		}, function() {
			$(".hover", this).fadeOut("fast");
		});
		$(this).click(function() {
			var url = $(".bg", this).html();
			if (url.length > 0) window.open(url);
		});
	});
	
	$("#news-bull_ .newsItem").each(function(i,n) {
		$(this).css({
			position: "absolute",
			top: i * 130,
			left: 30,
			width: 310
		});
	});
});

(function($) {
	$.fn.scrollPane = function(options) {
		var opts = $.extend(true, {
			speed: 1.5,
			booster: 6,
			type: "div"
		}, options);
		$(this).each(function() {
			var left = $(".scrollingHotSpotLeft");
			var right = $(".scrollingHotSpotRight");
			var content = $(".scrollableArea");
			var scrolls = $("> *",content);
			var wrapper = content.parent();
			var cspeed = opts.speed;
			var doAutoScroll = true;
			var curItem = 0;
			for (var i = 0; i<5; i++) {
				scrolls.eq(i).clone().appendTo(content);
			}
			var totalItems = content.children().length;
			scrolls = $("> *",content);
			
			wrapper.css({position: "relative"});
			content.css({position: "absolute"});
			var tWidth = 0;
			scrolls.each(function(i,n) {
				tWidth += $(n).width();
			});
			content.width(tWidth);
			var way;
			var interval;
			
			function handleLeftScroll() {
				way = "left";
				interval = setInterval(scrollInner, 10);
			}
			
			function handleRightScroll() {
				way = "right";
				interval = setInterval(scrollInner, 10);
			}
			
			function scrollInner() {
				if (content.children().length < 6) return;
				doAutoScroll = false;
				var pos;
				var cleft = content.css("left").replace("px", "");
				cleft = cleft=="auto"?0:cleft;
				if (way == "left") {
					var pos = parseInt(cleft) + cspeed;
				} else if (way == "right") {
					var pos = parseInt(cleft) - cspeed;
				} else {
					return;
				}
				var maxleft = (content.outerWidth() - wrapper.outerWidth())*-1;
				if (pos > 0) pos = 0;
				else if (pos < maxleft) pos = maxleft;
				content.css({left: pos});
			}
			
			function resetBoost() {
				cspeed = opts.speed;
			}
			
			function handleBoost() {
				cspeed = opts.booster;
			}
			
			function autoScroll() {
				if (doAutoScroll) {
					/*
					var itemWidths = content.children().eq(0).outerWidth();
					curItem++;
					var dur = 1000;
					if (curItem > (content.children().length - 5)) {
						curItem = 0;
						dur = 0;
					}
					var newX = curItem * itemWidths * -1;
					content.animate({left: newX}, dur);
					*/
					var cleft = content.css("left").replace("px", "");
					cleft = cleft=="auto"?0:cleft;
					var maxleft = (content.outerWidth() - wrapper.outerWidth())*-1;
					var pos = parseInt(cleft) - cspeed;
					if (pos > 0) pos = 0;
					else if (pos < maxleft) pos = 0;
					content.animate({left: pos}, 0);
				}
			}
			setInterval(autoScroll, 30);
			
			left.hover(handleLeftScroll, function() { way = null; clearInterval(interval); doAutoScroll = true; });
			left.mousedown(handleBoost);
			left.mouseup(resetBoost);
			right.mouseup(resetBoost);
			right.mousedown(handleBoost);
			right.hover(handleRightScroll, function() { way = null; clearInterval(interval); doAutoScroll = true; });
		});
	}
})(jQuery);

