/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 9/11/2008
 * @author Ariel Flesler
 * @version 1.4
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);


// SCROLLER DEFAULTS 
jQuery(function( $ ){

		
	//by default, the scroll is only done vertically ('y'), change it to both.
	$.scrollTo.defaults.axis = 'xy'; 			
	
	//this one is important, many browsers don't reset scroll on refreshes
	$('div.pane').scrollTo( 0 );//reset all scrollable panes to (0,0)
	$.scrollTo( 0 );//reset the screen to (0,0)
	

	
	
	//Target examples bindings
	var $paneTarget2 = $('#video_selection');		
	
	$('#scroll_up').click(function(){
		$paneTarget2.stop().scrollTo( {top:'-=456', left:'+=0'}, 500 );
	});
	
	
	$('#scroll_down').click(function(){				
		$paneTarget2.stop().scrollTo( {top:'+=456', left:'+=0'}, 500 );
	});	
	


	//Target examples bindings
	var $paneTarget = $('#calendar_dates_area');		
	
	$('#cal_p_reset').click(function(){
		$paneTarget.stop().scrollTo( {top:'=0 px', left:'+=0'}, 500 );
	});
	
	$('#cal_p_down').click(function(){
		$paneTarget.stop().scrollTo( {top:'-=282px', left:'+=0'}, 500 );
	});	
	$('#cal_p_up').click(function(){				
		$paneTarget.stop().scrollTo( {top:'+=282px', left:'+=0'}, 500 );
	});	
	
	
	//Target examples bindings
	var $paneTarget3 = $('#products_container');			
	
	$('#scroll_right').click(function(){
		$paneTarget3.stop().scrollTo( {left:'+=600'}, 500 );
	});
	
	$('#scroll_left').click(function(){				
		$paneTarget3.stop().scrollTo( {left:'-=600'}, 500 );
	});
	

	
});







// WINDOW OPEN
var myWindow;

function openCenteredWindow(url) {
    var width = 500;
    var height = 510;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "scrollbars=yes, width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open(url, "subWind", windowFeatures);
}

function openBiog(url) {   
	var width = 900;
    var height = 800;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "scrollbars=yes, width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open(url, "subWind", windowFeatures);
}

//drop down redirect 

function goto(form) { 
var redirect_url =document.getElementById('artist_jump').value;
if (redirect_url != "0" && redirect_url != "--") {
javascript:window.open(redirect_url, 'artist_window');}
}


function sendToClipboard(s)
{
	if( window.clipboardData && clipboardData.setData )
	{
	clipboardData.setData("Text", s);
	}else{
		alert("Could not copy, this only works in Internet Explorer, sorry.");
	}
}



// No Conflict

var J = jQuery.noConflict();

jQuery(function( $ ){
	
	$(document).ready(function(){
		$("#news_tick").newsTicker();
		$('#news_tick').fadeIn("slow");
		$('#news_tick_desc').fadeIn("slow");
		
		$("#banner_7").corner("round 10px");
		$("#banner_8").corner("round 10px");
		$("#banner_9").corner("round 10px");

		$("img.roundpic").fadeTo("slow", 1.0);

		$(".roundpic").mouseenter(function(){
			
			$(this).fadeTo("fast", 0.6);
		
		}).mouseleave(function(){	
			$(this).fadeTo("slow", 1);
	
		});



	});
});
