<!--
//if (window != top) top.location.href = location.href;
function formHandler(){ var URL = document.form.site.options[document.form.site.selectedIndex].value; window.location.href = URL; }
function track(url) { var Win = window.open(url,"track",'width=430,height=250,resizable=yes,scrollbars=yes,menubar=no,status=no' ); }
function code(url) { var Win = window.open(url,"code",'width=430,height=335,resizable=yes,scrollbars=yes,menubar=no,status=no' ); }
var _CC=null;
var _CF=(document.cfrm)?document.cfrm.clh:null;
function Tong(i)
{
if (i && i!=_CC) Ch(_CC,'')
Ch(i,'<< Please wait, song is opening... >>');
_CC=i;
if (_CF) _CF.value=i;
if (i) setTimeout('Ch("'+i+'","")',5000);
}
function Ch(i,t)
{
var ot=eval("document.all.iva"+i);
if (ot && t!=null) ot.innerText=t;
}

var defaultStr = 'Type keywords here';
cap_ck = 0;


var persistmenu="yes"
var persisttype="sitewide"

if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.submenu{display: block;}\n')
document.write('</style>\n')
}




function playmidi(a)
{
var playid='play'+a

if(document.getElementById(playid).className=='butstop')
{
	stop()
	document.getElementById(playid).className='playbut'
	return false
}
else
{
	document.getElementById(playid).className='butstop'
	play(a)
	setTimeout("clearit('"+playid+"')",5000) 
}
//EOF
}
 	 
 
function clearit(cid)
{document.getElementById(cid).className='playbut'}

	 
function tag_show()
{document.getElementById('tagadd').style.display = 'block';}


function play(id)
{
	carryon=true
	sound = "http://www.hamienet.com/"+id+".mid";
	if (CheckIsIE() == true) 
	{
	type="<bgsound src='" + sound + "'>" 
	
	parent.invisible.document.close()   
	parent.invisible.document.write(type)  
	parent.invisible.document.close()
	document.getElementById('play'+id).blur()
	window.parent.focus()
	} else {  
	type="<embed src=\"" + sound + "\" autostart='true'>"  
	document.location.href=sound  
	}
}
 
function stop() {
	carryon=false
	parent.invisible.document.close()
	parent.invisible.document.write("Stopped")
	parent.invisible.document.close()
}

