/* Copyright: ----------------------------------------------------------------------------------------------------------------------------------------
PrimoThemes.com, WebSharks Inc. ( http://www.primothemes.com/ )
-- Modifications: ------------------------------------------------------------------------------------------------------------------------------------
You are authorized to make any necessary modification(s) to our products to fit your purposes.
However, you may NOT re-distribute or release any modifications as GPL or otherwise.
You are also NOT allowed to delete our credit text from the top of this file.
-- Unauthorized Use: ---------------------------------------------------------------------------------------------------------------------------------
You may not place any of our products, modified or unmodified, on a diskette, CD, website or any other
medium and offer them for re-distribution or re-sale of any kind without prior written consent.
--------------------------------------------------------------------------------------------------------------------------------------------------- */
/*
This function inserts cross-browser compatible object/embed code for flash files.
Ex: jQuery.iFlash({movie: 'movie.swf', width: '300', height: '300'});
*/
(function(jQuery)
 {
  jQuery.iFlash = function(options)
   {
    var defaults = {movie: '', width: '', height: '', wMode: '', bgColor: '', flashVars: '', menu: '', scale: '', idName: 'iFlash-'+Math.round (0+Math.random () * (10000000-0)), version: '9', quality: 'high', swLiveConnect: 'true', allowScriptAccess: 'always', returnCode: false};
    /**/
    options = jQuery.extend (defaults, options);
    /**/
    var code = '<object id="'+options.idName+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+options.version+'" width="'+options.width+'" height="'+options.height+'" swliveconnect="'+options.swLiveConnect+'">';
    code += '<param name="movie" value="'+options.movie+'">';
    code += '<param name="quality" value="'+options.quality+'">';
    code += '<param name="wmode" value="'+options.wMode+'">';
    code += '<param name="scale" value="'+options.scale+'">';
    code += '<param name="menu" value="'+options.menu+'">';
    code += '<param name="bgcolor" value="'+options.bgColor+'">';
    code += '<param name="flashvars" value="'+options.flashVars+'">';
    code += '<param name="allowscriptaccess" value="'+options.allowScriptAccess+'">';
    code += '<embed name="'+options.idName+'" src="'+options.movie+'" flashvars="'+options.flashVars+'" width="'+options.width+'" height="'+options.height+'" quality="'+options.quality+'" pluginspage="//www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="'+options.wMode+'" scale="'+options.scale+'" menu="'+options.menu+'" bgcolor="'+options.bgColor+'" allowscriptaccess="'+options.allowScriptAccess+'" swliveconnect="'+options.swLiveConnect+'"></embed>';
    code += '</object>';
    /**/
    if (options.movie && options.width && options.height)
     {
      if (options.returnCode)
       {
        return code;
       }
      else
       {
        document.write (code);
       }
     }
    else if (options.returnCode)
     {
      return '';
     }
   };
 })(jQuery);