



// jamie new stuff up top
// jquery rocks my socks!!

function toggle_display(who) {
  //console.log('toggling '+who);
  $(who).toggle();
}





// old stuff down low

var page_properties = new Array();
//page_properties[ "title" ] = "WNYU Radio";


var PlaylistWindow = null;
function ViewPlaylists()
{
	if(PlaylistWindow && !PlaylistWindow.closed)
	{
		try
		{
			PlaylistWindow.focus();
		}
		catch (err)
		{
			return true;
		}
	}
	else
	{
		var winWidth = 1025;
		var winHeight = 650;
		var winTop = 15; //(window.screen.width - winWidth) / 2;
		var winLeft = 15; //(window.screen.height - winHeight) / 2;
		var windowFeatures = "width=" + winWidth + ", height=" + winHeight + ", left=" + winLeft + ", top=" + winTop + ",location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes";			
		PlaylistWindow = window.open("http://radioplaylist.net/Radio/Public/playlists.htm","Playlists",windowFeatures);		
	}
}
	
function closeModalWindow()
{
	if(PlaylistWindow && !PlaylistWindow.closed)
	{
		try
		{
			PlaylistWindow.close();
		}
		catch (err1) { }
	}
}
                    
// -- BUG WORK AROUNDS -- \\    
function HANDLE_FOCUS()
{
this.blur();
}
                    
function HANDLE_LINKS()
{
if( !browsers[ "generic" ] && !browsers[ "netscape" ][ "minor" ] && !browsers[ "netscape" ][ "major" ] && !browsers[ "netscape" ][ "archaic" ] )  {
for( x = 0; x < document.links.length; x++ )  {
document.links[ x ].onfocus = HANDLE_FOCUS;	
		}
	}
}
// -- BUG WORK AROUNDS -- \\                    

// -- WINDOW FUNCTIONS -- \\
function WINDOW_GET_WIDTH()
{
if( browsers[ "netscape" ][ "minor" ] || browsers[ "netscape" ][ "major" ] ) return( window.innerWidth );
else if( browsers[ "ie" ][ "minor" ] || browsers[ "ie" ][ "major" ] ) return( document.body.clientWidth );
else if( browsers[ "generic" ] ) return( false );
else return( false );
}
                   
function WINDOW_GET_HEIGHT()
{
if( browsers[ "netscape" ][ "minor" ] || browsers[ "netscape" ][ "major" ] ) return( window.innerHeight );
else if( browsers[ "ie" ][ "minor" ] || browsers[ "ie" ][ "major" ] ) return( document.body.clientHeight );
else if( browsers[ "generic" ] ) return( false );
else return( false );
}
                   
function WINDOW( url, height, width )
{
var h_center = ( screen.height - height ) / 2;
var w_center = ( screen.width - width ) / 2;
var childWin = window.open( url, 'another', 'width=' + width + ',height=' + height + ',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0,top=' + h_center + ',left=' + w_center ); 
}
// -- WINDOW FUNCTIONS -- \\

// -- IMAGE FUNCTIONS -- \\
function IMAGE_SWAP( layer, image_name, image_object, status )
{
document.images[ image_name ].src = image_object.src;
if( status ) window.status = status;
else window.status = "";
}
                   
function INTERACTIVE_IMAGE( id, selectedNum )
{
var image_name, image_object, image_source, characterIndex;
                		
if ( hoverCount[ id ] == totalNum[ id ] )
{
hoverCount[ id ] = 0;
( switchState[ id ] == "on" ) ? switchState[ id ] = "off" : switchState[ id ] = "on";
}
                		
image_name = "img" + selectedNum;
image_object = eval( "Images[ '" + id + "' ][ '" + image_name + "_" + switchState[ id ] + "' ]" );
image_source = document.images[ id + image_name ].src;
                        
characterIndex = image_source.length - 5;
                        
if ( switchState[ id ].indexOf( image_source.charAt( characterIndex ) ) == -1 )
{
hoverCount[ id ]++;
IMAGE_SWAP ( false, id + image_name, image_object, "W N Y U   R a d i o" );
return true;
}
}
// -- IMAGE FUNCTIONS -- \\
                    
// -- PRINT FUNCTIONS -- \\
function PRINTABLE()  {
var temp = document.location.href;
var printIndex = temp.indexOf( "&printable=false" );
if ( printIndex != -1 )
{
temp = temp.substring( 0, ( printIndex ) );  
}
document.location = temp + "&printable=true";
}
                   
function UNPRINTABLE()  {
var temp = document.location.href;
var printIndex = temp.indexOf( "&printable=true" );
if ( printIndex != -1 )
{
temp = temp.substring( 0, ( printIndex ) );  
}
document.location = temp;
}
// -- PRINT FUNCTIONS -- \\                    
          


function newWindow(theURL) {
	var height = 450;
	var width = 625;
	var h_center = ( screen.height - height ) / 2;
	var w_center = ( screen.width - width ) / 2;
	var theWindow = window.open(theURL, "newWin", 'menubar=0,resizable=1,scrollbars=1,width=' + width + ',height=' + height + ',top=' + h_center + ',left=' + w_center)
	theWindow.focus();
	
}



function popUp(URL,w,h) {
    winl = (screen.width - w) / 2;
    wint = (screen.height - h) / 2;

    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",top="+wint+",left="+winl+"');");
}

function email(addr) {
	newWindow = window.open("mailto:" + addr + "@wnyu.org", "catWin", "width=50,height=50")
	
	if (newWindow && !newWindow.closed) {
		newWindow.close()
	}
}



// functions defined...
// DO THE WORK

// -- GLOBAL VARIABLES -- \\
var browsers = new Array();
var SwapImages;
var totalNum = new Array();
var hoverCount = new Array();
var switchState = new Array();
var Images = new Array()         
                    
browsers[ "ie" ] = new Array();
browsers[ "ie" ][ "minor" ] = ( document.all && !( document.childNodes ) );
browsers[ "ie" ][ "major" ] = ( document.childNodes && ( navigator.appName.indexOf( "Microsoft" ) != -1 ) );
                    
browsers[ "netscape" ] = new Array();
browsers[ "netscape" ][ "archaic" ] = ( ( parseInt( navigator.appVersion ) < 4 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) )
browsers[ "netscape" ][ "minor" ] = ( document.layers );
browsers[ "netscape" ][ "major" ] = ( document.childNodes && ( navigator.appName.indexOf( "Netscape" ) != -1 ) );
                                    
browsers[ "generic" ] = ( !browsers[ "ie" ][ "minor" ] && !browsers[ "ie" ][ "major" ] && !browsers[ "netscape" ][ "minor" ] && !browsers[ "netscape" ][ "major" ] );


