var statusB;
function popup(location) {
	var w = 700;
	var h = 500;
	var left = (screen.width - w) / 2;
	var top = (screen.height - h) / 2;
	var with_address = false;
	var	opt = 'toolbar=no,resizable=yes,menubar=no,width='+w+',height='+h+',scrollbars=yes,location='+
	   (with_address ? 'yes' : 'no')+',titlebar=no,directories=no,screenX='+top+',screenY='+left+',top='+top+',left='+left;
	window.open(location, '', opt);

}


stepcarousel.setup({
	galleryid: 'slide-show', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'slide', //class of panel DIVs each holding content
	panelbehavior: {speed:1000, wraparound:true, persist:false},
	defaultbuttons: {enable: false, moveby: 1, leftnav: ['css/img/button_prev.png', 0, 130], rightnav: ['css/img/button_next.png', -65, 130]},
	statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
	contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})

function open_login(){
	$('#modules').accordion('activate', 0);
}
function show_login(){
	
}
function next_slide(){
	window.clearInterval(slide_interval);
	if(statusB==9) { stepcarousel.stepBy('slide-show', -8); return; }
	stepcarousel.stepBy('slide-show', 1);
	set_interval();
}
function prev_slide(){
	window.clearInterval(slide_interval);
	if(statusB==3) { stepcarousel.stepBy('slide-show', 6); return; }
	stepcarousel.stepBy('slide-show', -1)
	set_interval();
}
var slide_interval;
function set_interval(){
	slide_interval = window.setInterval(function(){ next_slide(); }, 4000);
}
set_interval();

jQuery().ready(function(){
	$("#modules").accordion({
		header: "h3",
		alwaysOpen: false, 
		autoheight: false
	});
	
	try{
		$('.tooltiped').tooltip({ 
			track: true, 
			delay: 0, 
			showURL: false, 
			showBody: " - ", 
			opacity: 0.85 
		});	
	}catch(e){}
	
	$('#ex2').jqm({ajax: 'video.html', trigger: 'a#video-button'});
	
	var accordions = jQuery('#modules');
	
	var hash = window.location.hash;
	if(hash == "#module-login"){
		open_login();
	}
	
});
