
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(document).ready(function () {
$("#nav_bar li a.fade").hover(function(){$(this).fadeOut(1000);$(this).fadeIn(1000); $("#contact-form").validate();
});
$('#login').click(function(){
	$("#Register").fadeOut();
  $("#Loinbar").fadeToggle("slow", "linear");
  
});
$('#Login').click(function(){
	$("#Register").fadeOut();
  $("#Loinbar").fadeToggle("slow", "linear");
  
});
$('#signup').click(function(){
	 $("#Loinbar").fadeOut();
  $("#Register").fadeToggle("slow", "linear");
});	
$('#register').click(function(){
	 $("#Loinbar").fadeOut();
  $("#Register").fadeToggle("slow", "linear");
});	
$('#changeP').click(function(){
  $(".Password").fadeToggle("slow", "linear");
});	
$('.boxgrid.caption').hover(function(){
					$(".cover", this).stop().animate({top:'100px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'150px'},{queue:false,duration:160});
				});

$('.boxgrid.caption').ready(function(){
					$(".cover", this).stop().animate({top:'140px'},{queue:false,duration:160});
				}, function() {
					$(".cover", this).stop().animate({top:'150px'},{queue:false,duration:160});
				});
$("#vpassword").blur(function(){
	var vpassword = $("#vpassword").val();
var password = $("#password").val();
var msgbox = $("#passstat");

 if(vpassword.length > 3)
 {
 $("#passstat").html('<img src="../images/loader.gif">&nbsp;Checking password.');

 $.ajax({ 
 type: "GET", 
 url: "../check.php", 
 data: "vpassword="+ vpassword +"&password="+password, 
 success: function(msg){ 
 $("#passstat").ajaxComplete(function(event, request){ 

 if(msg == 'OK')
 { 
// if you don't want background color remove these following two lines
 $("#password").removeClass("red"); // remove red color
 $("#password").addClass("green"); // add green color
$("#vpassword").removeClass("red"); // remove red color
 $("#vpassword").addClass("green"); // add green color
msgbox.html('<img src="../images/accepted.png"> <font color="Green"> Good </font>');
 } 
 else 
 { 
// if you don't want background color remove these following two lines
 $("#password").removeClass("green"); // remove green color
 $("#password").addClass("red"); // add red  color
 $("#vpassword").removeClass("green"); // remove green color
 $("#vpassword").addClass("red"); // add red  color
msgbox.html(msg);
 } 
 });
 } 
 }); 

 }
 else
 {
// if you don't want background color remove this following line
 $("#vpassword").addClass("red"); // add red color
 $("#passstat").html('<font color="#cc0000">Enter valid Password</font>');
 }
return false;
 });

$("#username").blur(function(){
	var username = $("#username").val();
var msgbox = $("#userstatus");

 if(username.length > 3)
 {
 $("#userstatus").html('<img src="../images/loader.gif">&nbsp;Checking availability.');

 $.ajax({ 
 type: "GET", 
 url: "../check.php", 
 data: "username="+ username, 
 success: function(msg){ 
 $("#userstatus").ajaxComplete(function(event, request){ 

 if(msg == 'OK')
 { 
// if you don't want background color remove these following two lines
 $("#username").removeClass("red"); // remove red color
 $("#username").addClass("green"); // add green color
msgbox.html('<img src="../images/accepted.png"> <font color="Green"> Available </font>');
 } 
 else 
 { 
// if you don't want background color remove these following two lines
 $("#username").removeClass("green"); // remove green color
 $("#username").addClass("red"); // add red  color
msgbox.html(msg);
 } 
 });
 } 
 }); 

 }
 else
 {
// if you don't want background color remove this following line
 $("#username").addClass("red"); // add red color
 $("#userstatus").html('<font color="#cc0000">Enter valid User Name</font>');
 }
return false;
 });
 $("#email").blur(function(){
	var email = $("#email").val();
var msgbox = $("#emailstatus");

 if(email.length > 3)
 {
 $("#emailstatus").html('<img src="../images/loader.gif">&nbsp;Checking availability.');

 $.ajax({ 
 type: "GET", 
 url: "../check.php", 
 data: "email="+ email, 
 success: function(msg){ 
 $("#emailstatus").ajaxComplete(function(event, request){ 

 if(msg == 'OK')
 { 
// if you don't want background color remove these following two lines
 $("#email").removeClass("red"); // remove red color
 $("#email").addClass("green"); // add green color
msgbox.html('<img src="../images/accepted.png"> <font color="Green"> Available </font>');
 } 
 else 
 { 
// if you don't want background color remove these following two lines
 $("#email").removeClass("green"); // remove green color
 $("#email").addClass("red"); // add red  color
msgbox.html(msg);
 } 
 });
 } 
 }); 

 }
 else
 {
// if you don't want background color remove this following line
 $("#email").addClass("red"); // add red color
 $("#email").html('<font color="#cc0000">Enter valid Email address</font>');
 }
return false;
 });
 $(function() {
$('.password').pstrength();
});
$(".error_stat").fadeOut(5000); 
jQuery('#mycarousel').jcarousel({
        auto: 2,
        wrap: 'last',		
        initCallback: mycarousel_initCallback,	
      easing: 'BounceEaseOut',
		  animation: 1000

    });
   
		var searchBoxes = $("#search");
	var searchBox = $("#search");
	var searchBoxDefault = "Search..";
	
	//Effects for  searchbox
	searchBoxes.focus(function(e){
		$(this).addClass("active");
	});
	searchBoxes.blur(function(e){
		$(this).removeClass("active");
	});
	
	
	searchBox.focus(function(){
		if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");
	});
	searchBox.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);
	});
	var Newsletter = $(".newsletter");
	var Newsletter = $(".newsletter");
	var NewsletterDefault = "Subscribe to News Letter";
	Newsletter.focus(function(e){
		
	});
	Newsletter.blur(function(e){
		$(this).removeClass("active");
	});
	
	
	Newsletter.focus(function(){
		if($(this).attr("value") == NewsletterDefault) $(this).attr("value", "");
	});
	Newsletter.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", NewsletterDefault);
	});
