// Java Document

var xmlhttp;
var srcId;


function getElm(eID) {
    return document.getElementById(eID);
}

function loadEmbeddedVideo(id, embeddedCode) {
	
	getElm(id).innerHTML = fixEmbeddedVideo(embeddedCode);
}
			
function fixEmbeddedVideo(embedCode) {
				if(embedCode && embedCode.toLowerCase().indexOf('classid') == -1) {
					var objPos = embedCode.toLowerCase().indexOf('object ') + 'object '.length;
					return embedCode.substr(0, objPos) + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' + embedCode.substr(objPos);
				} else {
					return embedCode;
				}
			}

function loadXMLDoc(id,url)
{
srcId = id;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  // set the callback function	
  xmlhttp.onreadystatechange=stateChange;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  // set the callback function
  xmlhttp.onreadystatechange=stateChange;
  xmlhttp.open("GET",url,true);
  xmlhttp.send();
  }


}


function stateChange()
{
if (xmlhttp.readyState == 4)
  {
  if (xmlhttp.status == 200)
    {
    // process whatever has been sent back here
    getElm(srcId).innerHTML=xmlhttp.responseText;
    }
  else
    {
    alert("There was a problem in the returned data");
    }
  }
}

function setOpacity(eID, opacityLevel) {
    var eStyle = getElm(eID).style;
    eStyle.opacity = opacityLevel / 100;
    eStyle.filter = 'alpha(opacity='+opacityLevel+')';
}

function fade(eID, startOpacity, stopOpacity, duration) {
    var speed = Math.round(duration / 100);
    var timer = 0;
    if (startOpacity < stopOpacity){ // fade in
        for (var i=startOpacity; i<=stopOpacity; i++) {
            setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
            timer++;
        } return;
    }
    for (var i=startOpacity; i>=stopOpacity; i--) { // fade out
        setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
        timer++;
    }
}

function show(eID) {
    getElm(eID).style.display='block';
}
function hide(eID) {
    getElm(eID).style.display='none';
}
function fadeIn(eID) {
    setOpacity(eID, 0); show(eID); var timer = 0;
    for (var i=1; i<=100; i++) {
        setTimeout("setOpacity('"+eID+"',"+i+")", timer * 5);
        timer++;
    }
}
function fadeOut(eID) {
    var timer = 0;
    for (var i=100; i>=1; i--) {
        setTimeout("setOpacity('"+eID+"',"+i+")", timer * 3);
        timer++;
    }
    setTimeout("hide('"+eID+"')", 310);
}
