/* The following function creates an XMLHttpRequest object... */

var elementId="";
var loadingMesg="";
var elementSelected=""; 
function createRequestObject(){
        var request_o; //declare the variable to hold the object.
        var browser = navigator.appName; //find the browser name
        if(browser == "Microsoft Internet Explorer"){
                /* Create the object using MSIE's method */
                request_o = new ActiveXObject("Microsoft.XMLHTTP");
        }else{
                /* Create the object using other browser's method */
                request_o = new XMLHttpRequest();
        }
        return request_o; //return the object
}

var http = createRequestObject();

function getRequest2(url,id,selectedId){

	
        /* Create the request. The first argument to the open function is the method (POST/GET),
                and the second argument is the url... 
                document contains references to all items on the page
                We can reference document.form_category_select.select_category_select and we will
                be referencing the dropdown list. The selectedIndex property will give us the 
                index of the selected item. 
        */
        elementId=id;
		
        http.open('get', url);
      
		
		/* Define a function to call once a response has been received. This will be our
                handleProductCategories function that we define below. */
        http.onreadystatechange = ManipulateRequest2; 
        /* Send the data. We use something other than null when we are sending using the POST
                method. */
        http.send(null);
}

function ManipulateRequest2(){
        /* Make sure that the transaction has finished. The XMLHttpRequest object 
                has a property called readyState with several states:
                0: Uninitialized
                1: Loading
                2: Loaded
                3: Interactive
                4: Finished */

//        if(loadingMesg=="") var msg="Please wait ... loading";
//                else msg=loadingMesg;
//draw the combo
        var elementIdArray = elementId.split("^");
		if(http.readyState == 1)
        {		
				 document.getElementById(elementIdArray[0]).innerHTML ="Please wait...";
				                   
		}else if(http.readyState == 4){ //Finished loading the response
                /* We have got the response from the server-side script,
                        let's see just what it was. using the responseText property of 
                        the XMLHttpRequest object. */
                var response = http.responseText;
                /* And now we want to change the product_categories <div> content.
                        we do this using an ability to get/change the content of a page element 
                        that we can find: innerHTML. */
              
               
				//alert ( " respomnse = "+response );

                var responseArray = response.split("~");				
				
						

				if(elementIdArray[0]=='mFeaturedPhoto'){
					p=responseArray[6]+responseArray[2];
					document.getElementById(elementIdArray[0]).innerHTML="<a href='comment/photo_comment.php?id="+responseArray[0]+"' ><img src='"+p+"' class='rFeatured_ImgBor' border='0'></a>";
					document.getElementById(elementIdArray[1]).innerHTML="<a href='members/memberProfile.php?memberId="+responseArray[1]+"' id='Name'>"+responseArray[4]+"</a><br>By:&nbsp;<a href='members/memberProfile.php?memberId="+responseArray[1]+"' class='rFeaturedBlueLink'>"+responseArray[3]+"</a><br>Tags: <a href='#' class='rFeaturedBlueLink' >"+responseArray[5]+"</a>";
				}else if(elementIdArray[0]=='mFeaturedVideo'){
					var imagePath=responseArray[6].replace(".flv",".jpg");
				
					document.getElementById(elementIdArray[0]).innerHTML="<a name=1><DIV class=video_big><DIV class=video_big><a href='comment/comment_video.php?id="+responseArray[0]+"'><img src='"+imagePath+"' border='0'></a><a href='#video' onclick=PlayVideo(this,'"+responseArray[7]+"','"+responseArray[6]+"','featured')><img src='images/play_button.gif' class='overlay_button' border='0'></a></div></div>";
					document.getElementById(elementIdArray[1]).innerHTML="<a href='members/memberProfile.php?memberId="+responseArray[1]+"' id='Name'>"+responseArray[4]+"</a><br>By:&nbsp;<a href='members/memberProfile.php?memberId="+responseArray[1]+"' class='rFeaturedBlueLink'>"+responseArray[3]+"</a><br>Tags: <a href='#' class='rFeaturedBlueLink' >"+responseArray[5]+"</a>";
				
				}else if(elementIdArray[0]=='mFeaturedArtistVideo'){

					var imagePath=responseArray[6].replace(".flv",".jpg");				
					document.getElementById(elementIdArray[0]).innerHTML="<a name=1><DIV class=video_big><DIV class=video_big><a href='comment/comment_video.php?id="+responseArray[0]+"'><img src='"+imagePath+"' border='0'></a><a href='#video' onclick=PlayVideo(this,'"+responseArray[7]+"','"+responseArray[6]+"','featured')><img src='images/play_button.gif' class='overlay_button' border='0'></a></div></div>";
					document.getElementById(elementIdArray[1]).innerHTML="<a href='members/memberProfile.php?memberId="+responseArray[1]+"' id='Name'>"+responseArray[4]+"</a>";
				
				}
				else if(elementIdArray[0]=='mStarCamArtistVideo'){
					
							var imagePath = responseArray[2].replace(".flv",".jpg");							
				    	document.getElementById(elementIdArray[0]).innerHTML="<a name=1><DIV class=video_big><DIV class=video_big><a href='#'><img src='"+imagePath+"' border='0'></a><a href='#video' onclick=PlayVideo(this,'"+responseArray[3]+"','"+responseArray[2]+"','')><img src='images/play_button.gif' class='overlay_button' border='0'></a></div></div>";
						document.getElementById(elementIdArray[1]).innerHTML="<a href='javascript:onclick=nextStarCamArtistVideo("+responseArray[0]+")' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('Image7','','images/mFeaturedArtist_Bt_Prev_hover.gif',1)><img src='images/mFeaturedArtist_Bt_Prev.gif' name='Image7' width='25' height='19' border='0'></a>";
					document.getElementById(elementIdArray[2]).innerHTML="<a href='javascript:onclick=nextStarCamArtistVideo("+responseArray[1]+")' onMouseOut='MM_swapImgRestore()' onMouseOver=MM_swapImage('Image8','','images/mFeaturedArtist_Bt_Nxt_hover.gif',1)><img src='images/mFeaturedArtist_Bt_Nxt.gif' name='Image8' width='24' height='19' border='0'></a>";
					 

				
				}

        }

}


