﻿
function MediaLayer()
{
    
	this.mainImg = null; 
	this.mainTxt = null; 
	this.currentLink  = null;
	this.mainHeader = null;
	this.txtImageURL = '../../../../Templates/UtilityPages/TextImage.aspx';
	
	this.displayImage = function(link,index,newsrc,txt,alt)
	{		
		var rootNode = $('#pictureContainer' + index);
		this.mainImg = rootNode.find('.mainImage');
		this.mainTxt = rootNode.find('.mainTxt');
		this.mainHeader = rootNode.find('.header .project-headline');
		
		//this.mainHeader.attr('src',this.txtImageURL + '?txt=' + alt + '&class=project-headline');
		//alert(newsrc);
		if (this.currentLink != null) 
        {
            this.currentLink.removeClass('active');
        }
		
		this.currentLink  = $('#' + link);
		this.currentLink.addClass('active');
		this.mainImg.attr('alt',alt);
		this.mainImg.attr('src',newsrc);
		this.mainTxt.text(txt);
		
        if (txt.length == 0)
        {
            this.mainTxt.hide();
        }
        else
        {
            this.mainTxt.show();
        }
	}
    
}

function callMediaFlash(strMethodName, strVal)
{
    var flashSel = "#mediaLayerFlash";
    var selObj = $(flashSel);
    
    var exists = selObj[0] != undefined && eval("selObj[0]." + strMethodName) != undefined;
    if(!exists)
    {
        setTimeout("callMediaFlash('" + strMethodName + "','" + strVal + "')", 25);
    }
    else
    {
        eval("$(flashSel)[0]." + strMethodName + "(strVal)");
    }
}

var rowClickDisabled = false;

function disableRowClick()
{
    rowClickDisabled = true;
    setTimeout("rowClickDisabled = false", 50);
}


function ExtendedInfo()
{

	this.show = function(infoObj)
	{
		infoObj.show();
	}

	this.hide = function(infoObj)
	{
		infoObj.hide();
	}
}

function getMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

function stopAllVideo()
{
    var m = getMovie("videoFlash" + 0);
    for(i = 0; m; i++)
    {
        if(m.stopVideo)
            m.stopVideo();
        m = getMovie("videoFlash" + i);
    }
}

var extendedInfo = new ExtendedInfo();

