// JavaScript Document


// PRELOAD


function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


// ROLLOVER IN HTML TAG

// <a href="#" target="_blank" onmouseover="document.rollover.src='*.png'" onmouseout="document.rollover.src='*.png'">//

// MARQUEE EVENTS

// <marquee behavior="scroll" direction="left" onmouseover="this.stop();" onmouseout="this.start();">Go on... hover over me!</marquee>


// SLIDE UP DOWN CONTENT

$(document).ready(function() {
 // hides the slickbox as soon as the DOM is ready
 // (a little sooner than page load)
  $('#slide').hide();
 // shows the slickbox on clicking the noted link
  $('a#trigger').click(function() {
 $('#slide').slideDown('slow');
 return false;
  });
 // hides the slickbox on clicking the noted link
  $('a#trigger-hide').click(function() {
 $('#slide').slideUp('fast');
 return false;
  });
 // toggles the slickbox on clicking the noted link
  $('a#trigger-toggle').click(function() {
 $('#slide').slideToggle(1000);
 return false;
  });
});

// DROP ANIMATE TV SETS



// FADE HOVER ROLLOVER EFFECT

    // wrap as a jQuery plugin and pass jQuery in to our anoymous function
    (function ($) {
        $.fn.cross = function (options) {
            return this.each(function (i) { 
                // cache the copy of jQuery(this) - the start image
                var $$ = $(this);
                
                // get the target from the backgroundImage + regexp
                var target = $$.css('backgroundImage').replace(/^url|[\(\)'"]/g, '');

                // nice long chain: wrap img element in span
                $$.wrap('<span style="position: relative;"></span>')
                    // change selector to parent - i.e. newly created span
                    .parent()
                    // prepend a new image inside the span
                    .prepend('<img>')
                    // change the selector to the newly created image
                    .find(':first-child')
                    // set the image to the target
                    .attr('src', target);

                // the CSS styling of the start image needs to be handled
                // differently for different browsers
                if ($.browser.msie || $.browser.mozilla) {
                    $$.css({
                        'position' : 'absolute', 
                        'left' : 0,
                        'background' : '',
                        'top' : this.offsetTop
                    });
                } else if ($.browser.opera && $.browser.version < 9.5) {
                    // Browser sniffing is bad - however opera < 9.5 has a render bug 
                    // so this is required to get around it we can't apply the 'top' : 0 
                    // separately because Mozilla strips the style set originally somehow...                    
                    $$.css({
                        'position' : 'absolute', 
                        'left' : 0,
                        'background' : '',
                        'top' : "0"
                    });
                } else { // Safari
                    $$.css({
                        'position' : 'absolute', 
                        'left' : 0,
                        'background' : ''
                    });
                }

                // similar effect as single image technique, except using .animate 
                // which will handle the fading up from the right opacity for us
                $$.hover(function () {
                    $$.stop().animate({
                        opacity: 0
                    }, 500);
                }, function () {
                    $$.stop().animate({
                        opacity: 1
                    }, 1000);
                });
            });
        };
        
    })(jQuery);
    
    // note that this uses the .bind('load') on the window object, rather than $(document).ready() 
    // because .ready() fires before the images have loaded, but we need to fire *after* because
    // our code relies on the dimensions of the images already in place.
    $(window).bind('load', function () {
        $('img.fade').cross();
    });



// SOUND FOR BUTTONS
//<a href="#" onclick="playSound('URL to soundfile');">Click here to hear a sound</a>
//<p onmouseover="playSound('URL to soundfile');">Mouse over this text to hear a sound</p>


function playSound(soundfile) {
document.getElementById("sound").innerHTML=
"<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"true\" loop=\"false\" />";
}

// POP OUT WIHNDOW

var newwindow;
function radio(url)
{
	newwindow=window.open(url,'name','height=150,width=450,resizable=true,scrollbars=yes,toolbar=no,menubar=no,status=no,directories=no');
	if (window.focus) {newwindow.focus()}
}

var newwindow;
function popup(url)
{
	newwindow=window.open(url,'name','height=550,width=600,resizable=true,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}

// Argument Options
// height:    Defines the height of the window in pixels. Percentage values don't work.
// width:    Defines the width. Again, you'll have no joy with percentages.
// left:    Supported by version 4 browsers and above, this sets how far removed the window appears from the left of the screen. In pixels.
// top:    Partner to left, this pushes the window off the top of the screen.
// resizable:    Set to true or false, this may allow the user to resize the window.
// scrollbars:    Another Boolean value, this adds scrollbars to the new window. If your content may be longer then the dimensions you've specified, make sure this is set to yes.
// toolbar:    Specifies whether the basic back/forward toolbar should be visible. If there are links to follow in your new page, set this to yes.
// menubar:    Specifies whether the main toolbar (File, Edit, ...) is shown.
// location:    Specifies whether the location toolbar (address bar) is shown.
// status:    Specifies whether the new window can have a status bar. Best set to yes. For security reasons, Mozilla-based browsers always show the status bar.
// directories:    Specifies whether the directories toolbar is shown (Links toolbar in IE).
// fullscreen:    Internet Explorer-only Boolean attribute which may open the window in fullscreen. It's annoying — don't use it.
// dependent:    Netscape 4-only attribute which makes the popup dependent on the status of the main window. If the main window is closed, the popup closes with it.
// screenX & screenY:    Old Netscape attributes for defining the window's position on the page. Use left and top in their place. 

