// JavaScript Document


var scrollSpeed = 20;       // Speed in milliseconds
var step = 1;               // How many pixels to move per step
var current = 0;            // The current pixel row
var imageHeight = 282;     // Background image height
var headerHeight = 325;     // How tall the header is.

//The pixel row where to start a new loop
var restartPosition = -(imageHeight - headerHeight);

function scrollBg(){
   
    //Go to next pixel row.
    current -= step;
   
    //If at the end of the image, then go to the top.
    if (current == restartPosition){
        current = 0;
    }
		
    //Set the CSS of the header.
    $('#wrapper').css("background-position",+current+"px "+current+"px");
   
}

var scrollSpeed2 = 20;       // Speed in milliseconds
var step2 = 1;               // How many pixels to move per step
var current2 = 0;            // The current pixel row
var imageHeight2 = 282;     // Background image height
var headerHeight2 = 325;     // How tall the header is.

var restartPosition2 = -(imageHeight2 - headerHeight2);

function scrollBg2(){
   
    //Go to next pixel row.
    current2 -= step2;
   
    //If at the end of the image, then go to the top.
    if (current2 == restartPosition2){
        current2 = 0;
    }
		
    //Set the CSS of the header.
    $('#wrapper2').css("background-position",+current2+"px "+current2+"px");
   
}


$(document).ready(function(){
	
	var init = setInterval("scrollBg()",100);
	var init2 = setInterval("scrollBg2()",200);

});



$(document).ready(function(){
	
	$("#mainImage img").css("display","block");

	$('.rotateFlower').rotate({maxAngle:30,minAngle:-30,
	bind:
	[
	{"mouseover":function(){$(this).rotateAnimation(30);}},
	{"mouseout":function(){$(this).rotateAnimation(0);}}
	]
	});

	$('.rotateFashion').rotate({maxAngle:30,minAngle:-30,
	bind:
	[
	{"mouseover":function(){$(this).rotateAnimation(30);}},
	{"mouseout":function(){$(this).rotateAnimation(0);}}
	]
	});


	simple_tooltip(".flickrList a","tooltip");
	simple_tooltip(".newEntryPhoto a","tooltipL");
	
	$(".flickrList a").prettyPhoto();

	$(".photopopImg").css("display","block");
	$(".photopopImg").css("opacity","0");
	
		
	$('#rankingList li').addClass('rankItem');
	$('#rankingList li:eq(0)').prepend('<img src="http://blog.v-colors.com/wp-content/themes/vcolors_v2/images/bgRank1.png" class="rankIcon">');
	$('#rankingList li:eq(1)').prepend('<img src="http://blog.v-colors.com/wp-content/themes/vcolors_v2/images/bgRank2.png" class="rankIcon">');
	$('#rankingList li:eq(2)').prepend('<img src="http://blog.v-colors.com/wp-content/themes/vcolors_v2/images/bgRank3.png" class="rankIcon">');
	$('#rankingList li:eq(3)').prepend('<img src="http://blog.v-colors.com/wp-content/themes/vcolors_v2/images/bgRank4.png" class="rankIcon">');
	$('#rankingList li:eq(4)').prepend('<img src="http://blog.v-colors.com/wp-content/themes/vcolors_v2/images/bgRank5.png" class="rankIcon">');

	$(".newImg,.rankImg").hover(function(){
		$(this).css({'z-index':'10'});
		$(this).find('img').addClass("hover").stop().animate({marginTop:'-60px',marginLeft:'-60px',top:'50%',left:'50%',width:'120px',height:'120px',padding:'0px',opacity:'100'},300);
	},function(){
		$(this).css({'z-index':'0'});
		$(this).find('img').removeClass("hover").stop().animate({marginTop:'0',marginLeft:'0',top:'6px',left:'6px',width:'45px',height:'45px',padding:'0px',opacity:'100'},700);
	});

	$(".entryPhotoItem").hover(function(){
		$(this).css({'z-index':'10'});
		$(this).find('img').addClass("hover").stop().animate({marginTop:'-60px',marginLeft:'-60px',top:'50%',left:'50%',width:'120px',height:'120px',padding:'0px',opacity:'100'},300);
	},function(){
		$(this).css({'z-index':'0'});
		$(this).find('img').removeClass("hover").stop().animate({marginTop:'0',marginLeft:'0',top:'0px',left:'0px',width:'93px',height:'93px',padding:'0px',opacity:'100'},700);
	});


});




