/*
--------------------------------------------------------------------------- 
Default Javascript File
(c) 2011 Select Performers

Version:	3.00
Date:		15/03/2011
Author:		Ian Anderson Gray
Website:	http://selectperformers.com/
---------------------------------------------------------------------------
Notes:	
		
---------------------------------------------------------------------------
To Do

---------------------------------------------------------------------------
Change Log

---------------------------------------------------------------------------
*/



$(document).ready(function()	{
						   
	
		
		
		// Error Sound
		swfobject.embedSWF("/media/swf/audioPlayer/playerNew.swf", "errorSound", "1", "1", "9.0.0","/media/swf/swfObject/expressInstall.swf", {soundFile:"/media/audio/error.mp3&autostart=yes"}, {menu:"false", quality:"high",wmode:"transparent"}, {id:"myDynamicContent",name:"myDynamicContent"});
		
		if ( $("#error404").length > 0 ) {$("#error404").effect("shake", { times:3, direction:"down" }, 100).animate({ backgroundColor: "#fff" }, 1000);}
		// If linking to an external link then open in a new window
		$(function() {$('a[href^="http://"]').filter(function(){return this.hostname && this.hostname !== location.hostname; }).addClass("newWindow").click(function(){window.open(this.href);return false;});});
		
		// If there is a rel=external then open in a new window
		$(function() {$('a[rel*=external]').addClass("newWindow").click( function(){window.open(this.href);return false;});});
		
		// If we are opening in a new window then add this to the title tag
		$("a.newWindow").attr("title", $("a.newWindow").attr("title")+" - (This link will open in a new window)");
		
		
		
		// Add email blocking script
		geo();
		
		// Clear any inputs when you click on them
		clearInputs();
		
		// Get me out of this frame script
		if (top.location != location){top.location.href = document.location.href;}
  	 
		// Footer script
		$("#footerTools").html('<li><a href="#top" title="Go to the top of this page" class="top">Top of Page</a></li><li><a href="#nav" title="Skip to navigation" class="navIcon">Skip to navigation</a></li><li><a href="#main" title="Skip to content" accesskey="S" class="main">Skip to main content</a></li><li><a href="#footer" title="Skip to the bottom of the page" accesskey="F" class="bottom">Skip to bottom of the page</a></li><li id="printPage"><a href="javascript:window.print()" title="Print this Page" class="print">Print this Page</a></li><li id="favorites">'+"<a href=\"javascript:bookmarksite('"+document.title+"', '"+location.href+"')\" title=\"Add this page to your favourites\" class=\"favorites\">Add to Favourites</a></li>"+'<li><a href="/" class="home" title="Visit Panayiotis Demopoulos Home Page" accesskey="1">Home</a></li>');

		
		// $.localScroll({hash: true,easing:'easeOutSine'});
		
		
		$('*').tooltip({
			track: true,
			delay: 250,
			showURL: true,
			showBody: " - ",
			fade: 150
		});
		
		// $.easing.easeOutSine = function (x, t, b, c, d) {return c * Math.sin(t/d * (Math.PI/2)) + b;};

		
		// swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes, callbackFn) 
		
		
		swfobject.embedSWF("/media/swf/audioPlayer/playerNew.swf", "media-beethoven", "300", "30", "9.0.0","/media/swf/swfObject/expressInstall.swf", 
				{soundFile:"/media/audio/beethovensonata.mp3"}, 
				{menu:"false", quality:"high",wmode:"transparent"}, 
				{id:"media-beethoven-id",name:"media-beethoven-id",class:"aP"});
		
		swfobject.embedSWF("/media/swf/audioPlayer/playerNew.swf", "media-etor", "300", "30", "9.0.0","/media/swf/swfObject/expressInstall.swf", 
				{soundFile:"/media/audio/etor.mp3"}, 
				{menu:"false", quality:"high",wmode:"transparent"}, 
				{id:"media-etor-id",name:"media-etor-id",class:"aP"});
		
		swfobject.embedSWF("/media/swf/audioPlayer/playerNew.swf", "media-iarilos", "300", "30", "9.0.0","/media/swf/swfObject/expressInstall.swf", 
				{soundFile:"/media/audio/iarilosthing.mp3"}, 
				{menu:"false", quality:"high",wmode:"transparent"}, 
				{id:"media-iarilos-id",name:"media-iarilos-id",class:"aP"});
				
		swfobject.embedSWF("/media/swf/audioPlayer/playerNew.swf", "media-intermezzo", "300", "30", "9.0.0","/media/swf/swfObject/expressInstall.swf", 
				{soundFile:"/media/audio/intermezzo.mp3"}, 
				{menu:"false", quality:"high",wmode:"transparent"}, 
				{id:"media-intermezzo-id",name:"media-intermezzo-id",class:"aP"});
		
		swfobject.embedSWF("/media/swf/audioPlayer/playerNew.swf", "media-winterfarewell", "300", "30", "9.0.0","/media/swf/swfObject/expressInstall.swf", 
				{soundFile:"/media/audio/winterfarewell.mp3"}, 
				{menu:"false", quality:"high",wmode:"transparent"}, 
				{id:"media-winterfarewell-id",name:"media-winterfarewell-id",class:"aP"});
				
				
		// Image does not exist...
		/*$("img").error(function ()
			{
				$(this).unbind("error").attr(
					{
						src: '/images/elements/page.png',
						alt: 'Sorry!  This image is not available!',
						style:'width:16px;height:16px;'
					})
			});
		*/
		
		
		// Hide grid feature
		$('.fullGrid').hide();
		$('.contentGrid').hide();
		
		//top of page script
		 //set the link
  		$('#top-link').topLink({
    		min: 400,
    		fadeSpeed: 500
  		});
  		//smoothscroll
  		$('#top-link').click(function(e) {
    		e.preventDefault();
    		$.scrollTo(0,300);
  		});
		
		// listens for any navigation keypress activity
		$(document).keypress(function(e)
			{
				// cancel if in an input field
				if( $(e.target).is(":input") ) return;
				switch(e.which)
					{
						// user presses the "g" key to show grid
						case 103:	$('.fullGrid').toggle('slow');
						break;
						// user presses the "m" key to show grid for main content
						case 109:	$('.contentGrid').toggle('slow');
						break;
						// user presses the "h" key to show help box
						case 104:	$("#toolBox").fadeTo('1','0.95').animate({top:"0px"}).css("cursor","default");
						break;
					}
				});
		
		var loc_href = window.location.pathname;
    $('#nav a').each(function () {
        if (loc_href == $(this).attr('href')) {
            $(this).addClass('active');
        }
    });
	
	
	});

















