var movieName = "testimonial";
var http = false;

//setup ajax call to fix video load issues with firefox
function rotvideo(video,height,media){
    if (window.XMLHttpRequest) {
       http = new XMLHttpRequest();
    }
    else {
        if (window.ActiveXObject) {
            try {
                http = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) { }
        }
    }  

    //var sortValue = (document.sortform.sortBy.value) ? document.sortform.sortBy.value : MSRP;
    //var resultsValue = (document.sortform.resultsPP.value) ? document.sortform.resultsPP.value : 10;
    //var docID = (document.sortform.pageID.value) ? document.sortform.pageID.value : 3;
    //document.sortform.resultsPP.value = resultsValue;
    myRand = parseInt(Math.random()*999999999999999);
    if (http) {
        http.onreadystatechange = showContents;
        http.open("GET", "/ajaxmedia.php?video=" + video + "&height=" + height + "&rand=" + myRand + "&media=" + media, true);
        http.send(null);
        if(media == 'video')
        {
           document.getElementById('media_player').style.height = height + 'px';
           document.getElementById('media_player').style.background = "none";
        }
        if(media == 'audio')
        {
           document.getElementById('media_player').style.height = '25px';
           document.getElementById('media_player').style.background = "url('/assets/templates/iam/images/media-audiobg.jpg') no-repeat"; 
        }
    }
    else {
        document.getElementById("media_player").innerHTML = "Sorry, but I couldn't create an XMLHttpRequest";
    }
    
}

function showContents() {
   if (http.readyState == 4) {
    if(http.status == 200) {
       var page = http.responseText;
       document.getElementById('media_player').innerHTML = page;
    }
  } else {
  document.getElementById('media_player').innerHTML = '';
  }
}


        

function playmovie(testVideo,testheight,mediaType) {

  
        rotvideo(testVideo,testheight,mediaType);

    
}       

$("document").ready(function(){
    var url = document.location.href;
    if (url == 'http://www.iammusicgroup.com/artists/giovanna-moraga-clayton.php?load=give')
    {
       playmovie('/assets/flash/Give-Thanks-Promo2.0.flv','240','video');
    }   
});
/*
function setMediabg(box){
    document.getElementById('media_link_0').style.background = 'transparent';
    document.getElementById('media_link_1').style.background = 'transparent';
    document.getElementById('media_link_2').style.background = 'transparent';
    document.getElementById('media_link_' + box).style.background = '#686868';  
}
*/
