	function sortMusics(val)
	{	//alert(val)
		document.sort.action = "music.php";
		document.sort.submit();
	}
	
	function goToCheck(val)
	{	//alert(val);exit;
		if(val == "not downloadable"){
			alert("This song is not allowed to download");
		}else if(val == "not login"){
			alert("Login or register to download");
		}else{
			window.location = val;
		}
	}

	function checkRefineMusic()
	{	//alert(document.getElementById("recent").checked)
		if(document.getElementById("keyword").value == "" && document.getElementById("genre").value == ""){
		
			alert("Please select keyword or genre");
			return false;
		}else{
			document.refine.action = "music.php";
			document.refine.submit();
		}
	}
	
	
	function checkRefineVideo()
	{	//alert(document.getElementById("recent").checked)
		if(document.getElementById("keyword").value == "" && document.getElementById("genre").value == ""){
		
			alert("Please select keyword or genre");
			return false;
		}else{
			document.refine.action = "video.php";
			document.refine.submit();
		}
	}

	function sortArtists(val)
	{	//alert(val)
		document.sort.action = "artist.php";
		document.sort.submit();
	}

	function checkRefineCriteria()
	{	//alert(document.getElementById("genre").value)
		if(document.getElementById("keyword").value == "" && document.getElementById("genre").value == "" && document.getElementById("country_code").value == ""){
		
			alert("Please select keyword, genre or country");
			return false;
		}else{
			document.refine.action = "artist.php";
			document.refine.submit();
		}
	}

	function sortVideos(val)
	{	//alert(val)
		document.sort.action = "video.php";
		document.sort.submit();
	}

	function sortGigs(val)
	{	//alert(val)
		document.sort.action = "giglist.php";
		document.sort.submit();
	}
	
	function checkRefineCriteriaGig()
	{	//alert(document.getElementById("recent").checked)
		if(document.getElementById("genre").value == "" && document.getElementById("keyword").value == "" && document.getElementById("country_code").value == "" && document.getElementById("gig_ticket").value == "" && document.getElementById("from").value == ""){
		
			alert("Please enter refine keyword");
			return false;
		}else{
			document.refine.action = "giglist.php";
			document.refine.submit();
		}
	}

	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}
	
	
function refineProduct()
{	//alert(document.getElementById('category_id').value)
	if(document.getElementById("category_id").value == ""){
		alert("Please select a category");
		return false;
	}
	return true;
}

	function sortFans(val)
	{	//alert(val)
		document.sort.action = "fan.php";
		document.sort.submit();
	}

	function checkRefineCriteriaFan()
	{	//alert(document.getElementById("keyword").value)
		if(document.getElementById("keyword").value == "" && document.getElementById("genre").value == "" && document.getElementById("country_code").value == "" && document.getElementById("sex").value == "" && document.getElementById("age_from").value == ""){
		
			alert("Please enter any refine criteria");
			return false;
		}else{
			document.refine.action = "fan.php";
			document.refine.submit();
		}
	}

	function sortVenues(val)
	{	//alert(val)
		document.sort.action = "venue.php";
		document.sort.submit();
	}

	function checkRefineCriteriaVan()
	{	//alert(document.getElementById("keyword").value)
		if(document.getElementById("keyword").value == "" && document.getElementById("genre").value == "" && document.getElementById("country_code").value == ""){
		
			alert("Please enter any refine criteria");
			return false;
		}else{
			document.refine.action = "venue.php";
			document.refine.submit();
		}
	}
	function goToCheckUser(user_id, url)
	{	//alert(user_id);alert(url);exit;
		if(user_id > 0){
			window.location = url;
		}else{
			alert("Login or register to download");
			//return false;
		}
	}
	
	function goToSearch()
	{	
		//alert(document.getElementById("keyword").value);
		//alert(document.getElementById("mycomb1").value);
		var search_page = document.getElementById("mycomb1").value;
		var search_keyword = document.getElementById("keyword").value;
		//alert(root+search_page+"/search/"+search_keyword);
		window.location= root+search_page+"/search/"+search_keyword+"/";
	}
	
	function checkSearhKeyword()
	{	//alert(document.getElementById("search_on").value);
		
		if(document.getElementById("search_on").value == "user_song"){
			document.search.action="music.php";
			document.search.submit();
			return true;
		}else if(document.getElementById("search_on").value == "user_videos"){
			document.search.action="video.php";
			document.search.submit();
			return true;
		}else if(document.getElementById("search_on").value == "artist"){
			document.search.action="artist.php";
			document.search.submit();
			return true;
		}else if(document.getElementById("search_on").value == "user_gig"){
			document.search.action="giglist.php";
			document.search.submit();
			return true;
		}else if(document.getElementById("search_on").value == "general"){
			document.search.action="fan.php";
			document.search.submit();
			return true;
		}else if(document.getElementById("search_on").value == "venue"){
			document.search.action="venue.php";
			document.search.submit();
			return true;
		}else if(document.getElementById("search_on").value == "user_message"){
			document.search.action="view_messages.php";
			document.search.submit();
			return true;
		}
	}
	
	function goToTell(val)
	{	//alert(id);alert(val);
		if(val == "not downloadable"){
			alert("This song is not allowed to download");
			//return false;
		}else if(val == "not login"){
			alert("Login or register first");
			//return false;
		}else{
			window.location = val;
		}
	}
	
	function goTo(url)
	{	alert(url)
		window.location = url;
	}
	
	function goToPage(val)
	{	//alert(val);
		if(val == "not downloadable"){
			alert("This song is not allowed to download");
			return false;
		}else if(val == "not login"){
			alert("Login or register first");
			return false;
		}else{
			window.location = val;
		}
	}
	
