/* ============================================================
 required : jquery.js                                          
          : AC_RunActiveContent.js                             
============================================================ */

/*-------------------------------------------------------------
 ready?                                                        
-------------------------------------------------------------*/
$(function(){
  pid = $('body').attr('id').replace('-page','');
  $('body').removeClass('nojs');
  common.imageSwap('div.extra a img');
});

/*-------------------------------------------------------------
 common                                                       
-------------------------------------------------------------*/
var common = {

  insertFlash:function(target,item,w,h,arg,bgcolor){
    var target = $(target);
    var code = this.getFlashCode(item,w,h,arg,bgcolor);
    target.append(code);
  },

  replaceFlash:function(target,item,w,h,arg,bgcolor){
    var target = $(target);
    var code = this.getFlashCode(item,w,h,arg,bgcolor);
    target.html(code);
  },

  getFlashCode : function(item,w,h,arg,bgcolor){
    if(!bgcolor) var bgcolor = '#000000';
    var isPlayable = DetectFlashVer(8,0,0);
    if(isPlayable){
      var code = AC_FL_RunContent(
        'src',item,
        'movie',item,
        'width',w,
        'height',h,
        'FlashVars', arg,
        'quality','best',
        'play','true',
        'base','.',
        'bgcolor',bgcolor,
        'wmode','transparent',
        'allowScriptAccess','always',
        'pluginspage','http://www.macromedia.com/go/getflashplayer',
        'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'
      );
      return code;
      code = '';
    }
    else return;
  },

  linkToPopup : function(target,w,h,scr,id){
    var conf  = 'width='+w+',height='+h+',menubar=no,toolbar=no,location=no,status=no,resizable=no,scrollbars='+scr;
    var name  = id || '';
    $(target).click(function(){
      var target = $(this).attr('href');
      common.popupOpen(target,name,conf);
      return false;
    });
  },

  popupOpen : function(target,name,conf){
    window.open(target,name,conf);
  },

  imageSwap : function(target){
    $(target).hover(
    function(){
      $(this).attr('src',$(this).attr('src').replace('.png','-ov.png'));
      $(this).attr('src',$(this).attr('src').replace('.jpg','-ov.jpg'));
      $(this).attr('src',$(this).attr('src').replace('.gif','-ov.gif'));
    },
    function(){
      $(this).attr('src',$(this).attr('src').replace('-ov.png','.png'));
      $(this).attr('src',$(this).attr('src').replace('-ov.jpg','.jpg'));
      $(this).attr('src',$(this).attr('src').replace('-ov.gif','.gif'));
    });
  }

}
