//BEGIN load flash video
function LoadVideo(paramFileName){
	  $('#PresenterContainer').show();
      $('#PresenterFlash').html(" ");
      $('#PresenterFlash').flash({
		swf: 'presenter.swf',
		height:330,
		width:300,
		params: {
			wmode:'transparent',
			AllowScriptAccess:'always'},
		flashvars: {   
			videoToLoad: paramFileName,
			playStatus: myPlayStatus,
			preLoadPercent: paramPreLoadingPercent,
			clickLink: paramClickLink,
			endLink: paramEndLink,
			waitTime: paramWaitTime}
		});
	   $('#PresenterFlash').show();
};//END load flash video

function closePresenterOpenForm() {
	$("#PresenterFlash").html(" ");
	$("#PresenterFlash").hide();
	$("#BigForm").show();
	$("#OpenClosePresenter").html("Open Welcome Video");
	$("#OpenClosePresenter").click(function(){
			closeFormOpenPresenter();
			});
};
function closeFormOpenPresenter(){
	$("#BigForm").hide();
	LoadVideo(paramVid);
	$("#PresenterFlash").show();
	$("#OpenClosePresenter").html("Close Welcome Video");
	$("#OpenClosePresenter").click(function(){
			closePresenterOpenForm();
			});
};
function closeForm(){
	$("#BigForm").hide();	
};

//presenter/form positioning
var presenterPositionString = 'bottom:0px;left:20px;';//default value
var formPositoinString = 'bottom:20px;left:20px;';//default value
switch(paramPosition)
{
case 1:
  presenterPositionString = 'top:0px;left:10px;';
  formPositoinString = 'top:20px;left:10px;';
  break;
case 2:
  presenterPositionString = 'top:0px;right:10px;';
  formPositoinString = 'top:20px;right:10px;';
  break;
case 3:
  presenterPositionString = 'bottom:0px;left:10px;';
  formPositoinString = 'bottom:20px;left:10px;';
  break;
case 4:
  presenterPositionString = 'bottom:0px;right:10px;';
  formPositoinString = 'bottom:20px;right:10px;';
  break;
}
//form background
if (paramFormImage == 'default'){
  paramFormImage = 'background-image:url(http://www.netresultsinternational.com/include/big-form-bg.png);' ;
  }

//print div structure
var myScreenAlive=	'<div id="PresenterContainer" style="position:fixed;width:300px;' + presenterPositionString + '">' +
					'	<div id="PresenterFlash" style="height:330px;width:300px;"></div>'+
					'	<div id="OpenClosePresenter" style="'+ paramButtonStyles +'width:300px;cursor:pointer;font-weight:bold;text-align:center;padding:2px 10px;font-size:12px;">Close</div>'+
					'</div>';
					
if (paramBigForm == 'yes'){
  myScreenAlive = myScreenAlive + 
  					'<div id="BigForm" style="height:370px;width:280px;padding:25px 0 0 30px;position:fixed;'+formPositoinString+paramFormImage+'">' +
					'<div id="CallNow" style="margin:0 0 20px 60px;line-height:25px;font-size:25px;font-weight: bold;color:#FFF;">'+paramUserPhone+'</div>'+
					'	<div id="QuickQuoteTitle" style="font-size:22px;position:relative;margin:0 0 5px 50px;line-height:35px;font-weight:bold;color:#FFF;">'+paramFormTitle+'</div>'+
					'	<iframe width="250" height="215" id="myIframe" allowtransparency="true" scrolling="No" frameborder="0" src="http://www.netresultsinternational.com/include/bigqq.aspx?location='+paramUserWebpage+'&amp;url='+paramUserWebsite+'&email='+paramUserEmail+'"></iframe>'+
					'	<div id="CloseBigFormDiv" style="clear:both;text-align: right;padding: 0 35px 0 0;"><img id="CloseBigForm" style="cursor:pointer;" src="http://www.netresultsinternational.com/include/button-close-big-form.gif" width="88" height="21" /></div>'+
					'</div>';
  }

//autoplay
var myPlayStatus=1;
if (paramAutoplay == 'no'){
	myPlayStatus=0;
	}

$(document).ready(function(){
//---BEGIN Big Form Scripts
	$("body").append(myScreenAlive);
	//hide the Big Form when the page loads
	$("#BigForm").hide();
	//prepare the button that closes the big form
	$("#CloseBigForm").click(function(){
		closeForm();
	});
//---END Big Form Scripts	
	//button to open and close the presenter video
    $('#OpenClosePresenter').click(function(){
		closePresenterOpenForm();
    });
	//load the video for the first time
	LoadVideo(paramVid);
});