//==========================Function to return response===============


//***************************** Flash Player ************
function PlayFeaturedVideo(element,docPath,fileName){
			var imagePath=fileName.replace(".flv",".jpg");
			
			var videocode="<div id='flash_video'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='168' height='118' id='' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='"+docPath+"/flash/flvPlayer_middle.swf?flvPath="+fileName+"&imagePath="+imagePath+"' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='"+docPath+"/flash/flvPlayer_middle.swf?flvPath="+fileName+"&imagePath="+imagePath+"' quality='high' bgcolor='#ffffff' width='168' height='118' name='' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object></div>";
		
			var newElement = document.createElement('div');
			newElement.innerHTML = videocode;
			//alert(element.parentNode)
			setChildVisibilityWithNodeName(element.parentNode, "A", false);
			element.parentNode.appendChild(newElement);

			return false;
	
	}

	function PlaylistPlayer(id,docpath,QueryString){
		 
				document.getElementById(id).innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="Playlist" width="511" height="385" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="'+docpath+'/flash/Playlist.swf?'+QueryString+'" /><param name="quality" value="high" /><param name="bgcolor" value="#869ca7" /><param name="allowScriptAccess" value="sameDomain" /><embed src="'+docpath+'/flash/Playlist.swf?'+QueryString+'" quality="high" bgcolor="#869ca7" width="511" height="385" name="Playlist" align="middle" play="true"	loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"	pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>'
				
	}

	function ProfilePlayer(id,docPath,fileid,plyerid){
		 
				document.getElementById(id).innerHTML="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' id='player' width='197' height='298' align='middle'><param name='allowScriptAccess' value='always' /><param name='movie' value='"+docPath+"/flash/player.swf?id="+fileid+"&PlayerId="+plyerid+"' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='"+docPath+"/flash/player.swf?id="+fileid+"&PlayerId="+plyerid+"' quality='high' bgcolor='#ffffff' width='197' height='298' swLiveConnect=true id='player' name='player' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";			
				
	}
	
	function GoLivePlayer(id,docpath,QueryString){
			
				document.getElementById(id).innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="GoLive" width="627" height="660" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="'+docpath+'/flash/GoLive.swf?'+QueryString+'" /><param name="quality" value="high" /><param name="bgcolor" value="#869ca7" /><param name="allowScriptAccess" value="always" /><embed src="'+docpath+'/flash/GoLive.swf?'+QueryString+'" quality="high" bgcolor="#869ca7"	width="627" height="660" name="Playlist" align="middle"	play="true" loop="false" quality="high"	allowScriptAccess="always" type="application/x-shockwave-flash"	pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>';					
	}

	function VideoPlayer(id,docpath,QueryString){
			
				document.getElementById(id).innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="472" height="363" id="VideoPlayer" align="middle"><param name="allowScriptAccess" value="always" /><param name="movie" value="'+docpath+'/flash/VideoPlayerBig.swf?'+QueryString+'" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><embed src="'+docpath+'/flash/VideoPlayerBig.swf?'+QueryString+'" quality="high" bgcolor="#999999" width="472" height="363" name="VideoPlayer" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';					
	}

	function ChatRoom(id,docPath,rid,memberId,plyerid){
				
				document.getElementById(id).innerHTML="<OBJECT id=chatroom codeBase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 height=700 width=890 align=middle classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000><PARAM NAME='allowScriptAccess' VALUE='always'><PARAM NAME='movie' VALUE='"+docPath+"/flash/chatroom.swf?Roomid="+rid+"&MemberId="+memberId+"'><PARAM NAME='quality' VALUE='high'><PARAM NAME='bgcolor' VALUE='#ffffff'><embed src='"+docPath+"/flash/chatroom.swf?Roomid="+rid+"&MemberId="+memberId+"' quality='high' bgcolor='#ffffff' width='890' height='700' name='chatroom' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></OBJECT>";					
		}
	
	function HomePageIntro(id,docPath){

					document.getElementById(id).innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='495' height='192'><param name='wmode' value='transparent'><param name='movie' value='"+docPath+"/flash/intro1.swf'><param name='quality' value='high'><embed src='"+docPath+"/flash/intro1.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='495' height='192'></embed></object>";
					
	}
				
	function FreeWebCam(id,docPath){
					document.getElementById(id).innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='278' height='192' title='free cam offer'><param name='wmode' value='transparent'><param name='movie' value='"+docPath+"/flash/freeCam1.swf'><param name='quality' value='high'><embed src='"+docPath+"/flash/freeCam1.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='278' height='192'></embed></object>";
					
	}
	function CamITTHomePlayer(id,docPath){
				document.getElementById(id).innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='197' height='228'><param name='movie' value='"+docPath+"/flash/CamItt_homePage.swf'><param name='quality' value='high'><embed src='"+docPath+"/flash/CamItt_homePage.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='197' height='228'></embed></object>";
	}
	function ProfileLogo(id,docPath){
				document.getElementById(id).innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='195' height='93'><param name='movie' value='"+docPath+"/flash/ProfileLogo.swf'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='"+docPath+"/flash/ProfileLogo.swf' width='195' height='93' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed></object>";
	}
	function Recorder(id,docPath, stream){
					document.getElementById(id).innerHTML="<OBJECT id='recorder' codeBase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' height='459' width='371' align='middle' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'><PARAM NAME='allowScriptAccess' VALUE='sameDomain'><PARAM NAME='movie' VALUE='"+docPath+"/flash/recorder.swf?PublishStream="+stream+"'><PARAM NAME='quality' VALUE='high'><PARAM NAME='bgcolor' VALUE='#ffffff'><embed src='"+docPath+"/flash/recorder.swf?PublishStream="+stream+"' quality='high' bgcolor='#ffffff' width='371' height='459' name='recorder' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></OBJECT>";					
	}
	
	function RecorderSnap(id,docPath, stream, memberid){
		// alert(memberid);
					document.getElementById(id).innerHTML="<OBJECT id='recorder' codeBase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' height='459' width='371' align='middle' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'><PARAM NAME='allowScriptAccess' VALUE='sameDomain'><PARAM NAME='movie' VALUE='"+docPath+"/flash/recorder_snap.swf?PublishStream="+stream+"&id="+memberid+"'><PARAM NAME='quality' VALUE='high'><PARAM NAME='bgcolor' VALUE='#ffffff'><embed src='"+docPath+"/flash/recorder_snap.swf?PublishStream="+stream+"&id="+memberid+"' quality='high' bgcolor='#ffffff' width='371' height='459' name='recorder' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></OBJECT>";					
	}




	function AudioPlayer(id,docPath,audioid){

					document.getElementById(id).innerHTML="<object id='audioplayer' codeBase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' height='77' width='194'  align='middle' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'><PARAM NAME='allowScriptAccess' VALUE='sameDomain'><PARAM NAME='movie' VALUE='"+docPath+"/flash/audioplayer.swf?audioid="+audioid+"'><PARAM NAME='quality' VALUE='high'><param name='wmode' value='transparent'><embed src='"+docPath+"/flash/audioplayer.swf?audioid="+audioid+"' quality='high'  width='194' height='77' name='audioplayer' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' /></object>";	
					//alert(document.getElementById(id).innerHTML)
	}

	function setChildVisibilityWithNodeName(element, nodeName, visibility) 
	{
		if(typeof(element)!="undefined")
		for (var i = 0 ; i < element.childNodes.length; i++ ) {
			if (element.childNodes[i].nodeName == nodeName) {
				setElementVisibility(element.childNodes[i], visibility);
			}
		}
	}


	
	function PlayVIM(id,docPath, fileName){
					var imagePath=fileName.replace(".flv",".jpg");

					document.getElementById(id).innerHTML="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='320' height='240' id='' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='"+docPath+"/flash/flvPlayer_320.swf?flvPath="+fileName+"&imagePath="+imagePath+"' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='"+docPath+"/flash/flvPlayer_320.swf?flvPath="+fileName+"&imagePath="+imagePath+"' quality='high' bgcolor='#ffffff' width='320' height='240' name='' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";					
	}

	function PlayVideo(element,docPath,fileName,VideoType)
		{
				hideVideo();
				var imagePath=fileName.replace(".flv",".jpg");
			
				if(VideoType == "medium"){
						var videocode="<div id='flash_video'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='200' height='150' id='' align='middle'><param name='movie' value='"+docPath+"/flash/VideoPlayerMedium.swf?FlvPath="+fileName+"' /><param name='allowScriptAccess' value='sameDomain' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='"+docPath+"/flash/VideoPlayerMedium.swf?FlvPath="+fileName+"' type='application/x-shockwave-flash' scale='noscale' width='200' height='150' allowScriptAccess='always' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></div>";
				}

				if(VideoType == "small"){
						var videocode="<div id='flash_video'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='120' height='90' id='' align='middle'><param name='movie' value='"+docPath+"/flash/VideoPlayerSmall.swf?FlvPath="+fileName+"' /><param name='allowScriptAccess' value='sameDomain' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='"+docPath+"/flash/VideoPlayerSmall.swf?FlvPath="+fileName+"' type='application/x-shockwave-flash' scale='noscale' width='120' height='90' allowScriptAccess='always' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></div>";
				}
				
				if(VideoType == "large"){
			
					var videocode="<div id='flash_video'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='200' height='165' id='' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='"+docPath+"/flash/VideoPlayerMedium.swf?flvPath="+fileName+"&imagePath="+imagePath+"' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='"+docPath+"/flash/VideoPlayerMedium.swf?FlvPath="+fileName+"&imagePath="+imagePath+"' type='application/x-shockwave-flash' scale='noscale' width='200' height='165' allowScriptAccess='always' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></div>";
				
				}
				
				if(VideoType == "audio"){
						var videocode="<div id='flash_video'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='169' height='115' id='' align='middle'><param name='movie' value='"+docPath+"/flash/AudioPlayer.swf?AudioPath="+fileName+"' /><param name='allowScriptAccess' value='sameDomain' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='"+docPath+"/flash/AudioPlayer.swf?AudioPath="+fileName+"' type='application/x-shockwave-flash' scale='noscale' wmode='transparent' width='169' height='15' allowScriptAccess='always' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></div>";
				}			

				var newElement = document.createElement('div');
				newElement.innerHTML = videocode;
//				alert(element.parentNode)
				setChildVisibilityWithNodeName(element.parentNode, "A", false);
				element.parentNode.appendChild(newElement);
				return false;	
						
	}


	function CoustomizeProfilePlayer(id,docPath,Plyerid,MemberId){

		alert(id);
		alert(docPath);
		alert(MemberId);
			
		document.getElementById(id).innerHTML="<object width='440' height='210'> <param name='movie' value='"+docPath+"/flash/ProfilePlayer.swf?BaseURL='"+docPath+"&MemberId='"+MemberId+"'></param><param name='wmode' value='transparent'></param><param name='allowScriptAccess' value='always'></param><embed src='"+docPath+"/flash/ProfilePlayer.swf?BaseURL='"+docPath+"&MemberId='"+MemberId+"' type='application/x-shockwave-flash' wmode='transparent' width='440' height='210' allowScriptAccess='always'></embed></object>";
		
				
	}


	