function CheckIsIE() 
{ 
    if  (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER')  {return true;} 
    else { return false; } 
}







function showAd(ad) {
	obj = document.getElementById("ad_" + ad);
	bgObj = document.getElementById("bg_" + ad);

	offsetX = 0;
	offsetY = 0;

	while (obj.nodeName != "BODY") {
		offsetX += obj.offsetLeft;
		offsetY += obj.offsetTop;
		obj = obj.offsetParent;
	}

	bgObj.style.left = offsetX;
	bgObj.style.top = offsetY;
	bgObj.style.display = "";
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("avail").getElementsByTagName("span");
		if(el.style.display != "block") {
//			for (var i=0; i<ar.length; i++){
//				if (ar[i].className=="submenu")
//				ar[i].style.display = "none";
//			}
			el.style.display = "block";
		} else {
			el.style.display = "none";
		}
	}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate











function UserAgent() 
{
  var b=navigator.appName.toUpperCase();

  if (b=="NETSCAPE") this.b="ns";
  else if (b=="MICROSOFT INTERNET EXPLORER") this.b="ie";
  else if (b=="OPERA") this.b="op";
  else this.b=b;

  this.version=navigator.appVersion;
  this.v=parseInt(this.version);

  this.ns=(this.b=="ns" && this.v>=4);
  this.ns4=(this.b=="ns" && this.v==4);
  this.ns5=(this.b=="ns" && this.v==5);

  this.ie=(this.b=="ie" && this.v>=4);
  this.ie4=(this.version.indexOf('MSIE 4')>0);
  this.ie5=(this.version.indexOf('MSIE 5')>0);
  this.ie55=(this.version.indexOf('MSIE 5.5')>0);
  this.ie6=(this.version.indexOf('MSIE 6')>0);

  this.op = (this.b=="op");
  this.op4 = (this.b=="op" && this.v==4);
  this.op5 = (this.b=="op" && this.v==5);
}

at=new UserAgent();

//if you want to create the frame or layer dynamically, do not
//specify a name, do something like this, new exchanger();

function exchanger(name)
{
  //hold the dynamically created iframe or layer
  this.lyr = null;

  //to remember if the iframe or layer is created dynamically.
  this.isDynamic = false;

  this.name=name||"";
  this.fakeid=0;

  if (name == null || name=="")
  {
    this.isDynamic = true;
    this.create();
  }
  else
  {
    this.name=name;
    if (at.ns4)
    {
      this.lyr = window.document.layers[this.name];
    }
  }
}

//this function should not be called directly
exchanger.prototype.create=function()
{
  if (at.ns4) 
  {
    this.lyr=new Layer(0);
    this.visibility = "hide";
  }
  else if (at.ie || at.ns5) 
  {
    this.lyr=document.createElement("IFRAME");
    this.lyr.width=0;
    this.lyr.height=0;
    this.lyr.marginWidth=0;
    this.lyr.marginHeight=0;
    this.lyr.frameBorder=0;
    this.lyr.style.visibility="hidden";
    this.lyr.style.position="absolute";
    this.lyr.src="";
    this.name="tongIFrame"+window.frames.length;
    //this will make IE work.
    this.lyr.setAttribute("id",this.name);
    //this will make netscape work.
    this.lyr.setAttribute("name",this.name);
    document.body.appendChild(this.lyr);
  }
}

exchanger.prototype.sendData=function(url)
{
  this.fakeid += 1;
  var newurl = "";
  if (url.indexOf("?") >= 0)
    newurl = url + "&fakeId" + this.fakeid;
  else
    newurl = url + "?fakeId" + this.fakeid;

  if (this.isDynamic||at.ns4)
    this.lyr.src=newurl;
  else
  {
    if (at.ie || at.ns5 || at.op)
    {
      window.frames[this.name].document.location.replace(newurl);
    }
  }
}


exchanger.prototype.retrieveData=function(varName)
{
  if (at.ns4) 
  {
    return eval("this.lyr." + varName);
  }
  else if (at.ie || at.ns5 || at.op) 
  {
    return eval("window.frames['" + this.name + "']." + varName);
  }
}


















if (document.layers) {navigator.family = "nn4"}
if (document.all) {navigator.family = "ie4"}
if (window.navigator.userAgent.toLowerCase().match(/gecko/)) {navigator.family = "gecko"}
if (window.navigator.userAgent.toLowerCase().indexOf('opera') != -1) {navigator.family	= 'opera';}
toplevel="4";

function riseup (box) {
toplevel++;
if (navigator.family == "ie4")
	{document.all[box].style.zIndex = toplevel;}
if (navigator.family == "opera" || navigator.family == "gecko")
 	{document.getElementById(box).style.zIndex = toplevel;}
}

function tabimage(rno) {
	if (document.tabkk1) {
	document.getElementById('tab1').className='tabunsel';
	document.getElementById('atab1').className='tabunsel';
	}
	if (document.tabkk2) {
	document.getElementById('tab2').className='tabunsel';
	document.getElementById('atab2').className='tabunsel';
	}
	if (document.tabkk3) {
	document.getElementById('tab3').className='tabunsel';
	document.getElementById('atab3').className='tabunsel';
	}


var tmp = document.getElementById(rno);
var tmpb = document.getElementById('a'+rno);
tmp.className='tabsel';
tmpb.className='tabsel';

if (document.midi) {document.midi.src='/graphic/gif/title-bar-midi-s.gif';}
if (document.lyrics) {document.lyrics.src='/graphic/gif/title-bar-lyrics-s.gif';}
if (document.gtab) {document.gtab.src='/graphic/gif/title-bar-gtab-s.gif';}

if (rno == "tab1")
	{document.midi.src='/graphic/gif/title-bar-midi-more.gif';}
else if (rno == "tab2")
	{document.lyrics.src='/graphic/gif/title-bar-lyrics.gif';}
else if (rno == "tab3")
	{document.gtab.src='/graphic/gif/title-bar-gtab.gif';}

}


FullStar = new Image();
FullStar.src = "http://www.hamienet.com/graphic/png/stars/full_dp.png";		
FullStar2 = new Image();
FullStar2.src = "http://www.hamienet.com/graphic/png/stars/full_dp.png";	
FullStarRed = new Image();
FullStarRed.src = "http://www.hamienet.com/graphic/png/stars/full_dp.png";

HalfStar = new Image();
HalfStar.src = "http://www.hamienet.com/graphic/png/stars/half_dp.png";	
HalfStar2 = new Image();
HalfStar2.src = "http://www.hamienet.com/graphic/png/stars/half_dp.png";	
HalfStarRed = new Image();
HalfStarRed.src = "http://www.hamienet.com/graphic/png/stars/half_dp.png";

EmptyStar = new Image();
EmptyStar.src = "http://www.hamienet.com/graphic/png/stars/empty_dp.png";
EmptyStar2 = new Image();
EmptyStar2.src = "http://www.hamienet.com/graphic/png/stars/empty_dp.png";
EmptyStarRed = new Image();
EmptyStarRed.src = "http://www.hamienet.com/graphic/png/stars/empty_dp.png";

function OnStar(StarPos, SongID, UserRated, isMVFlag){
	if(document.images){
		if (UserRated ==0){
			if(isMVFlag == 1) {
				document["Star" + StarPos + "_" + SongID].src=FullStarRed.src;
			} else {
				document["Star" + StarPos + "_" + SongID].src=FullStar.src;
			}
		}
		else {
			document["Star" + StarPos + "_" + SongID].src=FullStar2.src;
		}	
		
		for (i=1;i<StarPos; i++){
			if (UserRated ==0){
				if(isMVFlag == 1) {
					document["Star" + i + "_" + SongID].src=FullStarRed.src;
				} else {
					document["Star" + i + "_" + SongID].src=FullStar.src;
				}
			}
			else {
				document["Star" + i + "_" + SongID].src=FullStar2.src;
			}			
		}
		
		for (i=StarPos+1;i<6; i++){
			if (UserRated ==0){
				if(isMVFlag == 1) {
					document["Star" + i + "_" + SongID].src=EmptyStarRed.src;
				} else {
					document["Star" + i + "_" + SongID].src=EmptyStar.src;
				}
			}
			else {
				document["Star" + i + "_" + SongID].src=EmptyStar2.src;;
			}				
		}	
	}
	return false;
}
function OffStar(StarPos, SongID, Star, Rating, UserRated, isMVFlag){	
	var tempvar=Rating;
	if (tempvar.indexOf(".")==1){
		var mysplit=tempvar.split(".");
		var posValue1=mysplit[0];
		var posValue2=mysplit[1];
	} else {
		var posValue1=Rating;
		var posValue2="0";
	}
	posValue1=parseInt(posValue1);
	posValue2=parseInt(posValue2);

	if(document.images){	
		if (Rating != 0){
			//------ Brings Back Full Stars to Original	------		
			for (x=1; x< posValue1+1; x++){				
				if (UserRated ==0){
					if(isMVFlag == 1) {
						document["Star" + x + "_" + SongID].src=FullStarRed.src;
					} else {
						document["Star" + x + "_" + SongID].src=FullStar.src;
					}
				} else {
					document["Star" + x + "_" + SongID].src=FullStar2.src;
				}					
			}	
			
			//------ Brings Back Half Stars to Original ------
			if (posValue2 != 0){
				if (UserRated ==0){
					if(isMVFlag == 1) {
						document["Star" + x + "_" + SongID].src=HalfStarRed.src;
					} else {
						document["Star" + x + "_" + SongID].src=HalfStar.src;
					}
				}
				else {
					document["Star" + x + "_" + SongID].src=HalfStar2.src;
				}					
				x = x + 1;
			}	
			
			//------ Brings Back Empty Stars to Original -------
			if (6 - x != 0){			
				for (a=x; a < 6; a++){
					if (UserRated ==0){
						if(isMVFlag == 1) {
							document["Star" + a + "_" + SongID].src=EmptyStarRed.src;
						} else {
							document["Star" + a + "_" + SongID].src=EmptyStar.src;
						}
					}
					else {
						document["Star" + a + "_" + SongID].src=EmptyStar2.src;
					}					
				}			
			}	
			//--------------------------------------------------
		}
		else {
			
			for (x=1; x<6; x++){	
				if (UserRated ==0){
					if(isMVFlag == 1) {
						document["Star" + x + "_" + SongID].src=EmptyStarRed.src;
					} else {
						document["Star" + x + "_" + SongID].src=EmptyStar.src;
					}
				}
				else {
					document["Star" + x + "_" + SongID].src=EmptyStar2.src;
				}					
			}	
		}		
	}
	return false;
}


function RateSong(Rating,SongID,Site){
	var theBuffer;
	theBuffer = new exchanger();
	theBuffer.sendData(Site + "/index.iva?i=2&a=rate&id=" + SongID + "&rate=" + Rating);
//	window.open(Site + "/index.iva?i=2&a=rate&id=" + SongID + "&rate=" + Rating, "RateSong", "width=1, height=1");
	document.getElementById('voteresult').innerHTML = "<B>Rating Submitted!</B>";
}

function RateReview(ReviewID,extra){
	var theBuffer;
	theBuffer = new exchanger();
	theBuffer.sendData("http://www.hamienet.com/index.iva?i=7&a=qhelpful_review&review_id=" + ReviewID + extra);
	document.getElementById('reviewresult'+ReviewID).innerHTML = "<B class=gensmall>Thanks for voting!</B>";
}

function SubmitReview(SongID) {
	var content=escape(document.getElementById('Review_Contents').value);
			content=content.replace("+", "%2B");
		  content=content.replace("/", "%2F");
  var subject=escape(document.getElementById('Review_Subject').value);
			subject=subject.replace("+", "%2B");
		  subject=subject.replace("/", "%2F");
	var guestname=escape(document.getElementById('Review_GuestName').value);
			guestname=guestname.replace("+", "%2B");
		  guestname=guestname.replace("/", "%2F");
  var rating=getRadioValue('Review_Rating');

  if (document.getElementById('Review_Contents').value == "") {
    alert( "Please enter your comment." );
    return false;
  }
  if (document.getElementById('Review_Subject').value == "") {
    alert( "Please enter a subject." );
    return false;
  }
  if (document.getElementById('Review_GuestName').value == "") {
    alert( "Please enter your name." );
    return false;
  }
  if (guestname == "1") {
  	guestname="";
  }
  if (rating == undefined) {
    alert( "Please select a rating." );
    return false;
  }
	var theBuffer;
	theBuffer = new exchanger();
	document.getElementById('pcomment').innerHTML = "<B>Posting...</B>";
	theBuffer.sendData("http://www.hamienet.com/index.iva?i=7&a=add_this_review&id=" + SongID + "&Review_Rating="+rating+"&Review_Subject="+subject+"&Review_Contents="+content+"&Review_GuestName="+guestname);
	document.getElementById('pcomment').innerHTML = "<B class=gensmall>Thanks for your comment!</B>";
}

function getRadioValue(radioGroupName) {
    radios = document.getElementsByName(radioGroupName);
    for (i = 0; i < radios.length; i++) {
        if (radios[i].checked) return radios[i].value;
    }
}

function sendtoVersion(songID, mainSongID) {
	if (songID != "") {
		if (songID == mainSongID) {
			window.location = "./getsong-songid-" + songID + ".html";
		} else {
			window.location = "./getsong-version-" + songID + ".html";
		}
	}
	return false;
}



function filterTable(tableName,filter) {
  rows = document.getElementById(tableName).tBodies[0].rows;
  for (var i=0; i<rows.length; i++) {
    if (filter.match("<All>")) {
      rows[i].style.display = '';
    } else {
        data =  rows[i].className;
        if (data != null && data.match(filter)) {
          rows[i].style.display = '';
        } else {
          rows[i].style.display = 'none';
        }
    }
  }
}



// for comment/link views
	function startLoading() {
	  Element.show('mainAreaLoading');
	  Element.hide('commentlist');
	}
	function finishLoading() {
	  Element.show('commentlist');
	  setTimeout("Effect.toggle('mainAreaLoading');", 1000);
	}
 
	function loadContent(id,page,urltype,sort) {
	  startLoading();
	  if (urltype == 2) {
	  	new Ajax.Updater('commentlist', 'index.iva', {method: 'post', postBody:'i=7&a=include_reviews&mh=10&id='+ id +'&nh='+page+''});
	  } else {
	  	new Ajax.Updater('commentlist', 'index.iva', {method: 'post', postBody:'i=6&a=link_list&&cat_id='+ id +'&nh='+page+'&sort='+sort+''});
	  }
	  finishLoading();
	}

// expandable menu
function switchMenu(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	} else {
		el.style.display = '';
	}
}

