$(document).ready(function(){
	$("div.scrollable").scrollable({
		size: 4,
		speed:400
	});
});

//$(document).ready(function(){
//	var divs = document.getElementsByTagName('div');
//	for(i=0; i<divs.length; i++){
//		if(divs[i].className == "photogallery_article"){
//			var naviW = $(divs[i]).find('div.navi').width();
//			var boxW = $(divs[i]).find('div.scrollable').width();
//			var diffW = (boxW - naviW)/2;
//			$(divs[i]).find('div.navi').css('margin-left',diffW);
//		}
//	}	
//});



window.onload = function(){
		
		$('.newseventi ul').cycle({
			fx:'scrollUp',
			speed: 5000, 
			timeout: 8000
		});

};

$(window).load(function(){ 
		
		//equalize cols .newseventi ul li div
		$(".newseventi ul li div").equalizeCols();
		
		$(".article, .leftcol").equalizeCols();
		
//		//jquery photogallery scrollable
//	   $('.photogallery_article .scrollable').scrollable({
//			mousewheel: true,
//			size: 5,
//			clickable: false
//		});
//		
//		// get the API, needed to use events
//			var scrollable = jQuery(".photogallery_article .scrollable").data("scrollable");
			// use the event "onSeek", which fires every time you scroll an item
//			if (scrollable != undefined) {
//				scrollable.onSeek(function(){
//				var size = 5;
//			
//					if (this.getIndex() >= this.getSize() - size) {
//						//this.seekTo(this.getSize() - size);
//						$("a.next").addClass("disabled");
//					}
//		
//					
//				});
//			}
	
	// For Attachment 
		$("a[href*=.pdf]").addClass("pdf");
		$("a[href*=.jpg], a[href*=.gif], a[href*=.png]").addClass("jpg");
		$("a[href*=.swf], a[href*=.fla]").addClass("swf");
		$("a[href*=.txt],  a[href*=.xls], a[href*=.doc], , a[href*=.rtf], , a[href*=.pps]").addClass("doc");
		$("a[href*=.mpg], a[href*=.mpeg], a[href*=.avi], a[href*=.mv2], a[href*=.mov], a[href*=.mp4], a[href*=.wmv]").addClass("video");
		$("a[href*=.zip], a[href*=.rar], a[href*=.ace], a[href*=.tar.gz], a[href*=.tgz]").addClass("zip");
		$("a[href*=.mp3], a[href*=.aiff], a[href*=.wav], a[href*=.ogg], a[href*=.wma]").addClass("audio");
		$("a[href*=@]").addClass("email");
	
});

/* pretty photo =============================================================== */

//$(document).ready(function(){
//			$("a[rel^='prettyPhoto']").prettyPhoto({
//				animationSpeed: 'normal', /* fast/slow/normal */
//				padding: 40, /* padding for each side of the picture */
//				opacity: 0.35, /* Value betwee 0 and 1 */
//				showTitle: false, /* true/false */
//				allowresize: true, /* true/false */
//				counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
//				theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square */
//				hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
//				modal: false, /* If set to true, only the close button will close the window */
//				changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
//				callback: function(){} /* Called when prettyPhoto is closed */
//			});
//		});

/* JSTarget function by Roger Johansson, www.456bereastreet.com =============== */

var JSTarget = {
	init: function(att,val,warning) {
		if (document.getElementById && document.createElement && document.appendChild) {
			var strAtt = ((typeof att == 'undefined') || (att == null)) ? 'class' : att;
			var strVal = ((typeof val == 'undefined') || (val == null)) ? 'non-html' : val;
			var strWarning = ((typeof warning == 'undefined') || (warning == null)) ? ' (opens in a new window)' : warning;
			var oWarning;
			var arrLinks = document.getElementsByTagName('a');
			var oLink;
			var oRegExp = new RegExp("(^|\\s)" + strVal + "(\\s|$)");
			for (var i = 0; i < arrLinks.length; i++) {
				oLink = arrLinks[i];
				if ((strAtt == 'class') && (oRegExp.test(oLink.className)) || (oRegExp.test(oLink.getAttribute(strAtt)))) {
					oWarning = document.createElement("em");
					oWarning.appendChild(document.createTextNode(strWarning));
					oLink.appendChild(oWarning);
					oLink.onclick = JSTarget.openWin;
				}
			}
			oWarning = null;
		}
	},
	openWin: function(e) {
		var event = (!e) ? window.event : e;
		if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return true;
		else {
		    var oWin = window.open(this.getAttribute('href'), '_blank');
			if (oWin) {
				if (oWin.focus) oWin.focus();
				return false;
			}
			oWin = null;
			return true;
		}
	},
	/*
	addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	*/
	addEvent: function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn]( window.event );}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
JSTarget.addEvent(window, 'load', function(){JSTarget.init("rel","external","");});


