var n__bannerSource = '';n__bannerSource = '/static/images/widget/banners/general/250x250_ely_cherry.jpg';var n__isMobile = false;n__isMobile = true;
function n__addEventListener( n__element, n__event_name, n__observer, n__capturing ) 
{
	if ( n__element.addEventListener )  // the DOM2, W3C way
		{  n__element.addEventListener( n__event_name, n__observer, n__capturing );  }
	else if ( n__element.attachEvent )  // the IE way
		{  n__element.attachEvent( "on" + n__event_name, n__observer );  }
}
function n__urlEncodeString(n__stringToDo)
{	
	//parse what was sent as a string
	n__stringToDo = String(n__stringToDo);

	//first convert common MS characters...blah
	n__stringToDo = n__stringToDo.replace(/\u2018|\u2019|\u201e/gi, "'"). //single quote
								  replace(/\u201c|\u201d|\u201a/gi, '"'). //double quote
								  replace(/\u2026/gi, '...'). //triple dots
								  replace(/\u2022/gi, '*'). //bullet
								  replace(/\u2013/gi, '-'). //endash
								  replace(/\u2014/gi, '--'). //emdash
								  replace(/\u02dc/gi, '~'). //tilde
								  replace(/\u2122/gi, '(TM)'); //trademark
	
	if(window.encodeURIComponent)
	{
		n__stringToDo = encodeURIComponent(n__stringToDo); //does not encode ~!*()'
		n__stringToDo = n__stringToDo.replace(/\~/gi, "%7E").//encodeURIComponent does not handle @*/+
									  replace(/\!/gi, "%21").
									  replace(/\*/gi, "%2A").
									  replace(/\(/gi, "%28").
									  replace(/\)/gi, "%29").
									  replace(/\'/gi, "%27");
	}
	else
	{
		n__stringToDo = escape(n__stringToDo); //first url encode it
		n__stringToDo = n__stringToDo.replace(/\+/gi, "%2b").//escape does not handle @*/+
									  replace(/\//gi, "%2F").
									  replace(/\*/gi, "%2A").
									  replace(/\@/gi, "%40");
	}
	return n__stringToDo;
}

function n__getJordFootprintImage(n__campaignSlug)
{
	//fire jord buyer footprint request
	var n__param = '?noCache=' + (new Date()).getTime();	
		n__param += "&href="+n__urlEncodeString(window.location.href);
		n__param += "&campaignSlug="+n__urlEncodeString(n__campaignSlug);
		n__param += "&referrer=";
		n__param += "&widget=1";

	var n__jordFootprintImage = document.createElement('img');

	n__jordFootprintImage.src = "//www.woodwatches.com/requests/request.buyerFootprint.php" + n__param;
	n__jordFootprintImage.style.textDecoration = "none";
	n__jordFootprintImage.style.border = "none";
	n__jordFootprintImage.style.padding = "0px";
	n__jordFootprintImage.style.margin = "0px";
	n__jordFootprintImage.style.lineHeight = "0px";
	n__jordFootprintImage.style.height = "0px";
	n__jordFootprintImage.style.width = "0px";
	try {n__jordFootprintImage.style.maxWidth = "none";} catch(err){}
	try {n__jordFootprintImage.style.minWidth = "none";} catch(err){}
	try {n__jordFootprintImage.style.maxHeight = "none";} catch(err){}
	try {n__jordFootprintImage.style.minHeight = "none";} catch(err){}

	return n__jordFootprintImage;
}
function n__getGoogleImage()
{
	var n__googleImage = document.createElement('img');

	n__googleImage.src = "//googleads.g.doubleclick.net/pagead/viewthroughconversion/974227349/?value=0&label=fJyrCMPA7AoQlY_G0AM&guid=ON&script=0";
	n__googleImage.style.textDecoration = "none";
	n__googleImage.style.border = "none";
	n__googleImage.style.padding = "0px";
	n__googleImage.style.margin = "0px";
	n__googleImage.style.lineHeight = "0px";
	n__googleImage.style.height = "0px";
	n__googleImage.style.width = "0px";
	try {n__googleImage.style.maxWidth = "none";} catch(err){}
	try {n__googleImage.style.minWidth = "none";} catch(err){}
	try {n__googleImage.style.maxHeight = "none";} catch(err){}
	try {n__googleImage.style.minHeight = "none";} catch(err){}

	return n__googleImage;
}

function n__getFacebookImage()
{
	var n__facebookImage = document.createElement('img');

	n__facebookImage.src = "https://www.facebook.com/tr?id=872142092827065&ev=PixelInitialized";
	n__facebookImage.style.textDecoration = "none";
	n__facebookImage.style.border = "none";
	n__facebookImage.style.padding = "0px";
	n__facebookImage.style.margin = "0px";
	n__facebookImage.style.lineHeight = "0px";
	n__facebookImage.style.height = "0px";
	n__facebookImage.style.width = "0px";
	try {n__facebookImage.style.maxWidth = "none";} catch(err){}
	try {n__facebookImage.style.minWidth = "none";} catch(err){}
	try {n__facebookImage.style.maxHeight = "none";} catch(err){}
	try {n__facebookImage.style.minHeight = "none";} catch(err){}

	return n__facebookImage;
}

var n__woodWatchesAnimatedWidget = 
{
	n__widgetSlug : "browneyedbellejulie",
	n__widgetWidth : 800,
	n__widgetHeight : 250,

	n__mainDiv : null,
	n__backgroundImage : document.createElement('img'),
	n__googleImage : null,
	n__facebookImage : null,
	n__jordFootprintImage : null,
	
	n__foregroundWrap : document.createElement('div'),
	n__foregroundPositiveMovement : false,
	n__foregroundImage : document.createElement('img'),
	
	n__foregroundWrapWidth : 592,
	n__foregroundMargin : 0,
	n__foregroundWidth : 4086,
	n__foregroundMovementDuration : 25,
	n__foregroundMovementAmount : 3,
	
	n__animationTimer : null,
	n__linkUrl : "http://www.woodwatches.com",
	
	//handle resizing of all values
	n__resize : function()
	{
		//reset all of the values first
		this.n__widgetWidth = 800;
		this.n__widgetHeight = 250;
		this.n__foregroundWrapWidth = 592;
		this.n__foregroundMargin = 0;
		this.n__foregroundWidth = 4086;
		this.n__foregroundMovementDuration = 25;
		this.n__foregroundMovementAmount = 3;
		
		//min 200
		this.n__widgetWidth = Math.max(200, this.n__mainDiv.offsetWidth);
		
		//max width is 800
		this.n__widgetWidth = Math.min(800, this.n__widgetWidth);

		//set height
		this.n__widgetHeight = parseInt(((this.n__widgetWidth * 250)/800));

		//calculate foreground widths
		this.n__foregroundMargin = 0;
		this.n__foregroundWidth = parseInt((this.n__foregroundWidth*(this.n__widgetWidth/800)));
		this.n__foregroundMovementDuration = parseInt((this.n__foregroundMovementDuration*(this.n__widgetWidth/800)));
		this.n__foregroundMovementAmount = Math.max(1, parseInt((this.n__foregroundMovementAmount*(this.n__widgetWidth/800))));
		this.n__foregroundWrapWidth = parseInt((this.n__foregroundWrapWidth*(this.n__widgetWidth/800)));

		this.n__backgroundImage.style.width = this.n__widgetWidth + "px";
		this.n__backgroundImage.style.height = this.n__widgetHeight + "px";

		this.n__foregroundWrap.style.width = this.n__foregroundWrapWidth + "px";
		this.n__foregroundWrap.style.height = this.n__widgetHeight + "px";
		this.n__foregroundWrap.style.marginTop = "-" + this.n__widgetHeight + "px";

		this.n__foregroundImage.style.width =  this.n__foregroundWidth + "px";
		this.n__foregroundImage.style.height = this.n__widgetHeight + "px";

		//hiding image
			try
			{
				if(parseInt(this.n__mainDiv.getAttribute('ishidden')) == 1)
				{
					try{this.n__backgroundImage.style.maxWidth = "1px";}catch(err){}
					try{this.n__backgroundImage.style.minWidth = "1px";}catch(err){}
					try{this.n__backgroundImage.style.maxHeight = "1px";}catch(err){}
					try{this.n__backgroundImage.style.minHeight = "1px";}catch(err){}
					this.n__backgroundImage.style.height = '1px';
					this.n__backgroundImage.style.width = '1px';
					this.n__backgroundImage.style.display = 'none';
					this.n__backgroundImage.style.visibility = 'hidden';
					
					try {this.n__foregroundImage.style.maxWidth = "1px";} catch(err){}
					try {this.n__foregroundImage.style.minWidth = "1px";} catch(err){}
					try {this.n__foregroundImage.style.maxHeight = "1px";} catch(err){}
					try {this.n__foregroundImage.style.minHeight = "1px";} catch(err){}
					this.n__foregroundImage.style.height = '1px';
					this.n__foregroundImage.style.width = '1px';
					this.n__foregroundImage.style.display = 'none';
					this.n__foregroundImage.style.visibility = 'hidden';
					
					try {this.n__mainDiv.style.maxWidth = "1px";} catch(err){}
					try {this.n__mainDiv.style.minWidth = "1px";} catch(err){}
					try {this.n__mainDiv.style.maxHeight = "1px";} catch(err){}
					try {this.n__mainDiv.style.minHeight = "1px";} catch(err){}
					this.n__mainDiv.style.height = '1px';
					this.n__mainDiv.style.width = '1px';
					this.n__mainDiv.style.visibility = 'hidden';
				}
			}catch(err){}

	
		//start the animation
		this.n__startAnimation();
	},

	n__startAnimation : function()
	{
		clearInterval(this.n__animationTimer);

		this.n__animationTimer = setInterval(function()
		{
			//if we are moving negatively, and we reached the max width, switch to positive
			if(n__woodWatchesAnimatedWidget.n__foregroundPositiveMovement == false &&
			   n__woodWatchesAnimatedWidget.n__foregroundMargin <= (-1*n__woodWatchesAnimatedWidget.n__foregroundWidth) + n__woodWatchesAnimatedWidget.n__foregroundWrapWidth)
			{
				n__woodWatchesAnimatedWidget.n__foregroundPositiveMovement = true;
			}
			//if we have reached positive max
			else if(n__woodWatchesAnimatedWidget.n__foregroundPositiveMovement == true &&
					n__woodWatchesAnimatedWidget.n__foregroundMargin >= 0)
			{
				n__woodWatchesAnimatedWidget.n__foregroundPositiveMovement = false;
			}

			//move 10 pixels every click
			if(n__woodWatchesAnimatedWidget.n__foregroundPositiveMovement)
			{
				n__woodWatchesAnimatedWidget.n__foregroundMargin += n__woodWatchesAnimatedWidget.n__foregroundMovementAmount;
			}
			else
			{
				n__woodWatchesAnimatedWidget.n__foregroundMargin -= n__woodWatchesAnimatedWidget.n__foregroundMovementAmount;
			}


			n__woodWatchesAnimatedWidget.n__foregroundImage.style.marginLeft = n__woodWatchesAnimatedWidget.n__foregroundMargin + "px";
		}, n__woodWatchesAnimatedWidget.n__foregroundMovementDuration);
	},
	n__init : function()
	{
		try
		{		
			//main background image
			this.n__mainDiv = document.getElementById("woodwatches_com_widget");
						
			//add campaign hash
			if(this.n__widgetSlug != "")
			{
				this.n__linkUrl += "#" + this.n__widgetSlug;
			}

			//background image
				this.n__backgroundImage.src = "//www.woodwatches.com/static/images/widget/jord-wood-watches-widget-background.jpg";
				
				//hidden image
				try
				{
					if(parseInt(this.n__mainDiv.getAttribute('ishidden')) == 1)
					{
						this.n__backgroundImage.src = "";
						this.n__backgroundImage.style.display = "none";
					}
				}catch(err){}

				this.n__backgroundImage.style.textDecoration = "none";
				this.n__backgroundImage.style.border = "none";
				this.n__backgroundImage.style.padding = "0px";
				this.n__backgroundImage.style.margin = "0px";
				this.n__backgroundImage.style.fontSize = "0px";
				this.n__backgroundImage.style.lineHeight = "0px";
				try{this.n__backgroundImage.style.maxWidth = "none";}catch(err){}
				try{this.n__backgroundImage.style.minWidth = "none";}catch(err){}
				try{this.n__backgroundImage.style.maxHeight = "none";}catch(err){}
				try{this.n__backgroundImage.style.minHeight = "none";}catch(err){}
						
			//main div
				this.n__mainDiv.style.overflow = 'hidden';
				this.n__mainDiv.style.display = 'block';
				this.n__mainDiv.style.cursor = 'pointer';
				this.n__mainDiv.style.padding = "0px";
				this.n__mainDiv.style.margin = "0px";
				this.n__mainDiv.style.fontSize = "0px";
				this.n__mainDiv.style.lineHeight = "0px";
				this.n__mainDiv.target = "_blank";
				this.n__mainDiv.style.textDecoration = "none";
				this.n__mainDiv.style.border = "none";
				try {this.n__mainDiv.style.maxWidth = "none";} catch(err){}
				try {this.n__mainDiv.style.minWidth = "none";} catch(err){}
				try {this.n__mainDiv.style.maxHeight = "none";} catch(err){}
				try {this.n__mainDiv.style.minHeight = "none";} catch(err){}
				
				if(this.n__mainDiv.tagName == "A")
				{
					this.n__mainDiv.href = this.n__linkUrl;
				}
				else
				{
					this.n__mainDiv.onclick = function()
					{
						window.location.href = n__woodWatchesAnimatedWidget.n__linkUrl;
						return false;
					}
				}
				this.n__mainDiv.appendChild(this.n__backgroundImage);

			//foreground wrap
				this.n__foregroundWrap.style.overflow = 'hidden';
				this.n__foregroundWrap.style.padding = "0px";
				this.n__foregroundWrap.style.margin = "0px";
				this.n__foregroundWrap.style.lineHeight = "0px";
				this.n__foregroundWrap.style.position = "absolute";
				this.n__foregroundWrap.style.textAlign = "left";
				try {this.n__foregroundWrap.style.maxWidth = "none";} catch(err){}
				try {this.n__foregroundWrap.style.minWidth = "none";} catch(err){}
				try {this.n__foregroundWrap.style.maxHeight = "none";} catch(err){}
				try {this.n__foregroundWrap.style.minHeight = "none";} catch(err){}
				this.n__mainDiv.appendChild(this.n__foregroundWrap);
				this.n__foregroundWrap.appendChild(this.n__foregroundImage);

			//foreground slider image
				this.n__foregroundImage.src = "//www.woodwatches.com/static/images/widget/jord-wood-watches-slider.jpg";
				
				//hidden image
				try
				{
					if(parseInt(this.n__mainDiv.getAttribute('ishidden')) == 1)
					{
						this.n__foregroundImage.src = "";
						this.n__foregroundImage.style.display = "none";
					}
				}catch(err){}

				this.n__foregroundImage.style.padding = "0px";
				this.n__foregroundImage.style.margin = "0px";
				this.n__foregroundImage.style.lineHeight = "0px";
				this.n__foregroundImage.style.textDecoration = "none";
				this.n__foregroundImage.style.border = "none";
				this.n__foregroundImage.style.position = "absolute";
				try {this.n__foregroundImage.style.maxWidth = "none";} catch(err){}
				try {this.n__foregroundImage.style.minWidth = "none";} catch(err){}
				try {this.n__foregroundImage.style.maxHeight = "none";} catch(err){}
				try {this.n__foregroundImage.style.minHeight = "none";} catch(err){}			
			
			//google image
				this.n__googleImage = n__getGoogleImage();
				this.n__mainDiv.appendChild(this.n__googleImage);
			
			//facebook image
				this.n__facebookImage = n__getFacebookImage();
				this.n__mainDiv.appendChild(this.n__facebookImage);

			//jord buyer footprint image
				this.n__jordFootprintImage = n__getJordFootprintImage(this.n__widgetSlug);
				this.n__mainDiv.appendChild(this.n__jordFootprintImage);
			
			//resize & start animation
				this.n__resize();
			
			//handle resize only if resize of browser occurs
				n__addEventListener( window, "resize", function(){n__woodWatchesAnimatedWidget.n__resize();}, false);

			
		}catch(err){};
	}
};

var n__woodWatchesStaticWidget = 
{
	n__widgetSlug : "browneyedbellejulie",
	n__widgetMaxWidth : 250,
	n__widgetMaxHeight : 250,

	n__divWrap : null,
	n__image : document.createElement('img'),
	n__jordFootprintImage : null,
	n__googleImage : null,
	n__facebookImage : null,
	
	n__linkUrl : "http://www.woodwatches.com",
	
	n__init : function()
	{
		try
		{		
			//main background image
			this.n__divWrap = document.getElementById("woodwatches_com_widget");
			
			//add campaign hash
			if(this.n__widgetSlug != "")
			{
				this.n__linkUrl += "#" + this.n__widgetSlug;
			}

			//main image
				this.n__image.src = "//www.woodwatches.com/"+n__bannerSource;
				
				//hidden image
				try
				{
					if(parseInt(this.n__mainDiv.getAttribute('ishidden')) == 1)
					{
						this.n__image.src = "";
						this.n__image.style.display = "none";
					}
				}catch(err){}

				this.n__image.style.textDecoration = "none";
				this.n__image.style.border = "none";
				this.n__image.style.padding = "0px";
				this.n__image.style.margin = "0px";
				this.n__image.style.fontSize = "0px";
				this.n__image.style.lineHeight = "0px";
				this.n__image.style.maxWidth = "none";
				try {this.n__image.style.minWidth = "none";}catch(err){}
				try {this.n__image.style.maxHeight = "none";}catch(err){}
				try {this.n__image.style.minHeight = "none";}catch(err){}
				try {this.n__image.style.width = "100%";}catch(err){}

			//main div wrap
				this.n__divWrap.style.overflow = 'hidden';
				this.n__divWrap.style.display = 'block';
				this.n__divWrap.style.cursor = 'pointer';
				this.n__divWrap.style.textDecoration = "none";
				this.n__divWrap.style.border = "none";
				this.n__divWrap.style.padding = "0px";
				this.n__divWrap.style.margin = "0px";
				this.n__divWrap.style.fontSize = "0px";
				this.n__divWrap.style.lineHeight = "0px";
				this.n__divWrap.style.width = '100%';
				this.n__divWrap.style.height = '100%';
				try {this.n__divWrap.style.maxWidth = this.n__widgetMaxWidth + 'px';}catch(err){};
				try {this.n__divWrap.style.minWidth = "none";}catch(err){};
				try {this.n__divWrap.style.maxHeight = this.n__widgetMaxHeight + 'px';}catch(err){};
				try {this.n__divWrap.style.minHeight = "none";}catch(err){};				
				this.n__divWrap.target = "_blank";

				//if tag name
				if(this.n__divWrap.tagName == "A" || this.n__divWrap.tagName == "a")
				{
					this.n__divWrap.href = this.n__linkUrl;
				}
				else
				{
					this.n__divWrap.onclick = function()
					{
						window.location.href = n__woodWatchesStaticWidget.n__linkUrl;
						return false;
					}
				}
				this.n__divWrap.appendChild(this.n__image);

			//hiding image
			try
			{
				if(parseInt(this.n__divWrap.getAttribute('ishidden')) == 1)
				{
					this.n__image.style.display = 'none';

					try {this.n__divWrap.style.maxWidth = "1px";}catch(err){};
					try {this.n__divWrap.style.minWidth = "1px";}catch(err){};
					try {this.n__divWrap.style.maxHeight = "1px";}catch(err){};
					try {this.n__divWrap.style.minHeight = "1px";}catch(err){};	
					this.n__divWrap.style.height = '1px';
					this.n__divWrap.style.width = '1px';					
					this.n__divWrap.style.visibility = 'hidden';	
				}
			}catch(err){}


			//google image
				this.n__googleImage = n__getGoogleImage();
				this.n__divWrap.appendChild(this.n__googleImage);
			
			//facebook image
				this.n__facebookImage = n__getFacebookImage();
				this.n__divWrap.appendChild(this.n__facebookImage);

			//jord buyer footprint image
				this.n__jordFootprintImage = n__getJordFootprintImage(this.n__widgetSlug);
				this.n__divWrap.appendChild(this.n__jordFootprintImage);

			
		}catch(err){};
	}
};

var n__woodWatchesGiveawayWidget = 
{
	n__init : function()
	{
		
	}
};

n__woodWatchesStaticWidget.n__init();