var reqRat = newXMLHttpRequest();
var sonId = "";
var domainName = getDomainName();
var cookie_classId = "";
var music_classId = "";
var selectedStr = "";
var knownPlayer = "";
//alert(domainName);
function call_rating(songId,rank,scriptName){		
	var ratURL = scriptName+"/portal/musicalbums/common/musicRating.jsp?songId="+songId+"&rValue="+rank;		
	//alert(ratURL);
	if(!getcookie(songId)){
		sonId=songId;
	   reqRat =newXMLHttpRequest();
	   if( reqRat ){		  
		  reqRat.open("GET", ratURL, true ); 
		  reqRat.onreadystatechange = showMsg;
		  reqRat.send(null);
	   }
		setcookie(songId , '0',domainName ,0);
		
	}else{
		divRatingObject.innerHTML =  "<font face=verdana size=1 color=red>Already rated this song.</font>";
		alert("Already rated this song!");
	}
	return false;
}

function getcookie(cookiename) {
	 var cookiestring=""+document.cookie;
	 var index1=cookiestring.indexOf(cookiename);
	 if (index1==-1 || cookiename=="") return ""; 
	 var index2=cookiestring.indexOf(';',index1);
	 if (index2==-1) index2=cookiestring.length; 
	 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setcookie(name,value,domainName,duration) {		
		cookiestring=name+"="+escape(value)+domainName;
		// Cookie Exists for the Browser session
		document.cookie = cookiestring;	
}

function showMsg(){		
 if( reqRat.readyState == 4){
	if( reqRat.status == 200){
		var responseText = reqRat.responseText;	
		//alert("="+responseText);
		var isRatingthere = responseText.indexOf("avgrating=") ;		
		var isRatStar = responseText.indexOf("ratingStar=") ;		
		if(isRatingthere > -1 && isRatStar > -1 ){						
			divRatingObject.innerHTML =  responseText.substring(0,isRatingthere ); 				
			eval("ratSo"+sonId).innerHTML =responseText.substring(isRatStar+11); alert("Thanks for Rating !");		
		}else if(responseText.indexOf("Found")>-1) {
			alert("Already rated this song!");
			divRatingObject.innerHTML =  "<font face=verdana size=1 color=red>Already rated this song.</font>";
		}
   }
  }
}
function newXMLHttpRequest() {
  var xmlreq = false;
  if (window.XMLHttpRequest) {
    xmlreq = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    try {      
      xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e1) {     
      try {
        
        xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
     } catch (e2) {       
        xmlreq = false;
      }
    }
  }
return xmlreq;
}

function getDomainName() {
	var host = document.location.hostname;
	var parts = host.split('.');
	if (parts[parts.length - 1].length == 2) {
		return parts.slice(parts.length - 1).join('.');
	} else {
		return parts.slice(parts.length - 2).join('.');
	}
}

/////////////////////////////////////////////////////////////
function GetBrowser(){
   var agt=navigator.userAgent.toLowerCase();
   if( ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)) )
       return "IE";
   else if( ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
         && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
         && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)) )
       return "Netscape";
   else
       return "unknown";
}
var ie5=document.all&&document.getElementById  ;
var ns6=document.getElementById&&!document.all ;
var divRate = null;
var  mmStart  = null ;
var mmDHFlag = false ;