$(".newsletter").blur(function(){
	var newsletter = $(".newsletter").val();
var msgbox = $("#newstatus");

 if(newsletter.length > 3)
 {
 $("#newstatus").html('<img src="../images/loader.gif">&nbsp;Checking email.');

 $.ajax({ 
 type: "GET", 
 url: "../check.php", 
 data: "newsletter="+ newsletter, 
 success: function(msg){ 
 $("#newstatus").ajaxComplete(function(event, request){ 

 if(msg == 'OK')
 { 
// if you don't want background color remove these following two lines
 $(".newsletter").removeClass("red"); // remove red color
 $(".newsletter").addClass("green"); // add green color
msgbox.html(' <font color="Green"> email added successfuly</font>&nbsp;&nbsp;<img src="../images/accepted.png">');
 } 
 else 
 { 
// if you don't want background color remove these following two lines
 $(".newsletter").removeClass("green"); // remove green color
 $(".newsletter").addClass("red"); // add red  color
msgbox.html('<font color="Red">error occurred </font>'+msg);
 } 
 });
 } 
 }); 

 }
 else
 {
// if you don't want background color remove this following line
 $(".newsletter").addClass("red"); // add red color
 $(".newsletter").html('<font color="#cc0000">Enter valid Email</font>');
 }
return false;
 });

  
  $('#slide').mouseover(function(){
	
	  $("#jp_playlist_2").slideDown('slow').fadeIn();
    $(this).removeClass("playListslideUp");
	 $(this).addClass("playListslideDown");
});

