function consoleobj() {
    this.log = function(x){
        //alert(x);
    }
}

if(typeof(console) == "undefined"){
    var console = new consoleobj();
}

function $(id){return document.getElementById(id); }

function $body(){ return document.getElementsByTagName('body')[0]; }

function addEvent(el, evname, func){
    try{
        if(el.attachEvent){
            el.attachEvent('on'+evname, func);
        } else if(el.addEventListener){
            el.addEventListener(evname, func, true);
        } else {
            el['on'+evname] = func;
        }
    } catch (error){}
}

function redirect(url){
    var href = document.getElementsByTagName('base')[0].href;
    window.location = href+url;
}

function popup(url,height,width) {
	newwindow=window.open(url,'name','height='+height+',width='+width+', toolbar=0, directories=0, location=0, status=1, scrollbars=1, resizeable=0');
	if (window.focus)
		newwindow.focus();
	else
		return false;
}

var _videoPlayer;
function showVideoClip(filename, playnow){ 
    if(!_videoPlayer){
	_initVideoPlayer(filename);
	_videoPlayer = getFlashMovieObject('smallplayer');
    }
    if(filename != ''){
	try{_videoPlayer.loadVideo(filename, playnow);}catch(e){}
    }
}
function _initVideoPlayer(filename){
        if (AC_FL_RunContent == 0) {
	    alert("This page requires AC_RunActiveContent.js.");
	} else {
	    AC_FL_RunContent(
                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
                'width', '300',
                'height', '261',
                'src', 'resource/smallplayer',
                'quality', 'high',
                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
                'align', 'middle',
                'play', 'true',
                'loop', 'true',
                'scale', 'exactfit',
                'wmode', 'transparent',
                'devicefont', 'false',
                'id', 'smallplayer',
                'bgcolor', '#000000',
                'name', 'smallplayer',
                'menu', 'true',
                'allowFullScreen', 'true',
                'allowScriptAccess','sameDomain',
                'movie', 'resource/smallplayer',
                'salign', '',
                'FlashVars', 'video='+filename
                ); //end AC code
	}
}

function getFlashMovieObject(movieName){
    if (window.document[movieName]){
        return window.document[movieName];
    }
    if (navigator.appName.indexOf("Microsoft Internet")==-1){
        if (document.embeds && document.embeds[movieName]){
            return document.embeds[movieName];
        }
    }
    return document.getElementById(movieName);
}

function showLargeVideoClip(filename, playnow){ 
    if(!_videoPlayer){
	_initLargeVideoPlayer(filename);
	_videoPlayer = getFlashMovieObject('largeplayer');
    }
    if(filename != ''){
	try{_videoPlayer.loadVideo(filename, playnow);}catch(e){}
    }
}
function _initLargeVideoPlayer(filename){
        if (AC_FL_RunContent == 0) {
	    alert("This page requires AC_RunActiveContent.js.");
	} else {
	    AC_FL_RunContent(
                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
                'width', '600',
                'height', '516',
                'src', 'resource/largeplayer',
                'quality', 'high',
                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
                'align', 'middle',
                'play', 'true',
                'loop', 'true',
                'scale', 'exactfit',
                'wmode', 'transparent',
                'devicefont', 'false',
                'id', 'smallplayer',
                'bgcolor', '#000000',
                'name', 'largeplayer',
                'menu', 'true',
                'allowFullScreen', 'true',
                'allowScriptAccess','sameDomain',
                'movie', 'resource/largeplayer',
                'salign', '',
                'FlashVars', 'video='+filename
                ); //end AC code
	}
}