function getRatingTable(script){
	var rationgForm = "";
	//alert(script);
	var tempStr = "/portal/music/image/star-orange.gif";
	rationgForm+= "<div id=\"divRating\" name=\"divRating\" style=\"position:absolute; font-family: verdana;  font-size: 11px;  color: #000000;  margin: 5px;  padding: 5px;  height: auto;  width: auto; text-align: left;  border:1 px solid #000000;  background-color: #FFFFFF;  cursor:pointer; cursor:hand; top: 0px; left:0px;width:100px; visibility:hidden;\" onmouseover=\"MM_startTimeout();\">";
	rationgForm+= "<form name=\"ratingForm\" method=\"post\">";
	rationgForm+= "<table cellSpacing=\"0\" cellPadding=\"0\" width=\"60\" border=\"0\">";
	rationgForm+= "<input type=\"hidden\" name=\"rateSonID\" value=\"\">";
	rationgForm+= "    <tr>";
	rationgForm+= "      <td vAlign=\"center\" align=\"middle\" width=\"8%\" height=\"16\"><input type=\"radio\"   onClick=\"javascript:callRating(5,'"+script+"')\" value=\"V1\" name=\"radioRating\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"16\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"16\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"7%\" height=\"16\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"7%\" height=\"16\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"7%\" height=\"16\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "    </tr>";
	rationgForm+= "    <tr>";
	rationgForm+= "      <td vAlign=\"center\" align=\"middle\" width=\"8%\" height=\"21\">";
	rationgForm+= "	  <input type=\"radio\"   onClick=\"javascript:callRating(4,'"+script+"')\" value=\"V1\" name=\"radioRating\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"21\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"21\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"7%\" height=\"21\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"7%\" height=\"21\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"7%\" height=\"21\"></td>";
	rationgForm+= "    </tr>";
	rationgForm+= "    <tr>";
	rationgForm+= "      <td vAlign=\"center\" align=\"middle\" width=\"8%\" height=\"1\"><input type=\"radio\"   onClick=\"javascript:callRating(3,'"+script+"')\" value=\"V1\" name=\"radioRating\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"1\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"1\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"7%\" height=\"1\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "    </tr>";
	rationgForm+= "    <tr>";
	rationgForm+= "      <td vAlign=\"center\" align=\"middle\" width=\"8%\" height=\"21\"><input type=\"radio\"   onClick=\"javascript:callRating(2,'"+script+"')\" value=\"V1\" name=\"radioRating\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"21\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"21\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "    </tr>";
	rationgForm+= "    <tr>";
	rationgForm+= "      <td vAlign=\"center\" align=\"middle\" width=\"8%\" height=\"1\"><input type=\"radio\" onClick=\"javascript:callRating(1,'"+script+"')\"value=\"V1\" name=\"radioRating\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"1\"><img height=\"10\" src=\""+tempStr+"\" width=\"10\" border=\"0\"></td>";
	rationgForm+= "      <td width=\"6%\" height=\"1\"></td>";
	rationgForm+= "    </tr>";
	rationgForm+= "</table>";
	rationgForm+= "</form>";
	rationgForm+= "</div>";
	document.writeln(rationgForm);
}
function popupRanks( toDo,e,songId){
	//alert("popupRanks="+songId);
	try{
		document.ratingForm.rateSonID.value=songId;
	}catch(error){}
	try{
		//var rateIds = document.getElementById("radioRating");
		//var getcheckeditem = document.ratingForm.Radio[document.ratingForm.Radio.checked].text;
		alert(document.ratingForm.Radio.checked)
	}catch(error){
		//alert(error)
	}
	divRate = document.getElementById("divRating");
	
	if( !divRate ) return ;
	var offsetx=ie5? event.clientX : e.clientX
	var offsety=ie5? event.clientY : e.clientY
	var remainder = 0;
	var previousState = divRate.style.visibility;
	toDo = (previousState == "visible") ? "hide" : "show" ;
	 if(toDo == "show" ){
		//	offsetx =	offsetx - 100 ;
		//alert(offsetx);
		remainder  = (offsetx%100);
		offsetx = offsetx - remainder + 30 ;
		//alert(offsetx);
	 	 divRate.style.visibility="visible";
		// alert(divRate.style.width);
		 //divRate.style.left.width = "100" ;
		 divRate.style.left= (offsetx ) +"px" ;// screen.availWidth  - 
		 //divRate.style.left= (offsetx - 100) +"px" ;// screen.availWidth  - (296+20) +"px";
		 divRate.style.top= offsety  + window.document.body.scrollTop + 1 +"px";
		 var allRadios = document.getElementsByName("radioRating");
		 for(var g =0 ; g < allRadios.length; g++) allRadios[g].checked= false ;
	 }else if (toDo == "hide" ){
		MM_startTimeout();
		divRate.style.visibility="hidden";
	 }
}
function setInitalPosition(){
	divRate = document.getElementById("divRating") ;
	if( !divRate ) return ;
	divRate.style.left = "0px";
	divRate.style.top = "0px";
}
function MM_startTimeout() {
	if (divRate ){
		mmStart = new Date();
		mmDHFlag = true;
		mmHideMenuTimer = setTimeout("mmDoHide(3000)", 2000 );
	}
}
function mmDoHide(timeOut) {
	//alert("1"+mmDHFlag+"/"+divRate);
	//if (!mmDHFlag || !divRate) return;
	//alert("2");
	var elapsed = new Date() - mmStart;
	var timeout =  timeOut; 
	if (elapsed < timeout) {
			setTimeout("mmDoHide(3000)", timeout+100-elapsed);
		   return;
	}
	mmDHFlag = false;
	divRate.style.visibility="hidden";
}

