/** Called when the user click the first order demo button */
var priv_popupElement;

function orderDemo(elementId,formId) {
	priv_popupElement=$(elementId);
	priv_formId=formId;
$('fade1').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade2').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade3').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade4').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade5').fade({ duration: 0.5, from: 1, to: 0.5 });
   priv_popupElement.style.display='block';
}

function orderPriceDemo(topOffset) {
	priv_popupElement=$('orderContainer');
	priv_formId='orderForm';
   $('fade1').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade2').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade3').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade4').fade({ duration: 0.5, from: 1, to: 0.5 });
   priv_popupElement.style.display='block';
   priv_popupElement.style.top=topOffset;
}

/** Called when the user click the second order demo button. (The button located on the popup itself) */
function doOrderDemo() {
  new Ajax.Request('./getDemo.php',
  {
    method:'post',
  	parameters: $(priv_formId).serialize(true),
    onSuccess: function(transport){
      var response = transport.responseText;
		alert(response);
		doClose();
    },
    onFailure: function(){ alert('Something went wrong...') }
  });
}

function closeFrontpagePlayer() {
  $('frontpageVideoContainer').style.display='none';	
  $('fade1').fade({ duration: 0, from: 0.5, to: 1 });
   $('fade2').fade({ duration: 0, from: 0.5, to: 1 });
   $('fade3').fade({ duration: 0, from: 0.5, to: 1 });
   $('fade4').fade({ duration: 0, from: 0.5, to: 1 });
   $('fade5').fade({ duration: 0, from: 0.5, to: 1 });

}

function doClose() {
  $('fade1').fade({ duration: 0, from: 0.5, to: 1 });
   $('fade2').fade({ duration: 0, from: 0.5, to: 1 });
   $('fade3').fade({ duration: 0, from: 0.5, to: 1 });
   $('fade4').fade({ duration: 0, from: 0.5, to: 1 });
   $('fade5').fade({ duration: 0, from: 0.5, to: 1 });
   priv_popupElement.style.display='none';
}

function showFrontpageVideo() {
$('fade1').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade2').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade3').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade4').fade({ duration: 0.5, from: 1, to: 0.5 });
   $('fade5').fade({ duration: 0.5, from: 1, to: 0.5 });

  $('frontpageVideoContainer').style.display='block';	
}


