$(function () {
	if($("#horiz_nav").length) {
		$("#horiz_nav").jcarousel({
			scroll: 1
		});
	}
	if($("#teachers_nav").length) {
		$("#teachers_nav").jcarousel({
			scroll: 1
		});
	}

	if($(".extlnk").length) {
		$(".extlnk div").click(function(){
			window.open("http://" + $(this).attr('title'));
		});
	}

	if($("#inner_gallery").length) {
		$("#inner_gallery").jcarousel({
			scroll: 1
		});
		$("#inner_gallery a").bind("click", function(){
			$("#img_view").attr("src",$(this).attr("rel"));
		});
	}

});
function horiz_nav_initCallback(carousel) {
    $('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval($(this).attr('title')));
		$('.jcarousel-control').find('a.curr').removeClass('curr');
		$(this).addClass('curr');
        return false;
    });
	$('#horiz-next').bind('click', function() {
        carousel.next();
        return false;
    });
    $('#horiz-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

function horiz_nav_itemFirstInCallback(carousel, item, idx, state){
	$('.jcarousel-control').find('a.curr').removeClass('curr');
	$('.jcarousel-control a').eq(idx).addClass('curr');

}



function PNG(element){
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){
	var src;
	if (element.tagName=='IMG'){
			if (/\.png$/.test(element.src)){
				src = element.src;
				element.src = "img/t.gif";
			}
		}
		else {
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if(src){
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
	if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}
}
var mailReg = /^\w+[\w-\.]*@\w+[\w-\.]*\.[a-z]+$/gi;
var phoneNumReg = /^\d{1,3}\s*\d{4,12}$/;