function callRating(rate,scriptName){
	mmDoHide(0)
//alert(rate);
var songId = document.ratingForm.rateSonID.value;
//alert(songId)
  call_rating(songId,rate, scriptName );
}


//////////////////////////////////////////////////////////////
//// 4PlayerList
var musicFilePath ="";
var divPlayer_Pop; //= document.getElementById("divPlayer_Pop");
var thisObjtemp=null;
var divIdtemp=null;
//// 4PlayerList
var offsetxPlay;// =ie5? event.clientX : e.clientX
var offsetyPlay;// =ie5? event.clientY : e.clientY
function fnPlayMusic(thisObj,musicFile,divId,e){
	//// 4PlayerList
	try{
		musicFilePath = musicFile;
		//alert(musicFilePath + musicFile)
		thisObjtemp=thisObj;
		divIdtemp=divId;
		divPlayer_Pop = document.getElementById("divPlayer_Pop");
		
		////
		if( !divPlayer_Pop ) return ;
		try{
			if(offsetxPlay ==undefined){
				offsetxPlay =ie5? event.clientX : e.clientX;
				offsetyPlay =ie5? event.clientY : e.clientY;
			}
		}catch(error){}
		var remainder = 0;
		var previousState = divPlayer_Pop.style.visibility;
		remainder  = (offsetxPlay%100);
		offsetxPlay = offsetxPlay - remainder + 30 ;
		divPlayer_Pop.style.left= (offsetxPlay ) +"px";
		divPlayer_Pop.style.top = offsetyPlay+window.document.body.scrollTop+1+"px";
		////
	}catch(error){}
	
	try{
		cookie_classId = get_cookie_classId("musClassID");
		//alert(cookie_classId)
		if(cookie_classId != null){
			music_classId = cookie_classId;
			callMe(music_classId,e);
			//justPlay(music_classId);
		}else{
			callMe(music_classId,e);
		}
	}catch(error){}
	//// 4PlayerList

	var divMusicPlayer = document.getElementById("musicPalyer");
	var musicDivId = "";
	var play = false ;
	//alert(">>"+thisObj.innerHTML);
	if(thisObj){		
		var prevHtml = thisObj.innerHTML;
		var stopPlaying = ""
		if(prevHtml.indexOf("Listen") > -1){
		  thisObj.innerHTML="<img src=\"/portal/music/image/stop.gif\" border=\"0\" width=\"14\" height=\"15\" align=\"absMiddle\" alt=\"Stop\">";
		  try{
			musicDivId = document.musicPlayform.musicDivId.value;			
			stopPlaying = document.getElementById(musicDivId);
			
			if(divId!=musicDivId){
				stopPlaying.innerHTML="<img src=\"/portal/valentine/play.jpg\" border=\"0\" width=\"60\" height=\"19\" align=\"absMiddle\" alt=\"Listen\">";
				//closePopup();
			}
		  }catch(error){}
		  try{
			document.musicPlayform.musicDivId.value=divId;			
		  }catch(error){}
		  play = true ;
		}else {
			thisObj.innerHTML="<img src=\"/portal/valentine/play.jpg\" border=\"0\" width=\"60\" height=\"19\" align=\"absMiddle\" alt=\"Listen\">";
			closePopup();
			 play = false ;			 
		}
	}
	/*
	if( divMusicPlayer ){		
		if(play){
			//////
			//divMusicPlayer.innerHTML="<embed src=\""+musicFile+"\" name=\"playMusic\" autostart=\"true\" width=0 height=0 id=\"playMusic\"  enablejavascript=\"true\">";
			//////

			//divMusicPlayer.innerHTML="<Embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/windows/mediaplayer/download/default.asp\" name=\"VIDEO\"  id=\"VIDEO\"  src=\""+musicFile+"\" AutoStart=\"1\" ShowStatusBar=\"0\" ShowControls=\"0\" uiMode=\"0\" SendPlayStateChangeEvents=\"1\" currentMarker=\"1\" width=\"0\" height=\"0\"></embed>";
			//divMusicPlayer.innerHTML="<OBJECT name=\"VIDEO\" id=\"VIDEO\" width=\"0\" height=\"0\" 	CLASSID=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\"	type=\"application/x-oleobject\"><PARAM NAME=\"URL\" VALUE=\""+musicFile+"\"><PARAM NAME=\"AutoStart\" VALUE=\"1\"><PARAM name=\"currentMarker\" value=\"1\"><PARAM NAME=\"AutoSize\" VALUE=\"1\"><PARAM NAME=\"ShowStatusBar\" VALUE=\"0\"><PARAM name=\"PlayCount\" value=\"1\"><param name=\"ShowControls\" value=\"0\"><PARAM name=\"uiMode\" value=\"none\"><param name=\"volume\" value=\"100\"><Embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/windows/mediaplayer/download/default.asp\" name=\"VIDEO\"  id=\"VIDEO\"  src=\""+musicFile+"\" AutoStart=\"1\" ShowStatusBar=\"0\" ShowControls=\"0\" uiMode=\"0\" SendPlayStateChangeEvents=\"1\" currentMarker=\"1\" width=\"0\" height=\"0\"></embed></object>";
			//alert("1");
		}else {			 
			divMusicPlayer.innerHTML="";
		}
		//alert(divMusicPlayer.innerHTML);                                      
  }*/
}
//////////////////////////////////////////////////////////////
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
// initialize global variables
var detectableWithVB = false;
var pluginFound = false;
function goURL(daURL) {
    // if the browser can do it, use replace to preserve back button
    if(javascriptVersion1_1) {
		window.location.replace(daURL);
    }else {
		window.location = daURL;
    }
    return;
}
function redirectCheck(pluginFound, redirectURL, redirectIfFound) {
    // check for redirection
    if( redirectURL && ((pluginFound && redirectIfFound) || 
	(!pluginFound && !redirectIfFound)) ) {
	// go away
	goURL(redirectURL);
	return pluginFound;
    } else {
	// stay here and return result of plugin detection
	return pluginFound;
    }	
}
function canDetectPlugins(){
    if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
	return true;
    } else {
	return false;
    }
}
//////////////////////////////////////////////////////////////
var element;
function setEmbed(ID,dir,clssId) {
	 element = document.getElementById(ID);
	 var playerStr ="";
	 playerStr +='<br><br><object type=\"'+getMimeType()+'\" classid=\"'+clssId+'\" data=\"'+dir+'\" width=\"300\" height=\"25\"><param name=\"src\" value=\"'+dir+'\" /><param name=\"controller\" value=\"true\" /><param name=\"autoplay\" value=\"true\" /><param name=\"autostart\" value=\"1\" /><param name=\"pluginurl\" value=\"\" /><embed src=\"'+dir+'\" type=\"'+getMimeType()+'\" width=\"300\" height=\"25\" autostart=\"true\" controller=\"true\" enablejavascript=\"true\"></embed></object>';
	 element.innerHTML=playerStr;
	 try{
		divPlayer_Pop.style.visibility="visible";
	}catch(error){}
}// end function setEmbed

