
$(document).ready(function() {

	// video player
	jwplayer('welcomeVideo').setup({
		flashplayer: 'lib/mediaplayer-5.7/player.swf',
		id: 'welcomePlayer',
		width: '480',
		height: '270',
		file: 'cdd_intro.flv',
		controlbar: 'over',
		image: 'newhomeimages/video_banner.jpg',
		plugins: {
			'gapro-2': {
		        "trackstarts": true,
		        "trackpercentage": true,
		        "trackseconds": true,
		        "accountid": 'UA-611595-1',
		        "idstring": '||mediaid||-||title||'
			}
		}
	});

	// round call to action box corners
	$('DIV#callToAction').corner("round 8px");

	// round call to action box corners
	$('DIV#actionReturningStudent').corner("round 8px cc:#9cd5e9");

	// round call to action box corners
	$('DIV#actionReturningStudent').click(function() {
		window.location = "/login.php"
	});
	
	// round call to action box corners
	$('DIV#actionContact').corner("round 8px cc:#9cd5e9");
	
	// autoredirect based on drop-down menu selection
	$('SELECT#class_state').change(function() {
		window.location = $('SELECT#class_state option:selected').val();
	});

	// init custom state selector 
	$('select#class_state').selectBox({
		width: 300
	});
	
	// display/hide city list
	$('#moreCitiesMoreInfo').click(function() {
		if ($('#classCityList').is(':visible')) {
			$('#classCityList').hide('fast');
			$('#citiesListLink').empty().html('Click here for the List of Cities');
		} else {
			$('#classCityList').show('slow', function() {
				$('#citiesListLink').empty().html('Click to hide the List of Cities');
				$.scrollTo('#horizontalZone5', 1000, {axis:'y'});
			});
		}
	});

	// hide cities (bottom link)
	$('#hideCities').click(function() {
		$('#classCityList').hide('slow');
	});

	// modal for additional info
	$('#infoTextLink').click(function() {
		$('#infoTextZoneContainer').modal({
			width: 625,
			height: 425,
			opacity:80,
			overlayClose: true,	
			overlayCss: {backgroundColor:"#000"},
		    containerCss: {
		        'overflow' : 'hidden'
		    },
		    autoPosition: true
		});
	});
	
	// bottom tab styling (rounded corners, effect)
	$('.bottomTab').corner("top 5px cc:#2fc3ed");
	$('.bottomTab').hover(
		function() { // mouseon, hover
			$(this).addClass('bottomTab-elevate');
			
		}, function() { // mouseout
			$(this).removeClass('bottomTab-elevate');
		}
	);
	
	// hover image swap; used for social media links
	$('.hoverswap').hover(
		function () {
			$(this).attr("src", $(this).attr("src").replace(/.gif/, "-over.gif"));
		},
		function () {
			$(this).attr("src", $(this).attr("src").replace(/-over.gif/, ".gif"));
		}
	);

	$('.hoverswap-png').hover(
			function () {
				$(this).attr("src", $(this).attr("src").replace(/.png/, "-over.png"));
			},
			function () {
				$(this).attr("src", $(this).attr("src").replace(/-over.png/, ".png"));
			}
		);

});

