// JavaScript Document

function writeECard(swffile, swfw, swfh, container, loadMethod, userBrowser, userVersion) {
	
	var htmlMake;
	var thisBrowser = navigator.userAgent;
	var flashDelay  = (thisBrowser.indexOf("Safari") != -1) ? 200 : 0;
	
	// Safari needs a delay when using innerHTML modifications or
	// the flash wont show up until an event such as onmouseover
	// occurs on the page. This is silly.
	if (userBrowser == 'FF' && userVersion == '2' && userOS == 'Macintosh'){
		//alert('here');
		switch(container) {
		default:
			document.write('<img src="/images/ecards/explantion_1.jpg" alt="" border="0" width="' + swfw + '" height="' + swfh + '"/>' + "\n");	
		break;
		case "card_4":
			document.write('<img src="/images/ecards/explantion_1.jpg" alt="" border="0" width="' + swfw + '" height="' + swfh + '"/>' + "\n");
		break;
		case "card_1":
			document.write('<img src="/images/ecards/invitation_2.jpg" alt="" border="0" width="' + swfw + '" height="' + swfh + '"/>' + "\n");
		break;
		case "card_2":
			document.write('<img src="/images/ecards/accusation_3.jpg" alt="" border="0" width="' + swfw + '" height="' + swfh + '"/>' + "\n");
		break;
		case "card_3":
			document.write('<img src="/images/ecards/declaration_4.jpg" alt="" border="0" width="' + swfw + '" height="' + swfh + '"/>' + "\n");
		break;		
		} // ! switch (loadMethod)	
	}else{
		switch(loadMethod) {
		default:
		// The default method is by changing innerHTML on a DIV container
			htmlMake = '<object width="' + swfw + '" height="' + swfh + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">' + "\n"
				 + '<param name="movie" value="' + swffile + '" />' + "\n"
				 + '<param name="wmode" value="transparent" />' + "\n"
				 + '<embed src="' + swffile + '" width="' + swfw + '" height="' + swfh + '" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>' + "\n"
				 + '</object>' + "\n";
		
		// Load the innerHTML with or without timeout depending on flashDelay
		setTimeout( function() { document.getElementById(container).innerHTML = htmlMake; }, flashDelay);
		break;
		case "docwrite":
			document.write('<object width="' + swfw + '" height="' + swfh + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">' + "\n"
				 + '<param name="movie" value="' + swffile + '" />' + "\n"
				 + '<param name="wmode" value="transparent" />' + "\n"
				 + '<embed src="' + swffile + '" width="' + swfw + '" height="' + swfh + '" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>' + "\n"
			   + '</object>' + "\n");
		break;
		} // ! switch (loadMethod)	
	}
} // ! writeFlash

function writeFlashPreview(swffile, swfw, swfh, container, loadMethod) {

  var htmlMake;
  var thisBrowser = navigator.userAgent;
  var flashDelay  = (thisBrowser.indexOf("Safari") != -1) ? 200 : 0;

  // Safari needs a delay when using innerHTML modifications or
  // the flash wont show up until an event such as onmouseover
  // occurs on the page. This is silly.

  switch(loadMethod) {
  default:
  // The default method is by changing innerHTML on a DIV container
    htmlMake = '<object width="' + swfw + '" height="' + swfh + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">' + "\n"
  	         + '<param name="movie" value="' + swffile + '" />' + "\n"
  	         + '<param name="wmode" value="transparent" />' + "\n"
  	         + '<embed src="' + swffile + '" width="' + swfw + '" height="' + swfh + '" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>' + "\n"
             + '</object>' + "\n";

    // Load the innerHTML with or without timeout depending on flashDelay
    setTimeout( function() { document.getElementById(container).innerHTML = htmlMake; }, flashDelay);
  break;
  case "docwrite":
  document.write('<object width="' + swfw + '" height="' + swfh + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">' + "\n"
	         + '<param name="movie" value="' + swffile + '" />' + "\n"
	         + '' + "\n"
	         + '<embed src="' + swffile + '" width="' + swfw + '" height="' + swfh + '" " pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>' + "\n"
           + '</object>' + "\n");
  break;
  } // ! switch (loadMethod)

} // ! writeFlash