function getMimeType(){
	var mimeType = "application/x-mplayer2"; //default
	var agt=navigator.userAgent.toLowerCase();
	if (navigator.mimeTypes && agt.indexOf("windows")==-1) {
	//non-IE, no-Windows
	var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
    if (plugin) mimeType="audio/mpeg" //Mac/Safari & Linux/FFox
}//end no-Windows
return mimeType
}//end function getMimeType

//////////////////////////////////////////////////////////////

// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    document.writeln('<script language="VBscript">');

    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion >= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');

    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');
    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('</scr' + 'ipt>');
}
/////////////////////////////////////////////////////////////
function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// for each plugin...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
	    // loop through all desired names and check each against the current plugin name
	    var numFound = 0;
	    for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
		// if desired plugin name is found in either plugin name or description
		if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
		    (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
		    // this name was found
		    numFound++;
		}   
	    }
	    // now that we have checked all the required names against this one plugin,
	    // if the number we found matches the total number provided then we were successful
	    if(numFound == daPlugins.length) {
		pluginFound = true;
		// if we've found the plugin, we can stop looking through at the rest of the plugins
		break;
	    }
	}
    }
    return pluginFound;
}// detectPlugin
///////////////////////////////////////////////////////////
function detectReal(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('RealPlayer');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
		       detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
		       detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
    }	
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
///////////////////////////////////////////////////////////
function detectQuickTime(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('QuickTime');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectQuickTimeActiveXControl();
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
///////////////////////////////////////////////////////////
function detectWindowsMedia(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Windows Media');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
///////////////////////////////////////////////////////////
function getMusicPlayers(){

	var tempStr = "";
	var classId ="";

	var playerForm = "<div id=\"divPlayer_Pop\" name=\"divPlayer_Pop\" style=\"position:absolute;font-family: verdana;  font-size: 11px;  color: #000000;  margin: 5px;  padding: 5px;  height: auto;  width: auto; text-align: left;  border:1 px solid #000000;  background-color: #FFFFFF;top: 0px; left:0px;width:300px; visibility:hidden;\" onmouseover=\"MM_startTimeout();\" onmousedown=\"dragPiece(this);\" onmouseup=\"drop();\">";
	playerForm +="<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"302\" style=\"border-style: solid; border-width: 2\">";
	playerForm +="<tr><td width=\"298\" bgcolor=\"#94CCED\" height=\"25\" colspan=\"5\"><img border=\"0\" src=\"/portal/music/image/mmlogo.jpg\" width=\"127\" height=\"18\"></td></tr>";
	playerForm +="<tr><td width=\"296\" bgcolor=\"#FFFFFF\" height=\"25\" colspan=\"5\" align=\"center\"><span style=\"font-family:verdana;font-size:10px;font-weight:bold;\">Please choose your preferred media player:</span></td></tr>";


	try{
		classId = cookie_classId = get_cookie_classId("musClassID");
		//alert(classId)
		if(classId==null){
			classId ='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
		}
	}catch(error){}

	if(detectWindowsMedia()){
		//alert("true w");
		//tempStr += "<br><input type=\"radio\" name=\"playerID\" value=\"\" onClick=\"callMe('clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95')\"> Windows Media Player";
			try{
				if(classId=='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95'){
					selectedStr="checked";
				}else{
					selectedStr="";
				}
		}catch(error){}

		playerForm += "<tr><td width=\"12\" bgcolor=\"#FFFFFF\" height=\"21\" align=\"center\">&nbsp;</td><td width=\"12\" bgcolor=\"#FFFFFF\" height=\"21\" align=\"center\" style=\"border-bottom-style: normal; border-bottom-width: 0\"><input type=\"radio\" name=\"playerID\" value=\"\"  onClick=\"callMe('clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95',event)\" "+selectedStr+"></td><td width=\"28\" bgcolor=\"#FFFFFF\" height=\"21\" style=\"border-bottom-style: solid; border-bottom-width: 1\" bordercolor=\"#000000\"><img border=\"0\" src=\"/portal/music/image/winplayer.jpg\" width=\"23\" height=\"23\"></td><td width=\"207\" bgcolor=\"#FFFFFF\" height=\"21\" style=\"border-bottom-style: solid; border-bottom-width: 1\" bordercolor=\"#000000\"><span style=\"font-family:verdana;font-weight:bold;font-size:12px;color:#800000;\"> Windows media player</span></td><td width=\"37\" bgcolor=\"#FFFFFF\" height=\"21\">&nbsp;</td></tr>";
		//music_classId='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95';
	}

	if(detectReal()){
		try{
			if(classId=="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"){
				selectedStr="checked";
				//alert(selectedStr)
			}else{
				selectedStr="";
			}
		}catch(error){}
		//playerForm += "<tr bgcolor=\"#FFD700\"><td colspan=2><input type=\"radio\" name=\"playerID\" value=\"\"  onClick=\"callMe('clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',event)\"  "+selectedStr+"><span style=\"font-family:verdana;font-weight:bold;font-size:12px;color:#000000;\">Real Player</span></td></tr>";
		//alert(playerForm)

		playerForm += "<tr><td width=\"12\" bgcolor=\"#FFFFFF\" height=\"21\" align=\"center\">&nbsp;</td><td width=\"12\" bgcolor=\"#FFFFFF\" height=\"21\" align=\"center\" style=\"border-bottom-style: normal; border-bottom-width: 0\"><input type=\"radio\" name=\"playerID\" value=\"\"  onClick=\"callMe('clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',event)\" "+selectedStr+"></td><td width=\"28\" bgcolor=\"#FFFFFF\" height=\"21\" style=\"border-bottom-style: solid; border-bottom-width: 1\" bordercolor=\"#000000\"><img border=\"0\" src=\"/portal/music/image/realplayer.jpg\" width=\"23\" height=\"23\"></td><td width=\"207\" bgcolor=\"#FFFFFF\" height=\"21\" style=\"border-bottom-style: solid; border-bottom-width: 1\" bordercolor=\"#000000\"><span style=\"font-family:verdana;font-weight:bold;font-size:12px;color:#800000;\"> Real player</span></td><td width=\"37\" bgcolor=\"#FFFFFF\" height=\"21\">&nbsp;</td></tr>";

		//music_classId='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
	}
	if(detectQuickTime()){
		//alert("true Q");
		//tempStr += "<br><input type=\"radio\" name=\"playerID\" value=\"\" onClick=\"callMe('clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B')\">QuickTime";
		try{

			if(classId=='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'){
				selectedStr="checked";
				//alert(selectedStr)
			}else{
				selectedStr="";
			}
		}catch(error){}

		//playerForm += "<tr bgcolor=\"#FFD700\"><td colspan=2><input type=\"radio\" name=\"playerID\" value=\"\" onClick=\"callMe('clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',event)\"   "+selectedStr+"><span style=\"font-family:verdana;font-weight:bold;font-size:12px;color:#000000;\">QuickTime Player</span></td></tr>";
		
		playerForm += "<tr><td width=\"12\" bgcolor=\"#FFFFFF\" height=\"21\" align=\"center\">&nbsp;</td><td width=\"12\" bgcolor=\"#FFFFFF\" height=\"21\" align=\"center\" style=\"border-bottom-style: normal; border-bottom-width: 0\"><input type=\"radio\" name=\"playerID\" value=\"\"  onClick=\"callMe('clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',event)\" "+selectedStr+"></td><td width=\"28\" bgcolor=\"#FFFFFF\" height=\"21\" style=\"border-bottom-style: normal; border-bottom-width: 0\" bordercolor=\"#000000\"><img border=\"0\" src=\"/portal/music/image/QuickTime.jpg\" width=\"23\" height=\"23\"></td><td width=\"207\" bgcolor=\"#FFFFFF\" height=\"21\" style=\"border-bottom-style: normal; border-bottom-width: 0\" bordercolor=\"#000000\"><span style=\"font-family:verdana;font-weight:bold;font-size:12px;color:#800000;\"> QuickTime Player</span></td><td width=\"37\" bgcolor=\"#FFFFFF\" height=\"21\">&nbsp;</td></tr>";

		//music_classId='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
	}
	
	playerForm +="<tr><td colspan=5 bgcolor=\"#5EB1E3\" border=0 background=\"/portal/music/image/background.jpg\" width=\"300\" heigth=\"25\"><span id=\"newMusicPlayer\"></span></td></tr>";

	//playerForm += "<tr bgcolor=\"#F5F5DC\" style=\"padding-left:10px;border-bottom:1px solid #000000;border-top:1px solid #000000;border-left:1px solid #000000;border-right:1px solid #000000;\"><td align=left ><span align=\"left\" style=\"font-family:verdana;font-weight:bold;font-size:12px;color:#000000;\">Select a Player </span></td><td align=right><span align=\"right\"><input type=\"button\" name=\"but\" value=\"Close\" onClick=\"closePopup()\" style=\"border:1 solid #000000;\"></span></td></tr>";
	playerForm +="<tr><td width=\"298\" height=\"32\" colspan=\"5\" bgcolor=\"#5EB1E3\" background=\"/portal/music/image/background.jpg\">      <table border=\"0\" cellpadding=\"0\" width=\"100%\"><tr><td width=\"57%\"></td><td width=\"19%\" style=\"border-left-style: solid; border-left-width: 2; border-right-style: solid; border-right-width: 2\">    <span align=\"left\" style=\"font-family:verdana;font-weight:bold;font-size:12px;color:#000000;\">HELP</span></td><td width=\"24%\" align=\"center\"><span align=\"right\"><input type=\"button\" name=\"but\" value=\"Close\" onClick=\"closePopup()\" style=\"border:1 solid #000000;font-size:10px;\"></span></td></tr></table></td></tr>";

	playerForm +="</table>";
	playerForm +="</div>";
	document.writeln(playerForm);
}

function callMe(playerid,e){
	classId = playerid;
	set_cookie_classId("musClassID",classId);
	playMusic(e);
}


function playMusic(e){
	//var musicFile = musicFilePath;
	//alert(musicFile);	
	setEmbed('newMusicPlayer',musicFilePath,classId);
}
/////////////////////////////////////////////////////////////
function justPlay(playerId){
	//if(element)
		//element.innerHTML="";
	knownPlayer = document.getElementById("newMusicPlayer");
	//alert("JSU"+"/"+knownPlayer+musicFilePath)
	var playerStr = "";
	playerStr +='<object type=\"'+getMimeType()+'\" classid=\"'+playerId+'\" data=\"'+musicFilePath+'\" width=\"1\" height=\"1\"><param name=\"src\" value=\"'+musicFilePath+'\" /><param name=\"controller\" value=\"true\" /><param name=\"autoplay\" value=\"true\" /><param name=\"autostart\" value=\"1\"/><param name=\"pluginurl\" value=\"\" /><embed src=\"'+musicFilePath+'\" type=\"'+getMimeType()+'\" width=\"1\" height=\"1\" autostart=\"true\" controller=\"true\" enablejavascript=\"true\"></embed></object>';
	//alert(playerStr)
	knownPlayer.innerHTML=playerStr;
	//alert(knownPlayer.innerHTML)
}
/////////////////////////////////////////////////////////////
function closePopup(){
	divPlayer_Pop.style.visibility="hidden";
	if(element)
		element.innerHTML="";
	if(knownPlayer)
		knownPlayer.innerHTML="";

	thisObjtemp.innerHTML="<img src=\"/portal/valentine/play.jpg\" border=\"0\" width=\"60\" height=\"19\" align=\"absMiddle\" alt=\"Listen\">";
	//fnPlayMusic(thisObjtemp,musicFilePath,divIdtemp);
}
/////////////////////////////////////////////////////////////
function get_cookie_classId(cookie_name){
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );
  if ( results )
    return ( unescape ( results[1] ) );
  else
    return null;
}
function set_cookie_classId(name,value){
  var cookie_string = name + "=" + escape ( value );
  document.cookie = cookie_string;
}
/////////////////////////////////////////////////////////////
//http://www.scriptasylum.com/misc/popup/popup.html
////////////////////////////////////////////////////////////
var iMousePosX = 0; 
var iMousePosY = 0; 

var iOrigObjTop; 
var iOrigObjLeft; 

var iDragObjTopDiff; 
var iDragObjLeftDiff; 

var rightclick = false; 
var oDragObj = null; 
// Start dragging 
function dragPiece(sourceObject) { 
// Change object style. 
//sourceObject.className = "tagdrag"; 

// Remember original object position. 
iOrigObjTop = parseInt(sourceObject.style.top); 
iOrigObjLeft = parseInt(sourceObject.style.left); 

iDragObjTopDiff = iMousePosY - iOrigObjTop; 
iDragObjLeftDiff = iMousePosX - iOrigObjLeft; 
oDragObj = sourceObject; 
} 

// Stop dragging 
function drop() { 
	//oDragObj.className = "tagnormal"; 
	oDragObj = null; 
} 
// Process mouse movement. 
function getMouseXY(posX, posY) { 
iMousePosX = posX; 
iMousePosY = posY; 

// Move object, if dragging. 
if (oDragObj != null) { 
oDragObj.style.top = (iMousePosY - iDragObjTopDiff) + "px"; 
oDragObj.style.left = (iMousePosX - iDragObjLeftDiff) + "px"; 
} 
}
// Mouse movement event handler 
function getMouseXYPos(e) { 
if (!e) var e = window.event; 
getMouseXY(e.clientX + document.body.scrollLeft, 
e.clientY + document.body.scrollTop); 
return true; 
} 
window.document.onmousemove = getMouseXYPos;
//////////////////////////////////////////////////////////
//<param NAME=\"ShowControls\" VALUE=\"False\"><param NAME=\"ShowStatusBar\" VALUE=\"False\">
//////////////////////////////////////////////////////////