// JavaScript Document

// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

function OpenAdmin(theURL){
	LeftPosition = (screen.width) ? (screen.width)-510 : 0;
	cmsheight = (screen.height) ? (screen.height)*.85 : 550;
	settings = 'height='+cmsheight+',width=600,top=0,left='+LeftPosition+',scrollbars=yes,resizable=yes'
	win = window.open(theURL,'viewit',settings)
}


function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}


 function changeBox()
 {
    document.getElementById('div1').style.display='none';
    document.getElementById('div2').style.display='';
    document.getElementById('password').focus();
 }
 function restoreBox()
 {
    if(document.getElementById('password').value=='')
    {
      document.getElementById('div1').style.display='';
      document.getElementById('div2').style.display='none';
    }
 }
 
 
function show_div(div_id,menu) { 
// hide all the divs and show all menus
if(document.getElementById('tab1')){
document.getElementById('florence').style.display = 'none';
document.getElementById('tab1a').className = "off";
}
if(document.getElementById('tab2')){
document.getElementById('springfield').style.display = 'none';
document.getElementById('tab2a').className = "off";
}
if(document.getElementById('tab3')){
document.getElementById('westfield').style.display = 'none';
document.getElementById('tab3a').className = "off";
}
// show the requested div 
document.getElementById(div_id).style.display = 'block';
document.getElementById(menu).className = "on";
}



/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});
