var movieName = "video_player" ;

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}





function createRequestObject() {
	var req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
    
    return req ;
}







function writeFlash(querystring){
	
	querystring2 = '/video_player.swf?flvlink='+querystring ;
	
	
	var flashcode = "\n\t\t\t\t"+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'
	+ 'width="420" height="334" id="video_player"'
	+ 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">'
	+ '<param name="movie" value="'+querystring2+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="wmode" value="transparent">'
	+ '<embed src="'+querystring2+'" quality="high" bgcolor="#ffffff" '
	+ 'width="420" height="334" name="video_player" align="middle"'
	+ 'play="true"'
	+ 'loop="false"'
	+ 'quality="high"'
	+ 'wmode="transparent"'
	+ 'allowScriptAccess="sameDomain"'
	+ 'type="application/x-shockwave-flash"'
	+ 'swLiveConnect="true"'
	+ 'pluginspage="http://www.macromedia.com/go/getflashplayer" />'
	+ '<\/embed>'
	+ '<\/object>'
	+ '<br /><br /><div id="videotitle"><h3>Choose a video to watch</h3></div>' ;

	document.write(flashcode) ;
	
	if(querystring != '') updateTitle(querystring) ;

}





function changeFlash(querystring){
	
	thisMovie(movieName).TGotoLabel("_root.flvarea",querystring) ;
	
	updateTitle(querystring) ;
	
}











function updateDivContent(){
	if (http.readyState == 4) {
		if (http.responseText.indexOf('invalid') == -1) {
			document.getElementById( "videotitle" ).innerHTML = http.responseText ;
		}
	}
}










function updateTitle(filelink){
	var url = "/CSS/getvideotitle.php?filelink="+filelink ;
	http.open("GET", url, true) ;
	http.onreadystatechange = updateDivContent ;
	http.send(null) ;
}






























































/*document.getElementById( "flash_video" ).innerHTML = "" ;
	
	var object = document.createElement('object') ;
	object.setAttribute('classid','clsid:d27cdb6e-ae6d-11cf-96b8-444553540000') ;
	object.setAttribute('width','420') ;
	object.setAttribute('height','334') ;
	object.setAttribute('codebase','http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0') ;
	object.setAttribute('id','video_player') ;
	
	var param1 = document.createElement('param') ;
	param1.setAttribute('name','movie') ;
	param1.setAttribute('value',querystring) ;
	
	var param2 = document.createElement('param') ;
	param2.setAttribute('name','quality') ;
	param2.setAttribute('value','high') ;
	
	var param3 = document.createElement('param') ;
	param3.setAttribute('name','bgcolor') ;
	param3.setAttribute('value','#ffffff') ;
	
	var embed = document.createElement('embed') ;
	embed.setAttribute('src',querystring) ;
	embed.setAttribute('quality','high') ;
	embed.setAttribute('bgcolor','#ffffff') ;
	embed.setAttribute('width','420') ;
	embed.setAttribute('height','334') ;
	embed.setAttribute('name','video_player') ;
	embed.setAttribute('align','middle') ;
	embed.setAttribute('play','true') ;
	embed.setAttribute('loop','false') ;
	embed.setAttribute('quality','high') ;
	embed.setAttribute('allowScriptAccess','sameDomain') ;
	embed.setAttribute('type','application/x-shockwave-flash') ;
	embed.setAttribute('swLiveConnect','true') ;
	embed.setAttribute('pluginspage','http://www.macromedia.com/go/getflashplayer') ;

	object.appendChild(param1) ;
	object.appendChild(param2) ;
	object.appendChild(param3) ;
	object.appendChild(embed) ;
	
	
	document.getElementById( "flash_video" ).appendChild(object) ;*/
	
	
	
//	alert(document.getElementById( "flash_video" )) ;