// label select change CSS style
function labelsel(tab) {
	for (var i=1; i<5; i++) {
		document.getElementById("label"+i).className = "label";
	}
	document.getElementById("label"+tab).className = "label_sel";
}

// upload form
function checkform ( form )
{
  if (form.Title.value == "") {
    alert( "Please enter a title for your MIDI" );
    form.Title.focus();
    return false;
  }
  if (form.temp_file.value == "") {
    alert( "Please select a MIDI for this submission" );
    form.temp_file.focus();
    return false;
  }
  if (form.temp_file.value.lastIndexOf(".mid")==-1 && form.temp_file.value.lastIndexOf(".kar")==-1) {
   alert("Please upload only .mid or .kar extention file");
   form.temp_file.focus();
   return false;
	}
  if (form.Description.value == "") {
    alert( "Please enter a description for your MIDI" );
    form.Description.focus();
    return false;
  }
  if (form.Tags.value == "") {
    alert( "Please enter tags (keywords) for your MIDI" );
    form.Tags.focus();
    return false;
  }
  if (form.cat_id.value == "") {
    alert( "Please select a category best suit your MIDI" );
    form.cat_id.focus();
    return false;
  }
  form.add.value = "Uploading...";
  form.add.disabled = true;
  return true;
}





function confirmDelete()
{
var agree=confirm("Are you sure you wish to delete the selected MIDI?");
if (agree)
	return true ;
else
	return false ;
}

