var showDownloadScreen = window.location.querystring["show"];
if (showDownloadScreen!=undefined) {
	if (showDownloadScreen=="Stream:%20Directions%20Webinar") {
		setTimeout(startMovie,1500);
	} else if (showDownloadScreen=="Download:%20documents/GIS%20WhitePaper.pdf") {
		setTimeout(showPDF,1500);
	}
}
// Set the 'subjectLine' value to whatever you need
var subjectLine = "";
function setSubjectLine(f) {
	document.getElementById("subjectLine").setAttribute("value", subjectLine);
}

// functions for controlling the picture enlargement and the auto-playback of the movie
function showPictureStack(theObject,theSize) {
	var theLayer = document.getElementById(theObject);

	if(theSize) {
		theLayer.style.top = "170px";
		theLayer.style.left = "0px";
		theLayer.style.padding = "3px";
		theLayer.style.border = "1px solid #CCCCCC";
		MM_effectAppearFade_Stack(theLayer, 500, 0, 100, false);
	} else {
		MM_effectAppearFade_Stack(theLayer, 500, 100, 0, false);
		setTimeout(delayedStackMove,500);
	} 
}
function showPictureStackNoOffset(theObject,theSize) {
	var theLayer = document.getElementById(theObject);

	if(theSize) {
	    theLayer.style.top = "150px";
	    //theLayer.style.left = "0px";
		theLayer.style.textalign = "center";
		theLayer.style.padding = "3px";
		theLayer.style.border = "1px solid #CCCCCC";

		MM_effectAppearFade_Stack(theLayer, 500, 0, 100, false);
	} else {
		MM_effectAppearFade_Stack(theLayer, 500, 100, 0, false);
		setTimeout(delayedStackMove,500);
	} 
}
function delayedStackMove() {
	var theLayer = document.getElementById("enlargement");
	theLayer.style.top = "-1000px";
}
function MM_effectAppearFade_Stack(targetElement, duration, from, to, toggle) {
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}	

function showForm(theSize,theSubjectLine) {
	
	//if (theSubjectLine!=null) {
		subjectLine = theSubjectLine;
	//}
	
	var theLayer = document.getElementById("theForm");
	var theLayerExitButton = document.getElementById("formExitButton");
	var theMatte = document.getElementById("flvPlayerBack");
	theMatte.style.zIndex = 1;
	theLayer.style.zIndex = 2;
	theLayerExitButton.style.zIndex = 3;
	
	if ((isIE) && (getInternetExplorerVersion()==6.0)) {
		theMatte.style.width = screen.width - 25;
		theMatte.style.height = screen.height + 50;
	} else {
		theMatte.style.width = "100%"; 
		theMatte.style.height = "110%";
	}
	
	if(theSize) {
		theLayer.style.top = "-225px";
		theLayer.style.left = "195px";
		theMatte.style.top = "0px";
		theMatte.style.left = "0px";
		
		MM_effectAppearFade_Form(theLayer, 500, 0, 100, false);
		MM_effectAppearFade_Form(theMatte, 500, 0, 70, false);
	} else {
		MM_effectAppearFade_Form(theLayer, 500, 100, 0, false);
		MM_effectAppearFade_Form(theMatte, 500, 70, 0, false);
		setTimeout(delayedFormMove,500);
	} 
}
function delayedFormMove() {
	var theLayer = document.getElementById("theForm");
	theLayer.style.top = "-1000px";
	var theMatte = document.getElementById("flvPlayerBack");
	theMatte.style.width = "1%";
	theMatte.style.height = "1%";
}
function MM_effectAppearFade_Form(targetElement, duration, from, to, toggle) {
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}	
function startMovie() {
	selectVideo(8);
	showDownloadScreen = "";
}
function showPDF() {
	window.open('documents/GIS WhitePaper.pdf');
	showDownloadScreen = "";
}
function getInternetExplorerVersion() {
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