/************************ 	New Functions 	***********************/
	
	function showArtist(val)
	{	//alert(val)
		if(val == 'artist'){
			if(document.getElementById("top_artist").style.display =='none'){
				document.getElementById("top_song").style.display ='none';
				document.getElementById("top_artist").style.display ='block';
			}
		}else{
			document.getElementById("top_artist").style.display ='none';
			document.getElementById("top_song").style.display ='block';
		}
	}
	
	function searchSongsByGenreId(val,uri)
	{	//alert(uri);
		//alert(root+"song/genre/"+val);
		if(uri=="artists" || uri=="fans" || uri=="venues" || uri=="video" || uri=="gigs"){
			if(val==''){
				window.location = root+uri+"/";	
			}else{
				window.location = root+uri+"/genre/"+val;
			}
		}else{
			if(val==''){
				window.location = root+"song/";	
			}else{
				window.location = root+"song/genre/"+val;
			}
		}
		
		/*document.getElementById("genre_id").value = val;
		document.genreis.action = root+"song/";
		document.genreis.submit();*/
		
	}
	
	function searchOnCountry(val)
	{
		document.country.submit();
	}
	
	function searchOnMost(val)
	{
		document.getElementById("sort_by").value = val;
		document.most.submit();
	}
	
	function searchSongOnMost(val)
	{
		document.getElementById("sort_by").value = val;
		document.most.submit();
	}
	
	
	function searchVideoOnMost(val)
	{	//alert(val)
		document.getElementById("sort_by").value = val;
		document.most.submit();
	}
	
	
	function sortBy(field,order)
	{	//alert(field)
		document.getElementById("field").value = field;
		document.getElementById("order").value = order;
		document.sort.submit();
	}
	
	function addMoreMembers()
	{	//alert('m here');
		document.getElementById('bandmember').innerHTML += document.getElementById('sample').innerHTML;
		//var elm = document.getElementById('bandmember');
		//document.write(elm.innerHTML);
		//elm.innerHTML += str;
	}
	
	
	function showMessages(val)
	{	//alert(val);
		if(document.getElementById(val).style.display=='none'){
			document.getElementById(val).style.display='block';
		}else{
			document.getElementById(val).style.display='none';	
		}
		
	}
	
	function sendMessage(val)
	{	//alert(val)
		document.messageForm.submit();
	}
	
	function showReplyForm(val)
	{	//alert(val)
		if(document.getElementById(val).style.display=='none'){
			document.getElementById(val).style.display='block';
		}else{
			document.getElementById(val).style.display='none';	
		}
	}
	
	
	
	function addMoreImages()
	{	//alert('m here')
		var elm = document.getElementById('images');
		var str = elm.innerHTML;
		var count = 0;
		
		var newdiv = document.createElement("div");
		newdiv.setAttribute("id","newdiv"+count);
		elm.appendChild(newdiv);
		document.getElementById('newdiv'+count).innerHTML = document.getElementById("sample").innerHTML;	
		count++;
	}
	
	function confirmDeleteFan(id)
	{	//alert(id)
		var checked = confirm('Are you sure to remove from your fans list');
		if(checked){
			window.location = root+"fan-list/act/del/fan/"+id;
		}
	}
	
	
	function confirmDeleteVenue(id)
	{	//alert(id)
		var checked = confirm('Are you sure to remove from your fans list');
		if(checked){
			window.location = root+"favourite-venues/act/del/venue/"+id;
		}
	}
	
	function confirmDeleteFriend(id)
	{	//alert(id)
		var checked = confirm('Are you sure to remove from your friend list');
		if(checked){
			window.location = root+"friend-list/act/del/friend/"+id;
		}
	}
	
	function confirmDeleteAtists(id)
	{	alert(id)
		var checked = confirm('Are you sure to remove from your friend list');
		if(checked){
			window.location = root+"favourite-artists/act/del/artist/"+id;
		}
	}

	
