


function getAge()
{
   if ( !Cookie.find('gt_age') ) {
      return "UNKNOWN";
   } else {
     return Cookie.get('gt_age'); 
   }
}

var displayVideoName;
var displayCaption;
var displayHeight;
var displayWidth;
function displayVideo(videoName,caption,height,width)
{	
	
   if (height == null) {
	   height = 0;
   }	   
   if (width == null) {
	   width = 0;
   }	   
   displayVideoName = videoName;
   displayCaption = caption;
   displayHeight = height;
   displayWidth = width;
   var screenHeight;
   var screenWidth;
   var popupLeftPos;
   var popupTopPos;
   var age = getAge();  
   
   screenHeight = screen.height;
   screenWidth = screen.width;
   if (screenHeight == null ) {
	   screenHeight = 0;
   }	   
   if (screenWidth == null ) {
	   screenWidth = 0;
   }	   
   popupTopPos = (screenHeight/2) - 130;
   popupLeftPos = (screenWidth/2) - 160;
   agePath = window.location.href.substring(0,window.location.href.lastIndexOf("/"));
   if (window.location.href.toLowerCase().indexOf("gametap.com") > -1) {
	   document.domain="gametap.com";
   }	   
   if (window.location.href.toLowerCase().indexOf("turner.com") > -1) {
	   document.domain="turner.com";
   }	   
   if (age == "UNKNOWN") { 
      window.open(agePath+"/age_gate_popup.html","ageGate","left="+popupLeftPos+",top="+popupTopPos+",status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,height=260,width=320");
   } else if (age < 13) {   
	  window.open(agePath+"/age_gate_deny_popup.html","ageGate","left="+popupLeftPos+",top="+popupTopPos+",status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,height=260,width=320");
   }  else {
	   loadVideo();
   }
 }

 function loadVideo() {
	 var objLink = document.createElement('a');
	   objLink.setAttribute('href',displayVideoName);
	   objLink.setAttribute('rel','lightbox');
	   objLink.setAttribute('title',displayCaption);
	   if(typeof displayWidth != 'undefined') {
	      objLink.setAttribute('width',displayWidth);
	   }
	   if(typeof displayHeight != 'undefined') {
	      objLink.setAttribute('height',displayHeight);
	   }
	   Lightbox.prototype.start(objLink);
	 
	 
 }