/*
      .-      .-                      .-:::-.`                        
     `NM:    .MM.                     yMMNNMMMmo`                     
     +MMd`   hMMs   .--.`  `..     ...yMM.  .sMMs `--.`     .--.`+.   
     dMMMo  /MMMN` yNmmNMm+-mMd- `yMN/yMM.   :MMysNmmNMm+`sNMmmMMMy`  
    -MMdMN.`mMdMM/ ``.-:yMM-`sMMyNMh. yMMsooyNMm.``.--sMMmMN:  :MMy   
    yMM`yMhyMm`mMd:hNNmdmMM/  /MMMs   yMMdhhyo: .yNNmdmMMNMMo``+MMs   
   `NMy `mMMN- +MMMMh`  /MM/ /NMmMMs` yMM.      NMd`  :MMooMMMMMd+`   
   +MM:  :MM+  .NMMMNo+sNMMsyMN+ -mMm:yMM.      dMNs+smMMmMMdoyyso-   
   +so    +o    +so+syso-/ysso.   `oso+so`       /syyo-:ys+oso++hMM:  
                                                         .dms++odMN.  
                                                         `/oyhhhs/` 
														 
	jQuery NagAds
	Version : 1.0

	Author : PAGNOULLE Maxime (MaxPag)
	http://maxpag.eu
	http://codecanyon.net/user/MaxPag/
 
***************************************************************************/

var SecondsYTRemainNA;
var YouTubeVideoIDNA;

