artTimer = setInterval("slideArt(1)",3000);
position = 0;
images = 5;
pause = false;


function closeDOM(id){
	$(id).closeDOMWindow(); 
}
function pausePlay(){
	if (pause){
		artTimer = setInterval("slideArt(1)",3000);
		pause = false;
		$('#playPause').attr("src", "homepagefiles/images/artwork/pause.gif");
	} else{
		clearInterval(artTimer);
		pause = true;
		$('#playPause').attr("src", "homepagefiles/images/artwork/play.gif");
	}	
}
function slideRight(){
	pause = false;
	pausePlay();
	slideArt(1);
}
function slideLeft(){
	pause = false;
	pausePlay();
	slideArt(-1);
}
function slideArt(amount){
	if ( (amount > 1)||(amount < -1) ){
		return false;	
	} else {
		position += amount;	
	}
	if( (position > 50)||(position < -50) ){
		position = 0;
	}
	xval = position*362*-1;
	$('#artwork').stop().animate({ backgroundPosition: ''+xval+'px 0px'},{ duration: 600, easing: 'easeOutCirc'});
}

$(document).ready(function(){
	//Link Tracker
	$('.ct-upperfooter-holder a, .ui-tabs-panel a').click( function (){
			$.ajax({
				url: 'homepagefiles/linktracker.php?url='+$(this).attr('href'),
				async: false,
				cache: false
			});
		   return true;
	});						   
	//Content Slider
	$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 6000, false);
	if($.browser.msie && $.browser.version.substr(0,1)<7){
	   $('#featured .ui-tabs-panel .info').css({backgroundImage : 'none', backgroundColor : '#000'}).fadeTo(0,0.65);
	}
	
	// Useful Links hover effects
	if($.browser.msie && $.browser.version.substr(0,1)<8){
		$('img.ct-upperfooter-banner').hover(function() {
			$(this).parent().parent().css({'z-index' : '100'});										  
			$(this).css({ width: '182px',height: '90px',left: '-27px',top: '-11px'});
		}, function() {
			$(this).parent().parent().css({'z-index' : '0'});	
			$(this).css({ width: '117px',height: '58px',left: '5px',top: '5px'});
		});
	} else {
		$('img.ct-upperfooter-banner').hover(function() {
			$(this).parent().parent().css({'z-index' : '100'});										  
			$(this).stop().animate({ width: '182px',height: '90px',left: '-27px',top: '-11px'},300);
		}, function() {
			$(this).parent().parent().css({'z-index' : '0'});	
			$(this).stop().css({ width: '117px',height: '58px',left: '5px',top: '5px'});
		});
	}
	
	
	// Contact us popup
	$('#ct-menubar-inner-buttoncontactus div a, #contactLink').openDOMWindow({ 
		height:250, 
		width:565, 
		positionType:'centered', 
		eventType:'click', 
		windowSource:'iframe', 
		windowPadding:0, 
		borderColor:'#999999',
		borderSize:3
	});
	

});	

// Preload menu images 
var button_pink_left = new Image();
button_pink_left.src = "homepagefiles/images/left_pink.jpg";
var button_pink_middle = new Image();
button_pink_middle.src = "homepagefiles/images/middle_pink.jpg";
var button_pink_right = new Image();
button_pink_right.src = "homepagefiles/images/right_pink.jpg";

var button_blue_left = new Image();
button_blue_left.src = "homepagefiles/images/left_blue.jpg";
var button_blue_middle = new Image();
button_blue_middle.src = "homepagefiles/images/middle_blue.jpg";
var button_blue_right = new Image();
button_blue_right.src = "homepagefiles/images/right_blue.jpg";
