function openNew(urlToOpen){
	window.open(urlToOpen, '', 'height=350,width=650,scrollbars=yes,resizable=no,location=no');
}

function openPayoutTable(urlToOpen){
	window.open(urlToOpen, "FreeMyMusic", "height=700,width=900,location=no,menubar=no,resizable=no,titlebar=yes,scrollbars=yes");
}

function openHSW(urlToOpen){
	window.open("hsw/main.html", "FreeMyMusic", "height=500,width=500,location=no,menubar=no,resizable=no,titlebar=yes,scrollbars=yes");
}


function postback(url){

	var root = document.form3;
    var url  = url;

    root.action = url;
    root.method = "POST";
    root.submit();


}//End postback


function valSendToFriend(){

	var errorCount = 0;
	var errorMessage = "";

	if(document.form_sendtoafriend.firstName.value.length == 0){
		errorCount++;
		errorMessage += "*	Enter a Name\n"
	}
	

	var valid = false;
	for(counter = 0; counter < document.form_sendtoafriend.emailtype.length; counter++){
		if(document.form_sendtoafriend.emailtype[counter].checked){
			valid = true;
		}
	}
	
	if(!valid){
		errorCount++;
		errorMessage += "*	Select the Type of Email to Send\n"
	}
	
	
	if(errorCount > 0 ){
	
		errorMessage = "There was an error with your form.  Please review the below items and correct\n==================================================\n"+errorMessage;
		alert(errorMessage);
		return false;
	
	}else{
	
		return true;
		
	}

}

function goTo(URL){

	var URL;
	document.location = URL;

}



function returnHome(){
	document.location = "http://www.freemymusic.com";
}

function viewMyPost(fid, cid){

	var fid = fid;
	var cid = cid;
	
	document.location = "detailedinfo.php?fid="+fid+"&cid="+cid+"";
	
}

function confirmDeleteVote(){


	
	if(confirm("Are you sure you want to retract your vote?")){
	
		return true;
	}else{
		return false;
	}
	
}//End


function fanClubMap(bandId){

	var bandId = bandId;
	var page   = "fanclubmap.php?bid="+bandId;
	
	window.open(page, '', 'height=446,width=800')


}

//added by sajeev

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isActive=false;

function MoveInit(e){
  topOne=isIE ? "BODY" : "HTML";
  whichOne=isIE ? document.all.FloatingLayer : document.getElementById("FloatingLayer");  
  ActiveOne=isIE ? event.srcElement : e.target;  
  while (ActiveOne.id!="titleBar"&&ActiveOne.tagName!=topOne){
    ActiveOne=isIE ? ActiveOne.parentElement : ActiveOne.parentNode;
  }  
  if (ActiveOne.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichOne.style.left);
    nowY=parseInt(whichOne.style.top);
    MoveEnabled=true;
    document.onmousemove=Move;
  }
}

function Move(e){
  if (!MoveEnabled) return;
  whichOne.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichOne.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function MoveN4(whatOne){
  if (!isN4) return;
  N4=eval(whatOne);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isActive){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function ToggleFloatingLayer(DivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[DivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(DivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[DivID].style.visibility = iState ? "visible" : "hidden";
    }
}
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 getCookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++){
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}
	return null;
}

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

function searchClose(){
			createCookie('customsearch',1,'120');
			var dsDiv = document.getElementById("FloatingLayer");
			dsDiv.style.visibility="hidden";			
	}

// added by sajeev	

