$(function(){
	$('div#navbar ul.primary li.hn2').hover(
		function(){
			$('div#navbar ul.primary li:hover.hn2 ul.subnav').fadeIn(500);
			$('div#navbar ul.primary li.hn2').addClass('active');
		},
		function(){
			$('div#navbar ul.primary li:hover.hn2 ul.subnav').fadeOut(500);
			$('div#navbar ul.primary li.hn2').removeClass('active');
		}
	);
});

function matchHeights(id1, id2) {
	var height1 = $(id1).height();
	$(id2).css({'min-height': height1});
	return true;
}

$(function() {
	matchHeights("div#sidebar", "div#content");
});

function OpenPopupWin2(url,title,w,h)
{
	var newwin = window.open( url,title,'width='+w+',height='+h+',status=yes,scrollbars=yes,resizable=no,location=no,toolbar=yes');
	if (newwin) newwin.focus();
}


/* Player function */
function play(id) {

	var songs=new Array();
	songs[0]="song01";
	songs[1]="song02";
	songs[2]="song03";

	for (var i = 0; i < songs.length; i++)
	{
	    if (songs[i] != id)
	    {
	        if (document.getElementById(songs[i]))
	            document.getElementById(songs[i]).SetVariable("player:jsStop", "");
	    }
	    else
	    {
	    if (document.getElementById(id) && document.getElementById(id).GetVariable("player:jsPlay"))
	       document.getElementById(id).GetVariable("player:jsStop");
	    else if(document.getElementById(id))
	       document.getElementById(id).GetVariable("player:jsPlay");
	    }
	}

}


// function navHighlight(num)
// {
// 	$('div#navbar ul li.hn'+num).addClass('active');
// 	$('div#header').css('background', 'url("/wp-content/themes/joshuapanda/images/header'+num+'.jpg") top left no-repeat');
// }

// Create the tooltips only on document load
/*
$(document).ready(function() 
{
   // Use the each() method to gain access to each elements attributes
   $('div#content a.preorder').each(function()
   {
      $(this).qtip(
      {
          content: {
            // Set the text to an image HTML string with the correct src URL to the loading image you want to use
//				prerender: true,
            text: '',
            url: $(this).attr('rel'), // Use the rel attribute of each element for the url to load
            title: {
               text: false, //$(this).text(), // Give the tooltip a title using each elements text
               button: false //'Close' // Show a close link in the title
            }
         },
         position: {
            corner: {
               target: 'topMiddle', // Position the tooltip above the link
               tooltip: 'bottomMiddle'
            },
            adjust: {
               screen: true // Keep the tooltip on-screen at all times
            }
         },
         show: { 
            when: { event: 'mouseover' },
            solo: true // Only show one tooltip at a time
         },
         hide: {
				when: { event: 'mouseout' },
				delay: 500,
				fixed: true
			},
         style: {
            tip: true, // Apply a speech bubble tip to the tooltip at the designated tooltip corner
            border: {
               width: 0,
               radius: 4
            },
            name: 'light', // Use the default light style
            width: 288 // Set the tooltip width
         }
      })
   });
});
*/