// Global Variables
var panelWidth;

jQuery(document).ready(function(){
	jQuery("#slides").slides({
		preload: true,
		preloadImage: 'images/slider/loading.gif',
		play: 10000,
		pause: 5000,
		hoverPause: true,
		slideSpeed: 1500,
		animationStart: function(current){
			jQuery('.main-slide .caption').animate({
				bottom: '-100px'
			},300);
			jQuery('#slides .pagination').animate({
				opacity: 0
			},0);
		},
		animationComplete: function(current){
			jQuery('.main-slide .caption').animate({
				bottom:0
			},400);
			jQuery('#slides .pagination').animate({
				opacity: 1
			},300);
		},
		slidesLoaded: function() {
			jQuery('.main-slide .caption').animate({
				bottom:0
			},400);
			jQuery('#slides .pagination').animate({
				opacity: 1
			},300);
		}
	});
	
	// Statement Form
	panelWidth = jQuery('.panel').width();
	
	jQuery('.btn-statement').click(function(){
		jQuery(this).fadeOut('normal');
		jQuery('.btn-submit, .btn-cancel').fadeIn('normal');
		jQuery('.panel').animate({ left: '-=' + panelWidth });
		return false;
	});
	
	jQuery('.btn-cancel').click(function(){
		jQuery('.btn-cancel, .btn-submit').fadeOut('normal');
		jQuery('.btn-statement').fadeIn('normal');
		jQuery('.panel').animate({ left: '+=' + panelWidth });
		return false;
	});
	
	// Quote Rotater
	jQuery('.panel q').hide();
	jQuery('.panel q:first-child').show();
	setInterval(function(){
		jQuery('.panel q').filter(':visible').fadeOut(500,function(){
			if(jQuery(this).next('q').size()){
				jQuery(this).next().fadeIn(500);
			}
			else{
				jQuery('.panel q').eq(0).fadeIn(500);
			}
		});
	},6000);
	
	// Lightbox
	Shadowbox.init();
	
});

function popTour(){
	window.open("campustour/", "KnowHow2GO Campus Tour", "width=1000,height=588,toolbar=false,locationbar=false,directories=false,status=false,menubar=false,scrollbars=false,resizable=false,copyhistory=false");
}

function openTough() {
	Shadowbox.open({
        type:       'iframe',
        content:    'http://www.knowhowtogo.org/tough/indexTough.html',
        height:     475,
        width:      909
    });
}

function flashIntro(){
	var objectEmbed = '';
	objectEmbed += '<embed src="swf/4steps.swf" quality="high" bgcolor="#ffffff" width="620" height="290" name="4steps" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" FlashVars="theVideo=welcome_<?php echo $random; ?>.flv&viewed=<?php echo $viewed;?>"/>';
	document.getElementById('home-flash').innerHTML = objectEmbed;
}

function flashIntroSkip(URL){
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'height=588,width=1000,status,scrollbars=no,toolbar=no,menubar=no,location=no,resizable=yes');");
	var objectEmbed = '';
	objectEmbed += '<embed src="swf/4steps_no_intro.swf" quality="high" bgcolor="#ffffff" width="620" height="290" name="4steps_no_intro" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" FlashVars="theVideo=welcome_<?php echo $random; ?>.flv"/>';
	document.getElementById('home-flash').innerHTML = objectEmbed;
}
