function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

// Open Video Trailer Window
function trailers(name,title) 
{
	if ((navigator.userAgent.indexOf("Mac")!=-1) && (navigator.userAgent.indexOf("MSIE")!=-1))
	{
		viewTrailer1(name,title);
	}
	else
	{
		viewTrailer2(name,title);
	}
}	

function viewTrailer1(name,title) {
	url = "video_trailer.php?n="+name+"&t="+title;
	window.open(url, "video_trailer", "scrollbars=no,width=370,height=450,resizable=yes");
	return false;
}


function viewTrailer2(name,title) {
	x = (675 - 675)/2, y = (530 - 530)/2;

	if (screen) {
		y = (screen.availHeight - 530)/2;
		x = (screen.availWidth - 675)/2;
	}
	if (screen.availWidth > 1800) { 
	x = ((screen.availWidth/2) - 675)/2; 
	}
	url = "video_trailer.php?n="+name+"&t="+title;
	window.open(url,'video_trailer','scrollbars=no,resizable=yes,width=370,height=450,screenX='+x+',screenY='+y+',top='+y+',left='+x);
}
// End
