/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$(document).ready(function()
{
	$("#login_form").submit(function()
	{
		//remove all the class add the messagebox classes and start fading
		$("#msgbox").removeClass().addClass('messagebox').html('<img src="images/loading.gif" border="0"/>').fadeIn(1000);
		//check the username exists or not from ajax
		$.post("inc/ajax_login.php",{ email:$('#user_email').val(),password:$('#password').val(),rand:Math.random() } ,function(data)
        {
		  if(data=='yes') //if correct login detail
		  {
		  	$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
			{
			  //add message and change the class of the box and start fading
			  $(this).html('<img src="images/yes.gif" border="0"/>').addClass('messageboxok').fadeTo(900,1,
              function()
			  {
			  	 //redirect to secure page
				 document.location='index.php';
			  });

			});
		  }
		  else
		  {
		  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{
			  //add message and change the class of the box and start fading
			  $(this).html('<img src="images/no.gif" border="0"/>').addClass('messageboxerror').fadeTo(900,1);
			});
          }

        });
 		return false; //not to post the  form physically
	});
	//now call the ajax also focus move from
	$("#password").blur(function()
	{
		$("#login_form").trigger('submit');
	});



//Coulissement intÃ©gral (De cachÃ© Ã  visible)
    $('.newartist').hover(function() {
        $(".cover", this).animate({fontSize:'14px',top:'70px'},{queue:false,duration:160});
    }, function() {
        $(".cover", this).animate({fontSize:'11px',top:'114px'},{queue:false,duration:600});
         });
       //-----------------------------------------------
$(".topartist").slideDown(800);
//$(".new").slideDown(800);
//------------------------
$("#searchbox").keyup(function()
{
var searchbox = $(this).val();
//var dataString = 'searchword='+ searchbox;


if(searchbox=='')
{
$("#display").hide(200);
}
else
{

$.ajax({
type: "POST",
url:"search/search_artist/"+searchbox,
data:'',
cache: false,
success: function(html)
{

$("#display").html(html).show(600);
}

});
}return false;


})
.blur(function(){
$("#display").fadeOut(800);
});
//-------------------------
//-------------------------

 $('.delete').click(function(){
            var answer = confirm('This will remove the selected  '+jQuery(this).attr('title'));
                        // jQuery(this).attr('title') gets anchor title attribute
            return answer; // answer is a boolean
            });

});

jQuery(function($){
   $("#searchbox").Watermark("Search");
   });
 jQuery(function() {
        $('ul#category').lavaLamp({});
    });