function hideVideo() {
	
	var element = getElement("flash_video");
	//alert(element);
	if ((element) && typeof(element)!= "undefined") {
		var parent = element.parentNode.parentNode;
		//alert(parent.)
		var videocode = '<div id="flash_video"></div>';
	  	element.innerHTML = videocode;
		removeElement(element.parentNode);
		setChildVisibilityWithNodeName(parent, "A", true);
	}
}

function PlayAudio(element,docPath,audioid,VideoType)
		{
			//alert(VideoType);
			//document.write(docPath+ "/flash/VideoPlayerMedium.swf?FlvPath="+audioid);
				hideAudio();
				if(VideoType == "audio"){
						var videocode="<div id='flash_audio'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='182' height='77' id='' align='middle'><param name='movie' value='"+docPath+"/flash/AudioPlayer.swf?audioid="+audioid+"&BaseURL="+docPath+"' /><param name='allowScriptAccess' value='sameDomain' /><param name='quality' value='high' /><param name='wmode' value='transparent'><embed src='"+docPath+"/flash/AudioPlayer.swf?audioid="+audioid+"&BaseURL="+docPath+"' type='application/x-shockwave-flash' scale='noscale' width='182' height='77' allowScriptAccess='always' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' ></embed></object></div>";

						
				}			

				var newElement = document.createElement('div');
				newElement.innerHTML = videocode;
//				alert(element.parentNode.id)
				setChildVisibilityWithNodeName(element.parentNode, "A", false);
				element.parentNode.appendChild(newElement);
				return false;	
						
	}

	function hideAudio() {
	
	var element = getElement("flash_audio");
	//alert(element);
	if ((element) && typeof(element)!= "undefined") {
		var parent = element.parentNode.parentNode;
		//alert(parent.)
		var videocode = '<div id="flash_audio"></div>';
	  	element.innerHTML = videocode;
		removeElement(element.parentNode);
		setChildVisibilityWithNodeName(parent, "A", true);
	}
}

function getElement(elementName) {
 if(document.getElementById && document.getElementById(elementName)) {
    return document.getElementById(elementName);
  }
  else if (document.all && document.all(elementName)) {
    return document.all(elementName);
  }
  else if (document.layers && document.layers[elementName]) {
    return document.layers[elementName];
  } else {
    return false;
  }
}

function setElementVisibility(ele, visibility) {
	if (visibility) {
		showElement(ele);
	} else {
		hideElement(ele);
	}
}

function hideElement(ele) {
  ele.style.display = "none";
}

function showElement(ele) {
  ele.style.display = "";
}

function removeElement(ele) {
  ele.parentNode.removeChild(ele);
}
