
jQuery(document).ready(function(){
	
	adpaper = Raphael(document.getElementById("neprinol-ad-canvas"), jQuery("#neprinol-ad-canvas").width(), jQuery("#neprinol-ad-canvas").height());
	
	ad_reflect = adpaper.image("http://www.neprinol.org/wp-content/themes/MyProduct/images/neprinol-ad/neprinol-bottom.png", -12, 68, 84, 130);
	ad_reflect.scale(.6,.6);
	ad_reflect.onAnimation(function(){
		ad_reflect.attr("y",(Math.abs(ad_reflect.attr("rotation")) / 3.5) + 92);
	});
	
	ad_bottle = adpaper.image("http://www.neprinol.org/wp-content/themes/MyProduct/images/neprinol-ad/neprinol-top.png", -12, -28, 84, 163);
	ad_bottle.scale(.6,.6);
	ad_bottle.onAnimation(function(){
		ad_bottle.attr("y",((Math.abs(ad_bottle.attr("rotation")) / 3.5) * -1) + 2);
	});
	
	ad_text = adpaper.image("http://www.neprinol.org/wp-content/themes/MyProduct/images/neprinol-ad/buynow-text.png", 240, 40, 170, 43);
	
	setTimeout("startAd()", 2000);
});

function startAd(){
	jQuery("#neprinol-ad-canvas").animate({"opacity":"1"},{duration: 100,
		complete: function(){
			ad_text.animate({x:58}, 100, "linear", function(){
				ad_bottle.animate({rotation:-7,x:-2}, 40, ">", function(){
					ad_bottle.animate({rotation:6,x:9}, 120, "<>", function(){
						ad_bottle.animate({rotation:-4,x:2}, 100, "<>", function(){
							ad_bottle.animate({rotation:2,x:6}, 80, "<>", function(){
								ad_bottle.animate({rotation:0,x:5}, 50, "<>");
							});
						});
					});
				});
				ad_reflect.animate({rotation:7,x:-2}, 40, ">", function(){
					ad_reflect.animate({rotation:-6,x:9}, 120, "<>", function(){
						ad_reflect.animate({rotation:4,x:2}, 100, "<>", function(){
							ad_reflect.animate({rotation:-2,x:6}, 80, "<>", function(){
								ad_reflect.animate({rotation:0,x:5}, 50, "<>");
							});
						});
					});
				});
			});
		}
	});
	
}
