﻿ns4 = document.layers;
ie4 = document.all;
nn6 = document.getElementById && !document.all; 

var playVideo = "";

function HelicosVideoaddMarkup() {
	bod 				= document.getElementsByTagName('body')[0];
	overlay 			= document.createElement('div');
	overlay.id			= 'overlay';
	bod.appendChild(overlay);
}

function HelicosVideosizePopup(el,cover){
  if (ns4) {
    var dlg = el;
    var cvr = cover;
    cvr.style.width = Math.round((document.body.clientWidth))+"px";
    cvr.style.height = Math.round((document.body.clientHeight)+document.body.scrollTop)+"px";
    dlg.style.top = Math.round((document.body.clientHeight/2)-(dlg.offsetHeight/2)+document.body.scrollTop)+"px";
    dlg.style.left = Math.round((document.body.clientWidth/2)-(dlg.offsetWidth/2))+"px";
  }
  else if (ie4) {
    var dlg =  document.all[el];
    var cvr = document.all[cover];
    cvr.style.width =  Math.round((document.body.clientWidth))+"px";
    cvr.style.height = Math.round((document.body.clientHeight)+document.body.scrollTop)+"px";  
    dlg.style.top = Math.round((document.body.clientHeight/2)-(dlg.offsetHeight/2)+document.body.scrollTop)+"px";
    dlg.style.left = Math.round((document.body.clientWidth/2)-(dlg.offsetWidth/2))+"px";
  }
  else if (nn6) {
    var cvr = document.getElementById(cover);
    var dlg = document.getElementById(el);
    cvr.style.width = Math.round((document.body.clientWidth))+"px";
    cvr.style.height =  Math.round((document.body.clientHeight)+document.documentElement.scrollTop)+"px";
    dlg.style.top = Math.round((document.body.clientHeight/2)-(dlg.offsetHeight/2)+document.documentElement.scrollTop)+"px";
    dlg.style.left = Math.round((document.body.clientWidth/2)-(dlg.offsetWidth/2))+"px";
  }
}

function HelicosVideoShowPopUp(el,cover,video,divTitle,videoTitle) {
  HelicosVideoaddMarkup();
 
  if (ns4) {
    var cvr = cover;
    var dlg = el;
    var title = divTitle;
    title.innerHTML = videoTitle;
    dlg.style.left = "-4000px;"
    cvr.style.display = "block";
    dlg.style.display = "block";
    if (document.body.style.overflow = "hidden") {
        cvr.style.width = "100%";
        cvr.style.height = "100%";
    }
  }
  else if (ie4) {
    var cvr = document.all[cover];
    var dlg =  document.all[el];
    var title =  document.all[divTitle];
    title.innerHTML = videoTitle;
    dlg.left = "-4000px;"
    cvr.style.display = "block";
    dlg.style.display = "block";
   	HelicosVideoprepareIE('100%', 'hidden');
  }
  else if (nn6) {
   var cvr = document.getElementById(cover);
   var dlg = document.getElementById(el);
   var title = document.getElementById(divTitle);
   title.innerHTML = videoTitle;
   dlg.style.left = "-4000px;"
   cvr.style.display = "block";
   dlg.style.display = "block";
    if (document.body.style.overflow = "hidden") {
        cvr.style.width = "100%";
        cvr.style.height = "100%";
    }
   }
   HelicosVideosizePopup(el,cover);
   playVideo = video;
   //sdfg
   setTimeout("loadVideo()",1000);
}
		
// Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox
function HelicosVideoprepareIE(height, overflow){
	bod = document.getElementsByTagName('body')[0];
	bod.style.height = height;
	bod.style.overflow = overflow;

	htm = document.getElementsByTagName('html')[0];
	htm.style.height = height;
	htm.style.overflow = overflow; 
}
function HelicosVideoClosePopUp(el,cover) {
    var cvr = document.getElementById(cover);
    var dlg = document.getElementById(el);
    cvr.style.display = "none";
    dlg.style.display = "none";
    document.body.style.overflowY = "scroll";
    unloadVideo();
}

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    }
    else {
		if (document[movieName].length != undefined) {
			return document[movieName][1];
		} else {
			return document[movieName];
		}
	}
};

function loadVideo() {
   thisMovie("vtest").playVideo(playVideo,skinPath);
};
function unloadVideo() {
    thisMovie("vtest").stopVideo(true);
};