function confirmDeleteMP3()
{
var agree=confirm("Are you sure you wish to delete your MP3 version?");
if (agree)
	return true ;
else
	return false ;
}





// Fastclick IS
/*
var min=15; // frequency cap in minutes, set to 15 or more
var sid=1462;
document.writeln('<scr'+'ipt language="javascript" src="http://code.fastclick.net/is.js"></scr'+'ipt>');
*/

// Fastclick IS - with indiv link
function FCx(x){
  var min=15; // minimum minutes between interstitials (needs to be >15)
  if(x.indexOf('get.media')>0){
    x=unescape(x.substring(x.indexOf('&url=')+5,x.length));
  }else{
    if(document.cookie.indexOf('CxIC=1')<=0){
      x='http://media.fastclick.net/w/get.media?sid=1462&m=5&tp=6&url='+escape(x);
      var date_ob=new Date();
      date_ob.setTime(date_ob.getTime()+min*1000*60);
      document.cookie='FCxIC=1; path=/; expires='+date_ob.toGMTString();
    }
  }
  return x
}

// Casale PopU
var casaleD=new Date();var casaleR=(casaleD.getTime()%8673806982)+Math.random();
var casaleU=escape(window.location.href);
var casaleHost=' type="text/javascript" src="http://as.casalemedia.com/s?s=';
document.write('<scr'+'ipt'+casaleHost+'53332&amp;u=');
document.write(casaleU+'&amp;f=1&amp;id='+casaleR+'"><\/scr'+'ipt>');

