 /*** function that will preload images ***/
/*
  var myimages=new Array();
  function preloadimages(){
   for(i=0;i< preloadimages.arguments.length;i++){
     myimages[i]=new Image();
     myimages[i].src=preloadimages.arguments[i];
    }
  }
  preloadimages("first.gif","first_over.gif","firstdisab.gif",
                "prod1.jpg", "last.gif", "last_over.gif", "Lastdisab.gif",
                "next.gif", "next_over.gif", "Nextdisab.gif", "play_song.gif",
                "playall.gif", "prev.gif", "prev_over.gif", "prevdisab.gif");
*/

 // function openPlayer(url){
 //   popupWin = window.open(url,'player','width=<?php= $player_w?>,height=<?php= $player_h?>,scrollbars=no,resizable=no,menubar=no');
 //   if (window.focus) {popupWin.focus()}
 // }
 	var playAjax = "&playAjax=kxveJNfZS1nRW5s6EbQrzTp4";
  var AlbumPlayer = "player/playAlbum.php?queryWhere=PlayID&queryValue=";

  function confirm_entry(){
    input_box=confirm("Click OK or Cancel to Continue");
    if (input_box==true){
      // Output when OK is clicked
      alert ("You clicked OK");
    }else{
      // Output when Cancel is clicked
      alert ("You clicked cancel");
    }
  }

  /*
   function openPlayer(id){
    var url = player + id;
    popupWin = window.open(url,'player','width='+playerw +',height='+playerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
 */
  function openPlayerAll(){
    var url = player + playlist + playAjax;
    popupWin = window.open(url,'player','width='+playerw +',height='+playerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
  
  function openPlayAlbum_OLD(img_cover){
    var ALplayerw = 550,  ALplayerh = 285;
    //var AlbumPlayer = "player/playAlbum.php?queryWhere=PlayID&queryValue=";
    var cover = "" ;
    var cover = "&cover=" + img_cover ;
    var url =  "" ;
    url = AlbumPlayer + playlist + cover + playAjax;
    popupWin = window.open(url,'AlbumPlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
	
	function openPlayAlbumNEW(){
    //var AlbumPlayer = "player/blackdawn.php?queryWhere=PlayID&queryValue=";
	var ALplayerw = 450,  ALplayerh = 125;
		var albumlist = document.getElementById('AlbumList').value;
    var url =  "" ;
		//var ajax = "&ajax=kxveJNfZS1nRW5s6EbQrzTp4";
		//var ajax = "&ajax=kxveJNfZS1nRW5s6EbQrzTpx";
    url = AlbumPlayer + albumlist + playAjax;
		//alert(url)
    popupWin = window.open(url,'AlbumPlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
  
  function openPlayAlbum(img_cover){
    //var AlbumPlayer = "player/blackdawn.php?queryWhere=PlayID&queryValue=";
	var ALplayerw = 550,  ALplayerh = 285;
	var albumlist = document.getElementById('AlbumList').value;
		
	var cover = "" ;
    var cover = "&cover=" + img_cover ;
	
    var url =  "" ;
		//var ajax = "&ajax=kxveJNfZS1nRW5s6EbQrzTp4";
		//var ajax = "&ajax=kxveJNfZS1nRW5s6EbQrzTpx";
	url = AlbumPlayer + albumlist + cover + playAjax;	
   // url = AlbumPlayer + albumlist + playAjax;
		//alert(url)
    popupWin = window.open(url,'AlbumPlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
  
  function openPlayAlbumList(AlbumID){
    var ALplayerw = 550,  ALplayerh = 285;
		//var albumlist = document.getElementById('AlbumList').value;
		var AlbumPlayerList =   "player/playAlbumList.php?queryWhere=PlayID&AlbumID=" +AlbumID;
    var url =  "" ;
    url = AlbumPlayerList + playAjax;
		//alert(url)
    popupWin = window.open(url,'AlbumPlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
  
  function openPlayAlbumList_vntr_org(AlbumID){
    var ALplayerw = 550,  ALplayerh = 285;
		//var albumlist = document.getElementById('AlbumList').value;
	var AlbumPlayerList =   "player_vntr_org/playAlbumList.php?queryWhere=PlayID&AlbumID=" +AlbumID;
    var url =  "" ;
    url = AlbumPlayerList + playAjax;
		//alert(url)
    popupWin = window.open(url,'AlbumPlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  } 
  
  function openPlayerNEW(img_cover, SongID){
    var ALplayerw = 450,  ALplayerh = 125;
    //var AlbumPlayer = "player/playone.php?queryWhere=PlayID&queryValue=";
    var cover = "" ;
    var cover = "&cover=" + img_cover ;
    var url =  "" ;
    url = AlbumPlayer + SongID + cover + playAjax;
    popupWin = window.open(url,'AlbumPlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
   function openPlayer(img_cover, SongID){
    var ALplayerw = 550,  ALplayerh = 285;
    //var AlbumPlayer = "player/playone.php?queryWhere=PlayID&queryValue=";
    var cover = "" ;
    var cover = "&cover=" + img_cover ;
    var url =  "" ;
    url = AlbumPlayer + SongID + cover + playAjax;
    popupWin = window.open(url,'AlbumPlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
	
	function openKaraoke(img_cover, SongID, LID){
    var ALplayerw = 570,  ALplayerh = 550;
    var KaraokePlayer = "player/playKaraoke.php?queryWhere=PlayID&queryValue=";
    var cover = "&cover=" + img_cover ;
		var LyricID = "&LyricID=" + LID ;
    var url =  "" ;
    url = KaraokePlayer + SongID + cover + playAjax + LyricID;
    popupWin = window.open(url,'KaraokePlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=yes,resizable=yes,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
  
	
	function openOne(img_cover, SongID){
    var ALplayerw = 382,  ALplayerh = 52;
    var SongPlayer = "player/playone.php?queryWhere=PlayID&queryValue=";
    var cover = "" ;
    var cover = "&cover=" + img_cover ;
    var url =  "" ;
    url = SongPlayer + SongID + cover + playAjax;
    popupWin = window.open(url,'PlayOne','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
  
  function openPlayAlbum2(img_cover){
    var ALplayerw = 520,  ALplayerh = 300;
    var AlbumPlayer2 = "player/playAlbum2.php?queryWhere=PlayID&queryValue=";
    var cover = "" ;
    var cover = "&cover=" + img_cover;
    var url =  "" ;
    url = AlbumPlayer2 + playlist + cover + playAjax;
    popupWin = window.open(url,'AlbumPlayer2','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }

  function openVideo(url){
    popupWin = window.open(url,'video','width=440,height=400,scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
	
	function openVideos(url){
    popupWin = window.open(url,'video','width=450,height=780,scrollbars=yes,resizable=yes,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
	
	function openPlayer_old(url){
    popupWin = window.open(url,'player','width=<?php= $player_w?>,height=<?php= $player_h?>,scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
  
function openImage(url){
	popupWin = window.open(url,'image','width=500,height=500,scrollbars=no,resizable=yes,menubar=no');
	if (window.focus) {popupWin.focus()}
} 

function openPresetList(url){
	popupWin = window.open(url,'pre_list','width=500,height=500,scrollbars=yes,resizable=yes,menubar=no');
	if (window.focus) {popupWin.focus()}
}  

function ShowImage(url,w,h){
	//popupWin = window.open(url,'image','width='+w+',height='+d+',scrollbars=no,resizable=yes,menubar=no');
	popupWin = window.open(url,'image','width=10,height=10,scrollbars=no,resizable=yes,menubar=no');
	if ( w > 800 ) {
		var ratio = w / 800 ;
		w = 800 ;
		h = h / ratio;
	}
	w += 25;
	h += 100;
	popupWin.resizeTo(w, h);
	if (window.focus) {popupWin.focus()}
}  
	
  
  function openSelectPlayer(){
    listsongselect = readCookie("SelectSong");
    var ALplayerw = 550,  ALplayerh = 285;
    //var AlbumPlayer = "player/playAlbum.php?queryWhere=SongID&queryValue=";
    var url =  "" ;
    url = AlbumPlayer + listsongselect + playAjax;
    popupWin = window.open(url,'AlbumPlayer','width='+ALplayerw +',height='+ALplayerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }

  function openSelectPlayer_old(){
    listsongselect = readCookie("SelectSong");
    var url = player + listsongselect + playAjax;
    popupWin = window.open(url,'player','width='+playerw +',height='+playerh +',scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }

  function checkb1(song) {
    //songselect = document.getElementById("result").value
    //document.getElementById("result").value = songselect + "|" + song;
    //listsongselect = document.getElementById("result").value;
    songselect = songselect + "|" + song;
    return songselect;
  }
	
  function changepage() {
    var pagelist = document.getElementById('paging')
    location = pagelist.options[pagelist.selectedIndex].value
  }
  
  function changeDropList(id) {
	var pagelist = document.getElementById(id)
    location = pagelist.options[pagelist.selectedIndex].value
  }
	

  function UncheckAll(num){
    var i = 1;
    for(i=1;i<=num;i++){
       document.getElementById(i).checked=false;
    }
    songselect = "";
  }

  function checkAll(num){
    var i = 1;
    for(i=1;i<=num;i++){
       document.getElementById(i).checked=true;
    }
    songselect = playlist;
  }


  function UpdateSelectSong(id, song){
    var iCheck = document.getElementById(id).checked;
    if(iCheck==true){
      AddSong(song);
    }else{
      RemoveSong(song);
    }
  }

  function AddSong(song) {
    //songselect = document.getElementById("result").value
    //document.getElementById("result").value = songselect + "|" + song;
    //listsongselect = document.getElementById("result").value;
    songselect = readCookie("SelectSong");
    songselect = songselect + "|" + song;
    makeCookie(songselect)
    //return songselect;
    //editCookie(songselect)
  }

  function RemoveSong(song){
    songselect = readCookie("SelectSong");
    s = new String(songselect);
   // document.write(s);
   // document.write("<br>Test Replace String<br>");
    s = s.replace(song,"");
    s = s.replace("||","|");
   // s = s.replace(/\+/g,"*pl*");
   // document.write(s);
   songselect = s ;
   //document.write(songselect)
   makeCookie(songselect)
  }

  function createCookie(name, value, days) {
    if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
  }

  function eraseCookie(name) {
    createCookie(name, "", -1);
  }

  function clearSelectSong(list) {
    createCookie(list, "", -1);
  }

  function readCookie(name) {
    var ca = document.cookie.split(';');
    var nameEQ = name + "=";
    for(var i=0; i < ca.length; i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return "";
  }

  function makeCookie(songlist) {
    createCookie("SelectSong", songlist, 3);
    //document.getElementById("my_cookie").innerHTML = readCookie("SelectSong");
    //songselect = readCookie("SelectSong");
  }

  function editCookie(songlist) {
    eraseCookie("SelectSong");
    createCookie("SelectSong", songlist, 3);
    //document.getElementById("my_cookie").innerHTML = readCookie("SelectSong");
    //songselect = readCookie("SelectSong");
  }
	
	// Control Table Alpha 
	
	function hideAll() {
		document.getElementById("lyric").style.display = "none";
		document.getElementById("song").style.display = "none";
		document.getElementById("writer").style.display = "none";
		document.getElementById("singer").style.display = "none";
		document.getElementById("popstyle").style.display = "none";
		document.getElementById("karaoke").style.display = "none"; 
		document.getElementById("video").style.display = "none"; 
		//document.getElementById("albumList").style.display = "none"; 
		document.getElementById("menuStories").style.display = "none"; 
		
  }
	
	function hideSongType() {
		document.getElementById("songtype").style.display = "none";
		//document.getElementById("karaoke").style.display = "none";
		document.getElementById("vocal").style.display = "none";
		document.getElementById("instruments").style.display = "none";
	}
	
	function hideSongTypeList() {
		document.getElementById("karaoke").style.display = "none";
		document.getElementById("vocal").style.display = "none";
		document.getElementById("instruments").style.display = "none";
	}
	
	
	function showAlpha(obj) {
		///hideAll()
		objShow = document.getElementById(obj).style
		if(navigator.appName == "Microsoft Internet Explorer"){
			objShow.width = "154px";	
		}
		objShow.display = "block";
  }
	function hideAlpha(obj) {
		objShow = document.getElementById(obj).style
		objShow.display = "none";
  }		
	
	
	/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Mark O'Sullivan :: http://lussumo.com/
 Jeff Larson :: http://www.jeffothy.com/
 Mark Percival :: http://webchicanery.com/ */
function ClipBoard(text2copy) {
  if (window.clipboardData) {
    window.clipboardData.setData("Text",text2copy);
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
}

  function popContact(url){
    popupWin = window.open(url,'contact', 'width=600,height=500,scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }
  
  function popVNEditor(url){
    popupWin = window.open(url,'vnEditor', 'width=630,height=500,scrollbars=no,resizable=no,menubar=no');
    if (window.focus) {popupWin.focus()}
  }


	// Function find position of object	
	function findPos(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
		return [curleft,curtop];
	}  
// End Function find position of object	

	function showMe(objFind, objShow, pLeft, pTop){
		hideAll();
		position = findPos(objFind);
		var obj = document.getElementById(objShow).style;
		obj.left = (position[0] + pLeft) + "px";
		obj.top = (position[1] + pTop) + "px";
		obj.display = "block";
	}
	
	function showMeSingerAlphaList(objFind, objShow, fFile, pLeft, pTop){
		hideAll();
		setTableSingerAlphaList(fFile, objShow)
		position = findPos(objFind);
		var obj = document.getElementById(objShow).style;
		obj.left = (position[0] + pLeft) + "px";
		obj.top = (position[1] + pTop) + "px";
		obj.display = "block";
	}
	
	
	function setTableSingerAlphaList(fFile,objShow){
		var fLink = "<a href=\"javascript:GetDataList('" + fFile ;
		var aOpen = "<td bgcolor=\"#ffffff\" width=\"14%\" align=\"center\">" + fLink;
		var aClose = "</strong></a></td>\n";

		document.write ("<div id=\""+objShow+"\" style=\"position:absolute;display:none;width:155px;color:#fff;border:1px solid #000;\">\n");
		document.write ("<table cellspacing=\"1\" cellpadding=\"0\" width=\"84%\" border=\"0\" style=\"border:0px solid #385585;background-color:#385585;\">\n");
   	
		document.write ("<tr>\n");
			document.write ("<td bgcolor=\"#ffffff\" align=\"center\" colspan=\"7\"></td>");
		document.write ("</tr>\n");
		document.write ("<tr>\n");
      document.write (aOpen + "A')\"><strong>A" + aClose);
      document.write (aOpen + "B')\"><strong>B" + aClose);
      document.write (aOpen + "C')\"><strong>C" + aClose);
      document.write (aOpen + "D')\"><strong>D" + aClose);
      document.write (aOpen + "DD')\"><strong>Ð" + aClose);
      document.write (aOpen + "E')\"><strong>E" + aClose);
    document.write ("</tr>\n");
    document.write ("<tr>\n");
      document.write (aOpen + "F')\"><strong>F" + aClose);
      document.write (aOpen + "G')\"><strong>G" + aClose);
      document.write (aOpen + "H')\"><strong>H" + aClose);
      document.write (aOpen + "I')\"><strong>I" + aClose);
      document.write (aOpen + "J')\"><strong>J" + aClose);
      document.write (aOpen + "K')\"><strong>K" + aClose);
      document.write (aOpen + "L')\"><strong>L" + aClose);
    document.write ("</tr>\n");
    document.write ("<tr>\n");
      document.write (aOpen + "M')\"><strong>M" + aClose);
      document.write (aOpen + "N')\"><strong>N" + aClose);
      document.write (aOpen + "O')\"><strong>O" + aClose);
      document.write (aOpen + "P')\"><strong>P" + aClose);
      document.write (aOpen + "Q')\"><strong>Q" + aClose);
      document.write (aOpen + "R')\"><strong>R" + aClose);
      document.write (aOpen + "S')\"><strong>S" + aClose);
    document.write ("</tr>\n");
    document.write ("<tr>\n");
      document.write (aOpen + "T')\"><strong>T" + aClose);
      document.write (aOpen + "U')\"><strong>U" + aClose);
      document.write (aOpen + "V')\"><strong>V" + aClose);
      document.write (aOpen + "W')\"><strong>W" + aClose);
      document.write (aOpen + "X')\"><strong>X" + aClose);
      document.write (aOpen + "Y')\"><strong>Y" + aClose);
      document.write (aOpen + "Z')\"><strong>Z" + aClose);
    document.write ("</tr>\n");

  	document.write ("</table>\n");
		document.write ("</div>\n");
	
	}
	
	
	function showMe2(objFind){
		hideAll();
		position = findPos(objFind);
		var obj = document.getElementById('album').style;
		obj.left = (position[0] + 80) + "px";
		obj.top = (position[1] + 0) + "px";
		obj.display = "block";
	}
	
	function hideMe(obj){
		document.getElementById(obj).style.display = "none";
		//document.getElementById(obj).innerHTML = "";
	}
	
	function showDataPopup(obj,url){
		document.getElementById("album").innerHTML = "";
		GetDataListPopup(url);
		showMe2(obj);
	}
	
	function showTBAlpha(obj, fWhat){
		position = findPos(obj);
		
		var objShow = document.getElementById(fWhat).style;
		//var objShow = getStyleObject("a");
		/*if(objShow.display == "block"){
			alert("thinking");
			return false;
		}*/
		objShow.left = (position[0] + 0) + "px";
		objShow.top = (position[1] + 20) + "px";
		objShow.display = "block";
		//document.getElementById('pop_alpha').style.display="block";
		//document.getElementById("a").innerHTML = "Left=" + objShow.left + "-----Top=" + objShow.top ;
	}

	function hidePopup(){
		hideAll();
		//hideMe('popstyle');
		//hideMe('album');
		//hideMe('singerAlpha');
		setInit();
		//popstyle
		//hideMe('album');
	}
	
	function setInit(){
		document.getElementById('popstyle').style.overflowX="hidden";
	}
	
	function showVideoInput(ojb) {
		if (document.getElementById('chkVideo').checked==true){
			showMe(ojb,'inputVideoForm',-465, 40);
			document.getElementById('video').focus();
		}else{
			hideMe('inputVideoForm');
		//document.getElementById('video').value="";
		}
	}
	
	function get_txt_dim(id,h){
		document.getElementById(id).style.height = h + "px";
	}
	
	function change_size(id, target) {
		var pagelist = document.getElementById(id)
		var fValue = pagelist.options[pagelist.selectedIndex].value
		get_txt_dim(target,fValue);
	}


	var c=0;
	var t;
	var iChoice = 0;
	
	function timedCount(){
		c=c+1;
		t=setTimeout("timedCount()",50000);
		if (c%2 == 0){
			Get_dynamic_data_list('get_random_album_list.php', 'randImages');
		}else{
			Get_dynamic_data_list('get_singer_homegage_header_list.php', 'albumListHeader');
		}
	}
	//timedCount();
	
	
