function generateEmail(p1,p2)
{
	window.location.replace('mailto:'+p1+'@'+p2,false);
}

function gid(name)
    {
      return document.getElementById(name);
    };

    /*-------------------------------------------------------------------
    Player javascript API
    -------------------------------------------------------------------*/
    function sendEvent(swf, typ, prm)
    {
      thisMovie(swf).sendEvent(typ, prm); 
    };

	var currentItem;
	var currentState;
	var startNumber;
	var playingFlag=false;
    function getUpdate(typ, pr1, pr2, swf)
    {
	  if(typ == "item") { currentItem = pr1; }
      if((typ == 'state') && (swf == 'jstest'))
      {
        gid('stateshow').innerHTML = pr1;
      }
      if (typ == 'time')
      {
        gid('time').innerHTML = pr1;
	  }
	  if(swf != "null") {
		if((typ == "state")&&(pr1 != undefined)) { 
			currentState = pr1; 
			if((currentState=="0")&&( ! playingFlag) && (startNumber != '')) {				
				playingFlag = true;
				sendEvent('player', 'playitem',  startNumber); 					
			}
		}
	}
    };

    function loadFile(swf, obj)
    {
      thisMovie(swf).loadFile(obj); 
    };

    function getLength(swf)
    {
      var len = thisMovie(swf).getLength();
      alert('the length of the playlist is: ' + len);
    };

    function addItem(swf, obj, idx)
    {
      thisMovie(swf).addItem(obj, idx);
    };

    function removeItem(swf, idx)
    {
      thisMovie(swf).removeItem(idx);
    };

    function itemData(swf, idx)
    {
      var obj = thisMovie(swf).itemData(idx);
      var txt = "";
      for(var i in obj)
      {
        txt += i + ": " + obj[i] + "\n";
      }
      return obj.title;
    };

    function thisMovie(movieName)
    {
      if(navigator.appName.indexOf("Microsoft") != -1)
      {
        return window[movieName];
      }
      else
      {
        // return gid(movieName);
        return document[movieName];
      }
    };
	
function createPlayer(theFile, arg)
{
	startNumber=arg;
	var so = new SWFObject("/mediaplayer.swf", "player", "860", "386", "8", "#FFFFFF");
	so.addVariable("file", theFile);
	//so.addVariable("image", "");
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','true');
	so.addVariable("displayheight", "386");
	so.addVariable("displaywidth", "680");
	so.addVariable("thumbsinplaylist", "true");
	so.addVariable("shuffle", "false");
	so.addVariable("autoscroll", "true");
	so.addVariable("overstretch", "false");
	so.addVariable("showdigits", "true");
	so.addVariable("callback", "http://www.paragonmediaone.com/blog/wordpress/wp-content/plugins/wordtube/wordtube-statistics.php");
	so.addVariable("backcolor", "0xFFFFFF");
	so.addVariable("frontcolor", "0x14156F");
	so.addVariable("lightcolor", "0x0C0C48");
	so.addVariable("volume", "80");
	so.addVariable("bufferlength", "5");
	so.addVariable("width", "860");
	so.addVariable("height", "386");
	so.addVariable('javascriptid','player');
	so.addVariable('enablejs','true');
	so.addVariable('usefullscreen','false');
	so.addVariable("autostart", "false");
	so.addParam("wmode", "transparent");
	so.write("vidplayer");	
}

var MorphList = new Class({   
	
	Implements: [Events, Options],
	
	options: {/*             
		onClick: $empty,
		onMorph: $empty,*/
		bg: { 'class': 'background', 'html': '<div class="inner"></div>' },
		morph: { 'link': 'cancel' }
	},
	
	initialize: function(menul, options) {
		var that = this;
		this.setOptions(options);
		var menu = $(menul);
		var menuitems = menu.getChildren();
		menuitems.addEvents({
			mouseenter: function(){ that.morphTo(this); },
			mouseleave: function(){ that.morphTo(that.current); },
			click: function(ev){ that.click(ev, this); }
		});       
		this.bg = new Element('li', this.options.bg).inject(menu).fade('hide').set('morph', this.options.morph);
		this.setCurrent(menu.getElement('.current'));
	},          

	click: function(ev, item) {
		this.setCurrent(item, true);
		this.fireEvent('click', [ev, item]);
	},
	
	setCurrent: function(el, effect){  
		if(el && ! this.current) {
			this.bg.set('styles', { left: el.offsetLeft, width: el.offsetWidth, height: el.offsetHeight, top: el.offsetTop });
			(effect) ? this.bg.fade('in') : this.bg.fade('show');
		}
		if(this.current) this.current.removeClass('current');
		if(el) this.current = el.addClass('current');    
		return this;
	},         
         
	morphTo: function(to) {
		if(! this.current) return false; 
		this.bg.morph({ left: to.offsetLeft, top: to.offsetTop, width: to.offsetWidth, height: to.offsetHeight });
		this.fireEvent('morph', to);
		return this;
	}

});

window.addEvent('domready', function()
{
	var sliderMenu = new MorphList($('menu_list'), {transition: Fx.Transitions.Quad.easeInOut, duration: 50, link: 'cancel'});
});

