$(document).ready(function() {
	$(".albimg").lazyload();
	
	changeFindKeys('keyword', 'Enter your search...');
	changeFindKeys('name', 'Enter your name');
	changeFindKeys('email', 'Enter your email');
	
	$("#topnav").mouseover(function (){
    	$("#topnav-detail1").slideDown("slow");
	});
	$("#topnav-detail1").mouseleave(function (){
    	$("#topnav-detail1").slideUp("slow");
	});
	
	// Songs Select/unselect
	$(".select").click(function () {
		$(".chk").attr("checked","checked");
	});

	$(".unselect").click(function () {
		$(".chk").attr("checked","");
	});
	$('#searchsubmit').click(function(){
		if(($.trim($('#keyword').val())) === "Enter your search...") {
			$('#keyword').val('');
		}
		if(($.trim($('#keyword').val())).length < 3) {
			alert("Please enter at least three letter word to search.");
			return false;
		} else {
			$('#search').submit();
		}
	});
	
	$('#newslsubmit').click(function(){
		if($.trim($('#nname').val()) == "Enter your name" && $.trim($('#nemail').val()) == "Enter your email") {
			$('#nname').val('');
			$('#nemail').val('');
		}
		if($.trim($('#nname').val()).length == 0 && $.trim($('#nemail').val()).length == 0) {
			alert("Please enter at valid name and email.");
			return false;
		} else {
			$('#newslform').submit();
		}
	});
	
	$("#songrequestclose").click(function () {
		$("#songrequestid").fadeOut("slow");
	});

	
	$(".downloadsong").click(function () {
		window.open("downloadsongdetails.php?id="+$(this).attr("id"),"downloadsong","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=584,height=550");
	});
	
	$("#playradio").click(function () {
		window.open("radio.php","playradio","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=auto");
	});
	
	$(".playsong").click(function() {
		if($('.chk:checked').length < 1) {
			alert("Please select song to play");
			return false;
		}
	});
});