jQuery.NagAds = function(Options) 
{
	// Default Settings
	var Settings = 
	{ 
		// General settings
		'Mode' : 'yt',
		'Delay' : '60',
		'Width' : '1050',
		'Height' : '760',
		'CookieEnabled' : false,
		'CookieExpiration' : '5',
		
		// Styling settings
		'BgColor' : '#000000',
		'BgInnerColor' : '#000000',
		'BorderColor' : '#000000',
		'ShadowColor' : '',
		'BgIMG' : '',
		'BgOpacity' : '0.9',
		'zIndex' : 99,
		
		// Ads settings
		'SWFURL' : 'cclogo.swf',
		'SWFOverLink' : false,
		'YouTubeID' : '',
		'Link' : '',
		'AdsIMG' : 'AdsIMG.gif'	
	};
	
	var PlayerIsOk = false;
	
	if (Options) 
	{ 
		$.extend(Settings, Options);
	}
	
	if(Settings.CookieEnabled)
	{
		if(ReadCookie('NagAdsCookie'))
		{
			return;
		}
	}
	
	function CenterTheBox(DivToCenter) 
	{
		if(Settings.Mode == 'img')
		{
			var IMG = new Image();
			var IMGSrc = Settings.AdsIMG;

			$(IMG).load(function () 
			{
				var posTopOffset, posLeftOffset = '';
					
				posTopOffset = '-' + ((IMG.height / 2) + 7) + 'px';
				
				posLeftOffset = '-' + ((IMG.width / 2) + 7) + 'px';
			
				$(DivToCenter).css(
				{
					'position': 'fixed',
					'left' : '50%', 
					'top' : '50%', 
					'margin-top' : posTopOffset , 
					'margin-left' : posLeftOffset, 
					'z-index' : Settings.zIndex + 1 
				});

			
				$("#AdsZoneNA").css(
				{
					'background-color' : '#000',
					'background-image' : 'url(' + Settings.AdsIMG + ')',
					'width' : IMG.width + 'px',
					'height' : IMG.height + 'px',
					'-webkit-box-shadow' : 'inset 0px 0px 3px',
					'-moz-box-shadow' : 'inset 0px 0px 3px',
					'box-shadow' : 'inset 0px 0px 3px',
					'-webkit-border-radius' : '5px',
					'-moz-border-radius' : '5px',
					'border-radius' : '5px',
					'z-index' : Settings.zIndex + 10						
				});
  				
			delete IMG;
			
			}).error(function () 
			{
   			$(DivToCenter).css(
			{
			 	'position': 'fixed',
				'left' : '50%', 
				'top' : '50%', 
				'margin-top' : 0 , 
				'margin-left' : 0, 
				'z-index' : Settings.zIndex + 1 
			});
				 
			}).attr(
			{ 
				src: IMGSrc
			});
		}
		else if(Settings.Mode == 'yt')
		{
			var posTopOffset, posLeftOffset = '';
					
			posTopOffset = '-' + ((Settings.Height / 2) + 7) + 'px';
				
			posLeftOffset = '-' + ((Settings.Width / 2) + 7) + 'px';
			
			$(DivToCenter).css(
			{
				'position': 'fixed',
				'left' : '50%', 
				'top' : '50%', 
				'margin-top' : posTopOffset , 
				'margin-left' : posLeftOffset, 
				'z-index' : Settings.zIndex + 1 
			});

			
			$("#AdsZoneNA").css(
			{
				'background-color' : '#000000',
				'width' : Settings.Width + 'px',
				'height' : Settings.Height + 'px',
				'-webkit-box-shadow' : 'inset 0px 0px 3px',
				'-moz-box-shadow' : 'inset 0px 0px 3px',
				'box-shadow' : 'inset 0px 0px 3px',
				'-webkit-border-radius' : '5px',
				'-moz-border-radius' : '5px',
				'border-radius' : '5px',
				'z-index' : Settings.zIndex + 10						
			});
		}
		else if(Settings.Mode == 'frame')
		{
			var posTopOffset, posLeftOffset = '';
					
			posTopOffset = '-' + ((Settings.Height / 2) + 22) + 'px';
				
			posLeftOffset = '-' + ((Settings.Width / 2) + 7) + 'px';
			
			$(DivToCenter).css(
			{
				'position': 'fixed',
				'left' : '50%', 
				'top' : '50%', 
				'margin-top' : posTopOffset , 
				'margin-left' : posLeftOffset, 
				'z-index' : Settings.zIndex + 1 
			});

			
			$("#AdsZoneNA").css(
			{
				'background-color' : '#000000',
				'width' : Settings.Width + 'px',
				'height' : Settings.Height + 'px',
				'-webkit-box-shadow' : 'inset 0px 0px 3px',
				'-moz-box-shadow' : 'inset 0px 0px 3px',
				'box-shadow' : 'inset 0px 0px 3px',
				'-webkit-border-radius' : '5px',
				'-moz-border-radius' : '5px',
				'border-radius' : '5px',
				'z-index' : Settings.zIndex + 10						
			});
		}
		else if(Settings.Mode == 'swf')
		{
			var posTopOffset, posLeftOffset = '';
					
			posTopOffset = '-' + ((Settings.Height / 2) + 7) + 'px';
				
			posLeftOffset = '-' + ((Settings.Width / 2) + 7) + 'px';
			
			$(DivToCenter).css(
			{
				'position': 'fixed',
				'left' : '50%', 
				'top' : '50%', 
				'margin-top' : posTopOffset , 
				'margin-left' : posLeftOffset, 
				'z-index' : Settings.zIndex + 1 
			});

			
			$("#AdsZoneNA").css(
			{
				'background-color' : '#000000',
				'width' : Settings.Width + 'px',
				'height' : Settings.Height + 'px',
				'-webkit-box-shadow' : 'inset 0px 0px 3px',
				'-moz-box-shadow' : 'inset 0px 0px 3px',
				'box-shadow' : 'inset 0px 0px 3px',
				'-webkit-border-radius' : '5px',
				'-moz-border-radius' : '5px',
				'border-radius' : '5px',
				'z-index' : Settings.zIndex + 10						
			});
		}
		else
		{
			alert("The mode of use of NagAds is invalid !");
			return;
		}
				
	}
		
	function ShowNagAds()
	{
		if(Settings.Mode == 'img')
		{
			$("body").append("<div id=\"OverMaskNA\"></div><div id=\"LoaderDiv\"><a id=\"LinkNA\" href=\""+ Settings.Link + "\" target=\"_blank=\"></a><div id=\"AdsZoneNA\"></div><div id=\"BottomBarNA\"><span id=\"BarNAText\">This window will close in <span id=\"BarNATimer\">00:00</span></span><a href=\"#\" id=\"SkipNAText\" onclick=\"(function($) { $.HideNagAds(" + Settings.CookieExpiration + "); })(jQuery);\">Close this window >></a></div></div>");

			$("#LinkNA").css(
			{
				'width' : '100%',
				'height' : '100%',
				'position': 'absolute',
				'left' : 0, 
				'top' : -10, 
				'display' : 'inline',
				'z-index' : Settings.zIndex + 100
			});
			
			$("#SkipNAText").css(
			{
				'position': 'absolute',
				'color' : '#FFF',
				'font-size' : '12px',
				'margin' : '7px',
				'right' : 0,
				//'display' : 'block',
				'float' : 'right',
				'cursor' : 'pointer',
				'font-family' : 'Arial',
				'text-shadow' : '0pt 0pt 10px blue, 0pt 0pt 4px green, 0pt 0pt 6px blue'
			});
			
			$("#BarNAText").css(
			{
				'position': 'absolute',
				'left' : 0,
				'color' : '#FFF',
				'font-size' : '12px',
				'margin' : '7px',
				//'display' : 'block',
				'font-family' : 'Arial',
				'text-shadow' : '0pt 0pt 10px orange, 0pt 0pt 4px green, 0pt 0pt 6px orange'
			});
			
			$("#BarNATimer").css(
			{
				'font-weight' : 'bold',
				'color' : '#FFFFFF',
				'text-shadow' : '0pt 0pt 20px orange, 0pt 0pt 4px green, 0pt 0pt 6px orange'
			});
			
			$("#BottomBarNA").hide().css(
			{
				'background-color' : '#000000',
				'width' : '100%',
				'height' : '30px',
				'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'display' : 'none',
				'z-index' : Settings.zIndex + 9999,
				'-webkit-border-top-left-radius' : '3px',
				'-webkit-border-top-right-radius' : '3px',
				'-moz-border-radius-topleft' : '3px',
				'-moz-border-radius-topright' : '3px',
				'border-top-left-radius' : '3px',
				'border-top-right-radius' : '3px',
				'opacity' : '0.8',
   				'-moz-opacity' : '0.8',
    			'-ms-filter' : 'alpha(opacity=80)"',
    			'filter' : 'alpha(opacity=80)',
			  }).delay('1000').slideDown('1000', function() { CountDown(); });
		}
		else if(Settings.Mode == 'yt')
		{
			$("body").append("<div id=\"OverMaskNA\"></div><div id=\"LoaderDiv\"><div id=\"AdsZoneNA\"><div id='YouTubeNA'></div><a id=\"LinkNA\" href=\""+ Settings.Link + "\" target=\"_blank=\"></a></div><div id=\"BottomBarNA\"><span id=\"BarNAText\">This window will close in <span id=\"BarNATimer\">00:00</span></span><a href=\"#\" id=\"SkipNAText\" onclick=\"(function($) { $.HideNagAds(" + Settings.CookieExpiration + "); })(jQuery);\">Close this window >></a></div></div>");
			
			if(Settings.YouTubeID != "")
			{
				 var Params = { allowScriptAccess: "always", wmode:"transparent" };

 				 var Atts = { id: "YTPlayerNA", style: 'z-index: 0' };
			
			 	swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&playerapiid=NagAdsYTPlayer",  "YouTubeNA", Settings.Width, Settings.Height, "8", null, null, Params, Atts);
				YouTubeVideoIDNA = Settings.YouTubeID;
			}
			else
			{
				alert("Please provide a YouTube video ID !");
				return;
			}

			$("#LinkNA").css(
			{
				'background-color' : '#FFF',
				'width' : '100%',
				'height' : '100%',
				'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'display' : 'block',
				'z-index' : Settings.zIndex + 9998,
				'opacity' : '0',
   				'-moz-opacity' : '0',
    			'-ms-filter' : 'alpha(opacity=0)"',
    			'filter' : 'alpha(opacity=0)',
			});
			
			
			$("#BarNAText").css(
			{
				'position': 'absolute',
				'left' : 0,
				'color' : '#FFF',
				'font-size' : '12px',
				'margin' : '7px',
				//'display' : 'block',
				'font-family' : 'Arial',
				'text-shadow' : '0pt 0pt 10px orange, 0pt 0pt 4px green, 0pt 0pt 6px orange'
			});
			
			$("#SkipNAText").css(
			{
				'position': 'absolute',
				'color' : '#FFF',
				'font-size' : '12px',
				'margin' : '7px',
				'right' : 0,
				//'display' : 'block',
				'float' : 'right',
				'cursor' : 'pointer',
				'font-family' : 'Arial',
				'text-shadow' : '0pt 0pt 10px blue, 0pt 0pt 4px green, 0pt 0pt 6px blue'
			});
			
			$("#BarNATimer").css(
			{
				'font-weight' : 'bold',
				'color' : '#FFFFFF',
			});
			
			
			$("#BottomBarNA").hide().css(
			{
				'background-color' : '#000000',
				'width' : '100%',
				'height' : '30px',
				'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'display' : 'none',
				'z-index' : Settings.zIndex + 9999,
				'opacity' : '0.8',
   				'-moz-opacity' : '0.8',
    			'-ms-filter' : 'alpha(opacity=80)"',
    			'filter' : 'alpha(opacity=80)',
			  }).delay('1000').slideDown('1000', function() { CountDownYT(); });
		}
		else if(Settings.Mode == 'frame')
		{
			
			$("body").append("<div id=\"OverMaskNA\"></div><div id=\"LoaderDiv\"><div id=\"AdsZoneNA\"><iframe src=\""+ Settings.Link + "\" width=\"" + Settings.Width + "\" height=\"" + Settings.Height + "\"></iframe></div><div id=\"BottomBarNA\"><span id=\"BarNAText\">This window will close in <span id=\"BarNATimer\">00:00</span></span><a href=\"#\" id=\"SkipNAText\" onclick=\"(function($) { $.HideNagAds(" + Settings.CookieExpiration + "); })(jQuery);\">Close this window >></a></div></div>");
			
			$("#LinkNA").css(
			{
				'width' : '100%',
				'height' : '100%',
				'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'display' : 'inline',
				'z-index' : Settings.zIndex + 100
			});
			
			
			$("#BarNAText").hide().css(
			{
				'position': 'absolute',
				'left' : 0,
				'color' : '#FFF',
				'font-size' : '12px',
				'margin' : '10px',
				//'display' : 'block',
				'display' : 'none',
				'font-family' : 'Arial',
				'text-shadow' : '0pt 0pt 10px orange, 0pt 0pt 4px green, 0pt 0pt 6px orange'
			});
			
			$("#BarNATimer").css(
			{
				'font-weight' : 'bold',
			});
			
			$("#SkipNAText").hide().css(
			{
				'position': 'absolute',
				'color' : '#FFF',
				'font-size' : '12px',
				'margin' : '10px',
				'right' : 0,
				'display' : 'none',
				'float' : 'right',
				'cursor' : 'pointer',
				'font-family' : 'Arial',
				'text-shadow' : '0pt 0pt 10px blue, 0pt 0pt 4px green, 0pt 0pt 6px blue'
			});
			
			$("#BottomBarNA").hide().css(
			{
				'background-color' : 'transparent',
				'width' : '100%',
				'height' : '30px',
				//'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'display' : 'none',
				'z-index' : Settings.zIndex + 9999,
				'opacity' : '0.8',
   				'-moz-opacity' : '0.8',
    			'-ms-filter' : 'alpha(opacity=80)"',
    			'filter' : 'alpha(opacity=80)',
			  }).delay('1000').slideDown('1000', function() { $("#BarNAText, #SkipNAText").fadeIn('slow'); CountDown(); });
			
		}
		else if(Settings.Mode == 'swf')
		{
			if(Settings.SWFOverLink == true)
			{
				$("body").append("<div id=\"OverMaskNA\"></div><div id=\"LoaderDiv\"><div id=\"AdsZoneNA\"><div id='SWFNA'></div><a id=\"LinkNA\" href=\""+ Settings.Link + "\" target=\"_blank=\"></a></div><div id=\"BottomBarNA\"><span id=\"BarNAText\">This window will close in <span id=\"BarNATimer\">00:00</span></span><a href=\"#\" id=\"SkipNAText\" onclick=\"(function($) { $.HideNagAds(" + Settings.CookieExpiration + "); })(jQuery);\">Close this window >></a></div></div>");
			}
			else
			{
				$("body").append("<div id=\"OverMaskNA\"></div><div id=\"LoaderDiv\"><div id=\"AdsZoneNA\"><div id='SWFNA'></div></div><div id=\"BottomBarNA\"><span id=\"BarNAText\">This window will close in <span id=\"BarNATimer\">00:00</span></span><a href=\"#\" id=\"SkipNAText\" onclick=\"(function($) { $.HideNagAds(" + Settings.CookieExpiration + "); })(jQuery);\">Close this window >></a></div></div>");
			}
			
			var Params = { allowScriptAccess: "always", wmode:"transparent" };

 			var Atts = { id: "SWFNA", style: 'z-index: 0' };
			
			swfobject.embedSWF(Settings.SWFURL,  "SWFNA", Settings.Width, Settings.Height, "8", null, null, Params, Atts);

			$("#LinkNA").css(
			{
				'background-color' : '#FFF',
				'width' : '100%',
				'height' : '100%',
				'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'display' : 'block',
				'z-index' : Settings.zIndex + 9998,
				'opacity' : '0',
   				'-moz-opacity' : '0',
    			'-ms-filter' : 'alpha(opacity=0)"',
    			'filter' : 'alpha(opacity=0)',
			});
			
			
			$("#BarNAText").css(
			{
				'position': 'absolute',
				'left' : 0,
				'color' : '#FFF',
				'font-size' : '12px',
				'margin' : '7px',
				//'display' : 'block',
				'font-family' : 'Arial',
				'text-shadow' : '0pt 0pt 10px orange, 0pt 0pt 4px green, 0pt 0pt 6px orange'
			});
			
			$("#SkipNAText").css(
			{
				'position': 'absolute',
				'color' : '#FFF',
				'font-size' : '12px',
				'margin' : '7px',
				'right' : 0,
				//'display' : 'block',
				'float' : 'right',
				'cursor' : 'pointer',
				'font-family' : 'Arial',
				'text-shadow' : '0pt 0pt 10px blue, 0pt 0pt 4px green, 0pt 0pt 6px blue'
			});
			
			$("#BarNATimer").css(
			{
				'font-weight' : 'bold',
				'color' : '#FFFFFF',
			});
			
			
			$("#BottomBarNA").hide().css(
			{
				'background-color' : '#000000',
				'width' : '100%',
				'height' : '30px',
				'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'display' : 'none',
				'z-index' : Settings.zIndex + 9999,
				'opacity' : '0.8',
   				'-moz-opacity' : '0.8',
    			'-ms-filter' : 'alpha(opacity=80)"',
    			'filter' : 'alpha(opacity=80)',
			  }).delay('1000').slideDown('1000', function() { CountDown(); });
		}
		else
		{
			alert("The mode of use of NagAds is invalid !");
			return;
		}
		
		if(Settings.BgIMG == "")
		{ 
			$("#OverMaskNA").css(
			{
				'width' : '100%',
				'height' : '100%',
				'background-color': Settings.BgColor,
				'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'position' : 'fixed',
				"z-index" : Settings.zIndex
			}).fadeTo("slow", Settings.BgOpacity);
		}
		else
		{
			$("#OverMaskNA").css(
			{
				'width' : '100%',
				'height' : '100%',
				'background-image': 'url(' + Settings.BgIMG + ')',
				'position': 'absolute',
				'left' : 0, 
				'top' : 0, 
				'position' : 'fixed',
				"z-index" : Settings.zIndex
			}).fadeTo("slow",  Settings.BgOpacity);
		}
			
			
		CenterTheBox($("#LoaderDiv"));
		
		var Red, Green, Blue;
		
		if(Settings.BorderColor != "")
		{
			Red = HexToRed(Settings.BorderColor);
			Green = HexToGreen(Settings.BorderColor);
			Blue = HexToBlue(Settings.BorderColor);
		}
		else
		{
			Red = 0;
			Green = 0;
			Blue = 0;
		}
			
		$("#LoaderDiv").hide().css(
		{
			'background-color': 'rgba(' + Red + ', ' + Green + ', ' + Blue + ', 0.3)',
			'-moz-background-clip' : 'padding',
			'-webkit-background-clip' : 'padding',
			'background-clip' : 'padding-box',
			'border' : '5px solid rgba(' + Red + ', ' + Green + ', ' + Blue + ', 0.3)',
			'-webkit-border-radius' : '5px',
			'-moz-border-radius' : '5px',
			'border-radius' : '5px',
			'-webkit-box-shadow' : '0px 0px 5px' + Settings.ShadowColor,
			'-moz-box-shadow' : '0px 0px 5px' + Settings.ShadowColor,
			'box-shadow' : '0px 0px 5px' + Settings.ShadowColor, 
			'padding' : '0px'
				
		}).delay('200').fadeIn('slow');
	}
	
	function HexToRed(Value) 
	{ 
		return parseInt((CutDiese(Value)).substring(0,2),16);
	}
	
	function HexToGreen(Value) 
	{ 
		return parseInt((CutDiese(Value)).substring(2,4),16);
	}
	
	function HexToBlue(Value) 
	{ 
		return parseInt((CutDiese(Value)).substring(4,6),16);
	}
	
	function CutDiese(Value) 
	{ 
		return (Value.charAt(0)=="#") ? Value.substring(1,7) : Value;
	}
	
	if(Settings.Mode != "yt")
	{
		var SecondsRemain = Settings.Delay;
	}
	else
	{
		CheckYTDuration = setInterval(function()
		{ 
			if(SecondsYTRemainNA > 0 && SecondsYTRemainNA != '')
			{
				SecondsRemain = Math.floor(SecondsYTRemainNA);
				clearInterval(CheckYTDuration);
			}		
		}, 1000);
	}
	
	function CountDownYT() 
	{
		$(function()
		{
			if(SecondsRemain > 0)
			{
				PlayerIsOk = true;
			}
			
			if(PlayerIsOk == true)
			{
				if (SecondsRemain < 59) 
				{
					
					$("#BarNATimer").html('00:'+ GetSeconds());
				}	 
				else 
				{	
					$("#BarNATimer").html(GetMinutes() + ':' + GetSeconds());
				} 
				if(SecondsRemain < 1)
				{
					$("#LoaderDiv").fadeOut('slow')
					$("#OverMaskNA").delay('300').fadeOut('slow', function() 
					{ 
						$("#OverMaskNA").remove(); 
						$("#LoaderDiv").remove(); 
					});
				}
				else
				{
					setTimeout(CountDownYT, 1000);
				}
			
				SecondsRemain--;
			}
			else
			{
				setTimeout(CountDownYT, 1000);
			}
		});
	}
	
	function CountDown() 
	{
		$(function()
		{
			if (SecondsRemain < 59) 
			{	
				$("#BarNATimer").html('00:'+ GetSeconds());
			}	 
			else 
			{	
				$("#BarNATimer").html(GetMinutes() + ':' + GetSeconds());
			} 
			if(SecondsRemain < 1)
			{
				$.HideNagAds();
			}
			else
			{
				setTimeout(CountDown, 1000);
			}
			
			SecondsRemain--;
		});
	}
	
	function GetMinutes() 
	{
		var Mins = Math.floor(SecondsRemain / 60);
		
		if(Mins < 10)
		{
			Mins = '0' + Mins;
		}
		
		return Mins;
	}
	
	function GetSeconds() 
	{
		var Seconds = SecondsRemain - Math.round(GetMinutes() * 60);
		
		if(Seconds < 10 )
		{
			Seconds = '0' + Seconds;
		}
		
		return Seconds;
	}
	
	$(function()
	{
		ShowNagAds();
	});
	
	// Cookie management functions

	function ReadCookie(Name) 
	{
		var NameE = Name + "=";
		var CA = document.cookie.split(';');
		for(var i = 0;i < CA.length;i++)
		{
			var C = CA[i];
			while (C.charAt(0) ==' ') C = C.substring(1, C.length);
			if (C.indexOf(NameE) == 0) 
			{
				return C.substring(NameE.length, C.length);
			}
		}
		return null;
	}
}