$('#slide').click(function(){
     $("#jp_playlist_2").slideUp('slow').fadeOut();
    $(this).removeClass("playListslideDown");
	 $(this).addClass("playListslideUp");
});
//Player shttp://line25.com/wp-content/uploads/2010/slideshow/demo/images/iptss
var currentTrack = 0;
	var Playlist = function(instance, playlist, options) {
		var self = this;

		this.instance = instance; // String: To associate specific HTML with this playlist
		this.playlist = playlist; // Array of Objects: The playlist
		this.options = options; // Object: The jPlayer constructor options for this playlist

		this.current = 0;

		this.cssId = {
			jPlayer: "jquery_jplayer_",
			interface: "jp_interface_",
			playlist: "jp_playlist_"
		};
		this.cssSelector = {};

		$.each(this.cssId, function(entity, id) {
			self.cssSelector[entity] = "#" + id + self.instance;
		});

		if(!this.options.cssSelectorAncestor) {
			this.options.cssSelectorAncestor = this.cssSelector.interface;
		}

		$(this.cssSelector.jPlayer).jPlayer(this.options);

		$(this.cssSelector.interface + " .jp-previous").click(function() {
			self.playlistPrev();
			$(this).blur();
			return false;
		});

		$(this.cssSelector.interface + " .jp-next").click(function() {
			self.playlistNext();
			$(this).blur();
			return false;
		});
	};

	Playlist.prototype = {
		displayPlaylist: function() {
			var self = this;
			$(this.cssSelector.playlist + " ul").empty();
			for (i=0; i < this.playlist.length; i++) {
				var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>";
				listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>";

				// Create links to free media
				if(this.playlist[i].free) {
					var first = true;
					listItem += "<div class='jp-free-media'>(";
					$.each(this.playlist[i], function(property,value) {
						if($.jPlayer.prototype.format[property]) { // Check property is a media format.
							if(first) {
								first = true;
							} else {
								listItem += " | ";
							}
							listItem += "<a target='_blank' id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>download " + property + "</a>";
						}
					});
					listItem += ")</span>";
				}

				listItem += "</li>";

				// Associate playlist items with their media
				$(this.cssSelector.playlist + " ul").append(listItem);
				$(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() {
					var index = $(this).data("index");
					if(self.current !== index) {
						self.playlistChange(index);
					} else {
						$(self.cssSelector.jPlayer).jPlayer("play");
					}
					$(this).blur();
					return false;
				});

				// Disable free media links to force access via right click
				if(this.playlist[i].free) {
					$.each(this.playlist[i], function(property,value) {
						if($.jPlayer.prototype.format[property]) { // Check property is a media format.
							$(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() {
								var index = $(this).data("index");
								$(self.cssSelector.playlist + "_item_" + index).click();
								$(this).blur();
								return false;
							});
						}
					});
				}
			}
		},
		playlistInit: function(autoplay) {
			if(autoplay) {
				this.playlistChange(this.current);
			} else {
				this.playlistConfig(this.current);
				
			}
		},
		playlistConfig: function(index) {
			$(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current");
			$(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current");
			this.current = index;
			$("#playerSongInfo").html(this.playlist[this.current].name);
			$(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
		},
		playlistChange: function(index) {
			currentTrack=index;
						this.playlistConfig(index);
			$(this.cssSelector.jPlayer).jPlayer("play");
				
		},
		playlistNext: function() {
			var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0;
			this.playlistChange(index);
		},
		playlistPrev: function() {
			var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1;
			this.playlistChange(index);
		}
	};

	
	 $.ajax({
	 		 type:"POST",
   			 url: '../getmusic.php',
			 dataType:'json',
  			 success: function(data) {
				    audioPlaylist = new Playlist('2', data, {
		ready: function() {
		
			audioPlaylist.displayPlaylist();
			audioPlaylist.playlistInit(false); // Parameter is a boolean for autoplay.
		},
		ended: function() {
			audioPlaylist.playlistNext();
		},
		play: function() {
			$(this).jPlayer("pauseOthers");
		},
		swfPath: "../js",
		supplied: "mp3"
	});

			 }
  			});
  		
	
$(function() {
			
			$("ul.video").ytplaylist({addThumbs:true, autoPlay: true, holderId: 'ytvideo2'});
		});
	

		
});


