﻿var TextFader = {
	
	options: {
		startDelay: 1000,
		textDelay: 500
	},
	
	init: function(elems, opts) {
		
		this.setOptions(opts || {});
		
		this.elems = $$(elems).set("opacity", 0).setStyle("display", "block");
		
		this.show.delay(this.options.startDelay, this);
		
		return this;
	},
	
	show: function() {
		
		var elems = $$(this.elems),
			delay = this.options.textDelay;
		
		// cascade them in
		for (i = 0, l = elems.length; i < l; i++) {			
			(function(el) {
				el.fade("in");
			}).delay(i * delay, this, elems[i]);			
		}
		
		// announce all are shown
		(function() {
			this.fireEvent("complete");
		}).delay(delay, this);
		
	}
	
};

Object.append(TextFader, new Events());
Object.append(TextFader, new Options());


function hcpConfirmCancel() {
    jQuery("#hcp-confirm").fadeOut();
    return false;
}
function isHCP(url) {
    var ret = false;
    jQuery("#hcp-confirm").fadeIn();
    return ret;
}

//var HcpDialog = {
//	
//	shown: false,
//	
//	init: function() {
//		
//		this.wrap = document.id("hcp-confirm");
//		this.content = document.id("hcp-confirm-body");		
//		
//		this.fx = new Fx.Tween(this.wrap, {
//			link: "cancel",
//			property: "opacity"
//		}).set(0);
//		
//		this.bound = {
//			show: this.show.bind(this),
//			hide: this.hide.bind(this),
//			
//			fxHide: function() {
//				this.wrap.hide();
//			}.bind(this)
//		};

//		this.element = document.id("hcpToggle")
//			.addEvent("click", function(e) {
//			e.preventDefault();			
//			this.toggle();
//		}.bind(this));
//		
//		this.closeBtn = this.content.getElement(".cancelBtn")
//			.addEvent("click", function(e) {
//				e.preventDefault();
//				this.hide();
//			}.bind(this));
//		
//		
//	},
//	
//	toggle: function() {
//		this[this.shown ? "hide" : "show"]();
//		
//		return this;
//	},
//	
//	show: function() {
//		
//		this.wrap.show();
//		
//		this.fx.removeEvents("complete").start(1);
//		
//		this.shown = true;
//		
//		return this;
//	},
//	
//	hide: function() {
//		
//		this.fx.removeEvents("complete").addEvent("complete", this.bound.fxHide).start(0);
//		
//		this.shown = false;
//		
//		return this;
//		
//	}
//	
//};
//window.addEvent("domready", function() {
//   HcpDialog.init();
//});
function videoOnLoad(i) {
    //franca video
    if (i == 2) {
        s.linkTrackVars = 'prop6,eVar1,events'; s.prop6 = "Video-Franca"; s.eVar1 = "Video-Franca"; s.linkTrackEvents = 'event5'; s.events = 'event5'; (s.tl(this, 'o', 'video-franca'));
    }

    //tv video
    if (i == 3) {
        s.linkTrackVars = 'prop27,eVar14,events'; s.prop27 = "Video-TV-Commercial"; s.eVar14 = "Video-TV-Commercial"; s.linkTrackEvents = 'event12'; s.events = 'event12'; (s.tl(this, 'o', 'video-tv-commercial'));
    }
    if (i == 4) {
        s.linkTrackVars = 'prop33,eVar19,events'; s.prop33 = "Video-Beauty_Conversations"; s.eVar19 = "Video-Beauty_Conversations"; s.linkTrackEvents = 'event30'; s.events = 'event30'; (s.tl(this, 'o', 'video-beauty_conversations'));
    }
}
function videoOnPlay(i) {

    //how sculptra works
    if (i == 1) {
        s.linkTrackVars = 'prop25,eVar11,events'; s.prop25 = "Video-Moo"; s.eVar11 = "Video-Moo"; s.linkTrackEvents = 'event6'; s.events = 'event6'; (s.tl(this, 'o', 'video-moo'));
    }
}
function videoOnStop(i) {

    //how sculptra works
    if (i == 1) {
        spotlight('how137');
    }
    //franca video
    if (i == 2) {
        spotlight('scu161');
    }
    //tv video
    if (i == 3) {
        spotlight('sculp872');
    }
}
