﻿// JScript File

function writeflash(url) 
{  
    if (url.substring(url.length-3,url.length) == "swf") 
    {
        var fo = new FlashObject(url, "flashhead", "995", "158", "8", "#FFFFFF");
        fo.write("flashcontent");
    }
    else if(url.substring(url.length-url.length,3) == "jpg") 
    {
        document.getElementById('flashcontent').innerHTML = "<img src='" + url + "'>";
    }
}  

function Replace(Expression, Find, Replace)
{
    var temp = Expression;
    var a = 0;

    for (var i = 0; i < Expression.length; i++) 
    {
        a = temp.indexOf(Find);
        if (a == -1)
            break
        else
            temp = temp.substring(0, a) + Replace + temp.substring((a + Find.length));
    }

    return temp;
}

function galSwapImg(processImg, ImgText, quickMov)
{
    document.getElementById('imgGallBigtxt').innerHTML = ImgText;
    
    if(quickMov != '') 
    {
        //document.getElementById('BigImageSpan').innerHTML = '<embed src="' + quickMov + '" height=361 width=365>';
        document.getElementById('BigImageSpan').innerHTML = embedwmp(quickMov);
    } 
    else 
    {
        document.getElementById('BigImageSpan').innerHTML = '<img src="' + processImg + '" name="imgGallBig" id="imgGallBig" border=0 />';
    }
}   


function embedwmp(stin)
{
    
    return "<object id=\"Object1\" CLASSID=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\"\n"
     + "standby=\"Loading Microsoft Windows® Media Player components...\" type=\"application/x-oleobject\" width=\"352\" height=\"288\">\n"
     + "<param name=\"fileName\" value=\"" + stin + "\">\n"
     + "<param name=\"animationatStart\" value=\"true\">\n"
     + "\n"
     + "<param name=\"transparentatStart\" value=\"true\">\n"
     + "<param name=\"autoStart\" value=\"true\">\n"
     + "<param name=\"showControls\" value=\"true\">\n"
     + "\n"
     + "<embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" src=\"" + stin + "\" name=\"MediaPlayer1\" width=352 height=288 autostart=1 showcontrols=1  >\n"
     + "</object>\n";

}

var newwindow;
function openPopupWindow(url)
{	
	newwindow=window.open(url, "PrintMe", "status = 1, height = 600, width = 800, resizable = 1" );
	if (window.focus) {newwindow.focus()}
}

function setOverflow(_item){
	if (document.getElementById){
		var _elem = document.getElementById(_item);
		_elem.style.overflow="hidden";
	}
}
function correctDivHeight(intBlock, extBlock)
{
var ext = document.getElementById(extBlock);
var intr = document.getElementById(intBlock);
if(ext==null || intr==null) return;
var extBottom = ext.offsetTop + ext.offsetHeight;
intr.style.height = -10 +(extBottom - intr.offsetTop) + "px";

// relative position: getAbsY(document.getElementById('TheId'))

}
