/*  
	Description: Scripts for the Eye Buy Art theme for EyeBuyArt.com
	Version: 1.0
	Author: Jonathan Gallivan
	Author URI: http://jonathangallivan.com/
	Date created: Oct 23, 2009
	Date modified: Oct 23, 2009
*/

// FUNCTION: initialise(): initialises site functions
function initialise() {
	/*(function($){
		$('a.signin').click(function() {
			$('#signinbox').toggle(300);
			return false;
		});
	})(jQuery);
	(function($){
		$('#signinbox').hide(0);
	})(jQuery);*/
	(function($){
		$(document).ready(function() {
			// Pre-load essential images
			var myimages=new Array()
			function preloadimages() {
				for (i=0; i<preloadimages.arguments.length; i++) {
					myimages[i] = new Image();
					myimages[i].src=preloadimages.arguments[i];
				}
			}
			preloadimages("/wp-content/themes/bp-eyebuyart/_inc/images/nav-text-eye.png", "/wp-content/themes/bp-eyebuyart/_inc/images/nav-text-buy.png", "/wp-content/themes/bp-eyebuyart/_inc/images/nav-text-art.png", "/wp-content/themes/bp-eyebuyart/_inc/images/throbber.gif", "/wp-content/themes/bp-eyebuyart/_inc/images/scale-chart.png");
			// Initialise the quote system
			//$('div.tagline').quovolver();
			$(".nav-button").fadeTo("slow", 0.3);
			$(document).ready(function() {
				$(".nav-button").hover(function() { $(this).fadeTo("fast", 1.0); },function() { $(this).fadeTo("fast", 0.3); });
			});
			$('#nav li[rel]').each(function() {
				var pageLink = $(this).attr('class');
				if (pageLink == "art") {
					pageLink = "art/artists";
				}
				$(this).qtip( {
					content: { text: '<a href="/' + pageLink + '"><img class="nav-text" src="/wp-content/themes/bp-eyebuyart/_inc/images/nav-text-' + $(this).attr('class') + '.png" alt="eye" width="80" height="80" border="0" />' + $(this).attr('rel') + '</a>' },
					position: { corner: { target: 'rightMiddle', tooltip: 'leftMiddle' }, adjust: { screen: true } },
					show: { when: 'mouseover', solo: true },
					hide: { fixed: true },
					style: { padding: 5, margin: 5, tip: true, border: { width: 0, radius: 4, color: '#bee2e4' }, name: 'light', width: 450 }
				})
			});
			$('#eye-nav a[rel]').each(function() {
				$(this).qtip( {
					content: { text: "<img class=\"throbber\" src=\"/wp-content/themes/bp-eyebuyart/_inc/images/throbber.gif\" alt=\"Loading...\" />", url: $(this).attr('rel') },
					position: { corner: { target: 'bottomMiddle', tooltip: 'topMiddle' }, adjust: { screen: true } },
					show: { when: 'mouseover', solo: true },
					hide: { fixed: true },
					style: { padding: 5, margin: 5, tip: true, border: { width: 0, radius: 4, color: '#bee2e4' }, name: 'light', width: 300 }
				})
			});
			$('#scale-chart a[rel]').each(function() {
				$(this).qtip( {
					content: { text: '<img src="/wp-content/themes/bp-eyebuyart/_inc/images/scale-chart.png" alt="Scale Chart" width="500" height="280" border="0" />' + $(this).attr('rel') },
					position: { corner: { target: 'topLeft', tooltip: 'rightBottom' }, adjust: { screen: true } },
					show: { when: 'mouseover', solo: true },
					hide: { fixed: true },
					style: { padding: 5, margin: 5, tip: true, border: { width: 0, radius: 4, color: '#bee2e4' }, name: 'light', width: 550 }
				})
			});
			$('#fyi a[rel]').each(function() {
				$(this).qtip( {
					content: { text: $(this).attr('rel') },
					position: { corner: { target: 'topLeft', tooltip: 'rightMiddle' }, adjust: { screen: true } },
					show: { when: 'mouseover', solo: true },
					hide: { fixed: true },
					style: { padding: 5, margin: 5, tip: true, border: { width: 0, radius: 4, color: '#bee2e4' }, name: 'light', width: 250 }
				})
			});
			$('#share-this a[rel]').each(function() {
				$(this).qtip( {
					content: { text: $(this).attr('rel') },
					position: { corner: { target: 'topLeft', tooltip: 'rightMiddle' }, adjust: { screen: true } },
					show: { when: 'mouseover', solo: true },
					hide: { fixed: true },
					style: { padding: 5, margin: 5, tip: true, border: { width: 0, radius: 4, color: '#bee2e4' }, name: 'light', width: 250 }
				})
			});
		});
	})(jQuery);
	function popUpWindow(url) {
		alert("hi");
		params  = 'width=' + screen.width;
		params += ', height=' + screen.height;
		params += ', top=0, left=0'
		params += ', fullscreen=yes';
		newwin = window.open(url, 'pop-up-window', params);
		if (window.focus) {
			newwin.focus();
		}
		return false;
	}
}