// Fastclick PopU
var dc=document; var date_ob=new Date();
dc.cookie='h2=o; path=/;';var bust=date_ob.getSeconds();
if(dc.cookie.indexOf('e=llo') <= 0 && dc.cookie.indexOf('2=o') > 0){
dc.write('<scr'+'ipt language="javascript" src="http://media.fastclick.net');
dc.write('/w/pop.cgi?sid=1462&m=2&tp=2&v=1.8&c='+bust+'"></scr'+'ipt>');
date_ob.setTime(date_ob.getTime()+14400000);
dc.cookie='he=llo; path=/; expires='+ date_ob.toGMTString();} 


// Fastclick inVue
 var vc_rand = Math.floor(Math.random() * 7777);

  // Used to verify that we can set cookies
  //
  document.cookie = 'h2=o; path=/;';

  // Get the current window size to ensure we can view our ad
  //
  var vc_window_wt = 0;
  var vc_window_ht = 0;
  if (window.innerWidth && window.innerHeight) {
      vc_window_wt = window.innerWidth;
      vc_window_ht = window.innerHeight;
  }
  else if (document.documentElement.clientWidth > 0 && document.documentElement.clientHeight > 0) {
      vc_window_wt = document.documentElement.clientWidth;
      vc_window_ht = document.documentElement.clientHeight;
  }
  else {
      vc_window_wt = document.body.clientWidth;
      vc_window_ht = document.body.clientHeight;

      if (vc_window_ht > 1024) {
          vc_window_ht = 1024;
      }
  }

  if (document.cookie.indexOf('n=vue') <= 0 && document.cookie.indexOf('2=o') > 0) {
      document.write('<scr'+'ipt language="javascript" src="http://media.fastclick.net');
      document.write('/w/get.media?sid=1462&tm=12&m=4&tp=4&c=' + vc_rand);
      document.write('&window_ht=' + vc_window_ht + '&window_wt=' + vc_window_wt + '"></scr'+'ipt>');
  }


// Rydium PopUnder
/*
var date_ob=new Date();
if(document.cookie.indexOf('_7_2')<=0){
 document.write('<scr'+'ipt language="javascript" src="http://z1.adserver.com/w/cp.x;rid=169;tid=2;ev=1;dt=1;ac=7;c=979;"></scr'+'ipt>');
 date_ob.setTime(date_ob.getTime()+(1000*60*720));
 document.cookie='p_7_2=1; path=/; expires='+ date_ob.toGMTString();
}
*/

/* HamieNET.com */
// End -->