jQuery.HideNagAds = function(Options) 
{	
	var Settings = 
	{ 
		'CookieExpiration' : '5'
	};
	
	if (Options) 
	{ 
		$.extend(Settings, Options);
	}
	
	function CreateCookie(Name, Value, Expire) 
	{
		if (Expire) 
		{
			var DateExpire = new Date();
			DateExpire.setTime(DateExpire.getTime() + (Expire*60*1000));
			var Expires = "; expires=" + DateExpire.toGMTString();
		}
		else 
		{
			var Expires = "";
		}
			
		document.cookie = Name + "=" + Value + Expires + "; path=/";
		return true;
	}
	
	$("#LoaderDiv").fadeOut('slow');
		$("#OverMaskNA").delay('300').fadeOut('slow', function() 
		{ 
			$("#OverMaskNA").remove(); 
			$("#LoaderDiv").remove(); 
			CreateCookie('NagAdsCookie', location.host, Settings.CookieExpiration);
	});

}

//YouTube functions

function PlayerStateChangeNagAds(NewState)
{
	if(NewState == 1)
	{
		GetPlayerInfoNagAds();
	}	  
}
function GetPlayerInfoNagAds() 
{
	if(YTPlayerNA && YTPlayerNA.getDuration) 
	{
		SecondsYTRemainNA = YTPlayerNA.getDuration();
	}
}

onYouTubePlayerReady = function(videoId)
{ 
	YTPlayerNA = document.getElementById('YTPlayerNA');
	YTPlayerNA.addEventListener("onStateChange", "PlayerStateChangeNagAds");
	YTPlayerNA.cueVideoById(YouTubeVideoIDNA);
	YTPlayerNA.playVideo();
}
