//This implements the interaction between flash file
//(implemented with OBJECT, EMBED or sometimes java in the browser)
//and the javascript and its stuff (variables and form elements)
//
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function card_DoFSCommand(command, args) {
  var cardObj = InternetExplorer ? card : window.document.card;
  // Place your code here...
  //
  if ((command == "pluginversion") && (args == "flash4"))
  {
	  alert("Vc nao possui um plugin do Flash adequado...")
  }//if
  if (command == "post_flash_vars")
  {
	//alert(args)
	post_flashvars(args)
	//window.document.form1.flash_vars.value = args
	//document.form1.mensagem.value = document.form1.flash_vars.value.substring(document.form1.flash_vars.value.indexOf("msg=") + 4, document.form1.flash_vars.value.length)
  }//if
  //Cartao do SAPO
  if ((command == "sapo_shake") && (args == "window"))
  {
	cartao_sapo()
	/*
	shake_ram(40,10,window)
	shake_ram(25,7,window.opener)
	window.focus()
	alert("Seu computador foi infectado com o virus  $!&Format!@HDC:8*666_plus.\nDeseja remove-lo?")
	cardObj.Play();
	return false;
	*/
  }//if
  //Cartao da BRINCADEIRINHA
  if ((command == "openwindow") && (args == "1"))
  {
    cartao_brincadeirinha()
	/*
	window.open('../images/cartoes/3_datas/04abr/mentira_brincadeirinha/brincadeirinha.html', 'brinca', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=550,height=300,top=2,left=2')
	return false;
	*/
  }//if
}//card_DoFSCommand

// Hook for Internet Explorer 
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub card_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call card_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}

//Function to work WITHOUT fs_command
//Some flash plugins (MAC) do NOT understand fs_command
//so we call "get_url:javascript:post_flashvars(...)" in SWF
function post_flashvars(args)
{
	window.document.form1.flash_vars.value = args
}//post_flashvars


// Here are all functions called by flash files with "FSCommand"
// Shake the Screen (with three parameters)
function shake_ram(shakes, vibration, win)
{
    for (i = shakes; i > 0; i--) {
        win.moveBy(i, vibration);
        win.moveBy(-i, -vibration);
    }
}

function cartao_sapo()
{
	shake_ram(40,10,window)
	if(window.opener!=null)
		shake_ram(25,7,window.opener)
	window.focus()
	alert("Seu computador foi infectado com o virus  $!&Format!@HDC:8*666_plus.\nDeseja remove-lo?")
	//cardObj.Play();
}//cartao_sapo

function cartao_brincadeirinha()
{
	window.open('../images/cartoes/3_datas/04abr/mentira_brincadeirinha/brincadeirinha.html', 'brinca', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=550,height=300,top=2,left=2')
}//cartao_brincadeirinha
