var album_slab = 20, album_char = "";
var single_slab = 20, single_char = "";
var video_slab = 20, video_char = "";
var game_slab = 20, game_char = "";
var app_slab = 20, app_char = "";
var ebook_slab = 20, ebook_char = "";
var comment_slab = 20 ;
var cookieStr = "";
//var userid = ""; // If userid is blank then show all records irrespective of users and if its given then show only records for specific users
//var search = "" ; // This will contains only 3 values `top` or `new` or '' where blank means that normal order need to be displayed
//var catid = "" ; // If categories given then show only records for specific categories else normal.
var RecaptchaOptions = {
   theme: 'clean',
   lang: 'en'
};

$(function(){
  $("#txtUsername").blur(function(){
	  if($(this).val() != "")
    $.get("checkuser.php", {'username' : $(this).val()}, function(data){
    $("#isuserexist").html(data);
    });
  });
  $("#txtBday").datepicker({dateFormat: 'mm-dd-yy',changeMonth: true,changeYear: true});
  $("#categories").tabs({selected:tabid});
  $("#userpanel").tabs();


  $("#ebookList tbody td").mouseover(changeColor_e);
  $("#appList tbody td").mouseover(changeColor_a);
  $("#gameList tbody td").mouseover(changeColor_g);
  $("#singleList tbody td").mouseover(changeColor_s);
  $("#videoList tbody td").mouseover(changeColor_v);
  $("#albumList tbody td").mouseover(changeColor);
  $("#albumList tbody td, #singleList tbody td, #videoList tbody td, #gameList tbody td, #appList tbody td, #ebookList tbody td").mouseleave(backToOriginal);
  $("#albumList th").mouseover(showNav);
  $("#curtain_album").mouseleave(collapseNav);
  $("#singleList th").mouseover(showNav_s);
  $("#curtain_single").mouseleave(collapseNav_s);
  $("#videoList th").mouseover(showNav_v);
  $("#curtain_video").mouseleave(collapseNav_v);
  $("#gameList th").mouseover(showNav_g);
  $("#curtain_game").mouseleave(collapseNav_g);
  $("#appList th").mouseover(showNav_a);
  $("#curtain_app").mouseleave(collapseNav_a);
  $("#ebookList th").mouseover(showNav_e);
  $("#curtain_ebook").mouseleave(collapseNav_e);

  $("#repLink span").mouseover(showPanel);
  //$("#repLink").click(checkLinking);
	$("#repLink").click(showPanel);

  $("#cmbCheck").click(checkTextboxLinking);
  $("#mnuReason").mouseleave(hidePanel);
  $("#showIcon1").mouseover(function(){showParentIcon(1,$(this))})
                   .mouseleave(hideParentIcon)
  $("#showIcon2").mouseover(function(){showParentIcon(2,$(this))})
                   .mouseleave(hideParentIcon);
  $("#showIcon3").mouseover(function(){showParentIcon(3,$(this))})
                   .mouseleave(hideParentIcon);
  $("#showIcon4").mouseover(function(){showParentIcon(4,$(this))})
                   .mouseleave(hideParentIcon);
  $("#showIcon5").mouseover(function(){showParentIcon(5,$(this))})
                   .mouseleave(hideParentIcon);


  $("#panelLogin, #panelCategory, #panelShout, #panelladder, #panelPartner, #panelAdvertise").click(toggleNextBox);
  $("#right").sortable({containment: 'parent' , handle: 'h1', items: 'div.right_child',
	   stop:function(even,ui){
    cookieStr = "";
      $("#right").children().each(function(i){
      cookieStr += (cookieStr != ""? "," : "") + $(this).attr('id')  ;
      });
      var exp = new Date();     //set new date object
      exp.setDate(exp.getDate() + 30);
      document.cookie = "sectioninfo="+cookieStr+";expires="+exp;
  }});

    $("#right").disableSelection();
	if(message != "")
	Sexy.info(message);

  jailScript();
  
});

function jailScript()
{
	//Applying GAIL Script
	$('img.lazy').jail({
		event: 'load',
		//timeout: 5000,
		placeholder : baseDir+'images/loading.gif',
		effect: 'fadeIn',
		speed : 'slow',
		
		callback: 
					function(){ 
						//console.log("All Images are Loaded");
		 			},
		callbackAfterEachImage : 
					function($img,options) {
						$img.error(function(x,e){							
							if(x.status==0){
								//console.log('You are offline!!\n Please Check Your Network.');
							}else if(x.status==404){
								//console.log('Requested URL not found.');
							}else if(x.status==500){
								//console.log('Internel Server Error.');
							}else if(e=='parsererror'){
								//console.log('Error.\nParsing JSON Request failed.');
							}else if(e=='timeout'){
								//console.log('Request Time out.');
							}else {
								//console.log('Unknow Error.\n'+x.responseText+'\n ->' + $(this).attr("data-href") );
							}					
							if($(this).hasClass("imgVideo"))
							{
								$(this).attr("src",baseDir + "images/no-image.jpg");
								$(this).attr("data-href",baseDir + "images/no-image.jpg");
							}
							if($(this).hasClass("imgGame"))
							{
								$(this).attr("src",baseDir +"images/no-games.jpg");
								$(this).attr("data-href",baseDir +"images/no-games.jpg");
							}
							if($(this).hasClass("imgApps"))
							{
								$(this).attr("src",baseDir +"images/no-apps.jpg");
								$(this).attr("data-href",baseDir +"images/no-apps.jpg");
							}
							if($(this).hasClass("imgEbook"))
							{
								$(this).attr("src",baseDir +"images/no-ebooks.jpg");
								$(this).attr("data-href",baseDir +"images/no-ebooks.jpg");
							}	
						});
					}
	});
}

function checkTextboxLinking()
{
    if($("#txtDownLink").val() == "")
    {
      $("#linkResult").html("");
      return true;
    }

    $("#linkResult").css({'padding':'5px'});

    $("#linkResult").html("<img src='" + baseDir + "images/checking.gif' alt=' checking...'> Checking links. It might take long time....");
    $.ajax({
		type: "POST",
		url: baseDir + "checkonlyLink.php",
		data: "links=" + $("#txtDownLink").val(),
    success: function(msg){
      $("#linkResult").html(msg);
    }
    });
}

function checkLinking(downloadid, sectionid,userid)
{
  $("#links li a").each(function(i){
    var $li = $(this).parent();
    var $an = $(this);
    $an.next().append("<img src='" + baseDir + "images/checking.gif' alt=' checking...'>");
    $.ajax({
		type: "POST",
		url: baseDir + "checknreport.php",
		data: "link=" + $an.attr("href") + "&mid=" + downloadid + "&sid=" + sectionid,
  		success: function(msg){
  		if(msg == "invalid"){
    		//$an.parent().find("img").remove();
    		//$an.parent().append("<img src='" + baseDir + "images/circle_red.png' alt='invalid'>");
    		$an.parent().find("img").remove();
    		$an.next().append("<img src='" + baseDir + "images/circle_red.png' alt='invalid'>");
  		}
  		else{
    		$an.parent().find("img").remove();
    		$an.next().append("<img src='" + baseDir + "images/check.png' alt='valid'>");
  		}
		}
		});
  });
}
function showParentIcon(rating,$id)
{
  //alert($id.attr("class"));
  if($id.hasClass("blue")){ // This is for album
    switch(rating)
    {
      default:
      case 1 : $id.parent().css("background-position", "left -20px"); break;
      case 2 : $id.parent().css("background-position", "left -40px"); break;
      case 3 : $id.parent().css("background-position", "left -60px"); break;
      case 4 : $id.parent().css("background-position", "left -80px"); break;
      case 5 : $id.parent().css("background-position", "left -98px"); break;
    }
  }
  if($id.hasClass("green")){ // This is for singles
    switch(rating)
    {
      default:
      case 1 : $id.parent().css("background-position", "left -119px"); break;
      case 2 : $id.parent().css("background-position", "left -139px"); break;
      case 3 : $id.parent().css("background-position", "left -159px"); break;
      case 4 : $id.parent().css("background-position", "left -179px"); break;
      case 5 : $id.parent().css("background-position", "left -197px"); break;
    }
  }
  if($id.hasClass("orange")){ // This is for video
    switch(rating)
    {
      default:
      case 1 : $id.parent().css("background-position", "left -218px"); break;
      case 2 : $id.parent().css("background-position", "left -238px"); break;
      case 3 : $id.parent().css("background-position", "left -258px"); break;
      case 4 : $id.parent().css("background-position", "left -278px"); break;
      case 5 : $id.parent().css("background-position", "left -296px"); break;
    }
  }
  if($id.hasClass("yellow")){ // This is for game
    switch(rating)
    {
      default:
      case 1 : $id.parent().css("background-position", "left -315px"); break;
      case 2 : $id.parent().css("background-position", "left -335px"); break;
      case 3 : $id.parent().css("background-position", "left -355px"); break;
      case 4 : $id.parent().css("background-position", "left -375px"); break;
      case 5 : $id.parent().css("background-position", "left -393px"); break;
    }
  }
  if($id.hasClass("red")){ // This is for application
    switch(rating)
    {
      default:
      case 1 : $id.parent().css("background-position", "left -413px"); break;
      case 2 : $id.parent().css("background-position", "left -433px"); break;
      case 3 : $id.parent().css("background-position", "left -453px"); break;
      case 4 : $id.parent().css("background-position", "left -473px"); break;
      case 5 : $id.parent().css("background-position", "left -491px"); break;
    }
  }
  if($id.hasClass("violet")){ // This is for ebook
    switch(rating)
    {
      default:
      case 1 : $id.parent().css("background-position", "left -510px"); break;
      case 2 : $id.parent().css("background-position", "left -530px"); break;
      case 3 : $id.parent().css("background-position", "left -550px"); break;
      case 4 : $id.parent().css("background-position", "left -570px"); break;
      case 5 : $id.parent().css("background-position", "left -588px"); break;
    }
  }

}
function hideParentIcon()
{
  $(this).parent().css("background-position","left top");
}
function showPanel()
{
	$ab = $(this).parent().next().find(".showAbs");
	$ab.fadeOut(1,function(){
		//$ab.show();
		$ab.fadeIn(500);
	});
}
function hidePanel()
{
	$(this).parent().fadeOut("fast");
}



function makeNormal(str,id)
{
  if(isNaN(id.value) || id.value == "")
  {
    switch(str)
    {
      case "day": id.value = "DD"; id.style.color = "gray"; break; return ;
      case "month": id.value= "MM" ; id.style.color = "gray" ;break; return ;
      case "year" : id.value = "YYYY"; id.style.color = "gray"; break;return ;
    }
  }
  if(id.value == "")
  {
    switch(str)
    {
      case "login" : id.value = "username" ; id.style.color = "white"; break ; return ;
      case "password": id.value = "password" ; id.style.color = "white" ; break ; return ;
      case "subject" : id.value = "Subject" ; id.style.color = "gray"; break ; return ;
      case "message": id.value = "Message" ; id.style.color = "gray" ; break ; return ;
      case "Search" : id.value = "Search" ; id.style.color = "gray" ; break; return ;
    }
  }
}
function imgReplace(id,section)
{
  switch (section)
  {
    case 'video': id.src = baseDir + "images/no-image.jpg" ;
  }
}
function clearField(id)
{
  id.value = "";
  id.style.color = "black";
}
function clearValidate()
{
  $("#isuserexist").html();
}
function validate_register()
{
    if($("#txtUsername").val() == "")
    {
      Sexy.error("Please enter username ");
      return false;
    }
    if($("#txtPassword").val() == "")
    {
      Sexy.error("Please enter password");
      return false;
    }
    if($("#txtRePassword").val() != $("#txtPassword").val())
    {
      Sexy.error("Password and Re-Typed password must be same");
      return false;
    }
    if($("#txtEmail").val() == "")
    {
      Sexy.error("Please fill your valid email address");
      return false;
    }
    if($("#txtQuestion").val() == "")
    {
      Sexy.error("Security question is required to recovered your password.");
      return false;

    }
    if($("#txtAnswer").val() == "")
    {
      Sexy.error("For every security question you have to remember its answer. <bR>Its required at the time of password retrival ");
      return false;
    }
    if($("#cmdDay").val() == "" || $("#cmdDay").val() == "DD" || isNaN($("#cmdDay").val())
        || $("#cmdMonth").val() == "" || $("#cmdMonth").val() == "MM" || isNaN($("#cmdMonth").val())
        || $("#cmdYear").val() == "" || $("#cmdYear").val() == "YYYY" || isNaN($("#cmdYear").val()))
    {
      Sexy.error("Please enter valid birth date ");
      return false;
    }

return true;
}
function validatelogin()
{

}
function getCommentPage(page,mid,sid)
{
	$.post(baseDir + "comments.php", {'page' : page ,
																		'mid' : mid,
																		'sid' : sid,
																		'slab' : comment_slab}, function(data)
		{

			$("#comments").fadeOut(500, function(){
			    $("#comments").html(data);
			    $("#comments").fadeIn(500);
	    });
		});
}
function getalbumPage(id,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
	$("#albumloading").show();
  $.post(baseDir + "albumlist.php", {'page' : id ,
												   'slab' : album_slab ,
												   'char' : album_char ,
												   'userid' :  userid ,
												   'catid' : catid ,
												   'isTopOrNew' : isTopOrNew ,
												   'gSearch' : gSearch,
												   'artist' : artist,
												   'platform': platform,
											     'author' : author,
											     'videoyear' : videoyear}, function(data)
  {
    $("#albums").fadeOut(300, function(){
    $("#albums").html(data);
    $("#albums").fadeIn(300, function(){
      $("#albumList tbody td").mouseover(changeColor);
      $("#albumList tbody td").mouseleave(backToOriginal);
      $("#albumList th").mouseover(showNav);
      $("#curtain_album").mouseleave(collapseNav);
    });
    });
		$("#albumloading").hide();
  });
}
function getalbumChar(chr,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  album_char = chr;
  getalbumPage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getalbumSlab(slab,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  album_slab = slab ;
  getalbumPage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}

function getsinglePage(id,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
	$("#singleloading").show();
  $.post(baseDir + "singlelist.php", {'page' : id ,
																		  'slab' : single_slab ,
																		  'char' : single_char ,
																		  'userid' :  userid ,
																		  'catid' : catid ,
																		  'isTopOrNew' : isTopOrNew ,
																	   'gSearch' : gSearch,
																	   'artist' : artist,
																	   'platform': platform,
																     'author' : author,
																     'videoyear' : videoyear}, function(data)
  {
    $("#singles").fadeOut(300, function(){
    $("#singles").html(data);
    $("#singles").fadeIn(300, function(){
      $("#singleList tbody td").mouseover(changeColor_s);
      $("#singleList tbody td").mouseleave(backToOriginal);
      $("#singleList th").mouseover(showNav_s);
      $("#curtain_single").mouseleave(collapseNav_s);
    });
		$("#singleloading").hide();
    });
  });
}
function getsingleChar(chr,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  single_char = chr;
  getsinglePage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getsingleSlab(slab,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  single_slab = slab ;
  getsinglePage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}

function getvideoPage(id,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
	$("#videoloading").show();
  $.post(baseDir + "videolist.php", {'page' : id ,
																	   'slab' : video_slab ,
																	   'char' : video_char ,
																	   'userid' :  userid ,
																	   'catid' : catid,
																	   'isTopOrNew' : isTopOrNew ,
																	   'gSearch' : gSearch,
																	   'artist' : artist,
																	   'platform': platform,
																     'author' : author,
																     'videoyear' : videoyear
																	   }, function(data)
  {
    $("#videos").fadeOut(300, function(){
    	$("#videos").html(data);
    	jailScript();		   
    	$("#videos").fadeIn(300, function(){
	      $("#videoList tbody td").mouseover(changeColor_v);
	      $("#videoList tbody td").mouseleave(backToOriginal);
	      $("#videoList th").mouseover(showNav_v);
	      $("#curtain_video").mouseleave(collapseNav_v);	      
	   }); //fadein
    }); // fadeout
		$("#videoloading").hide();	
  });  
}
function getvideoChar(chr,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  video_char = chr;
  getvideoPage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getvideoSlab(slab,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  video_slab = slab ;
  getvideoPage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getgamePage(id,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
	$("#gameloading").show();
  $.post(baseDir + "gamelist.php", {'page' : id ,
																	  'slab' : game_slab ,
																	  'char' : game_char  ,
																	  'userid' :  userid ,
																	  'catid' : catid,
																	  'isTopOrNew' : isTopOrNew ,
																   'gSearch' : gSearch,
																   'artist' : artist,
																   'platform': platform,
															     'author' : author,
															     'videoyear' : videoyear}, function(data)
  {
    $("#games").fadeOut(300, function(){
    $("#games").html(data);
    jailScript();
    $("#games").fadeIn(300, function(){
      $("#gameList tbody td").mouseover(changeColor_g);
      $("#gameList tbody td").mouseleave(backToOriginal);
      $("#gameList th").mouseover(showNav_g);
      $("#curtain_game").mouseleave(collapseNav_g);
    });
    });
		$("#gameloading").hide();
  });
}
function getgameChar(chr,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  game_char = chr;
  getgamePage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getgameSlab(slab,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  game_slab = slab ;
  getgamePage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getappPage(id,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
	$("#apploading").show();
  $.post(baseDir + "applist.php", {'page' : id ,
																   'slab' : app_slab ,
																   'char' : app_char ,
																   'userid' :  userid ,
																   'catid' : catid,
																   'isTopOrNew' : isTopOrNew ,
																   'gSearch' : gSearch,
																   'artist' : artist,
																   'platform': platform,
															     'author' : author,
															     'videoyear' : videoyear}, function(data)
  {
    $("#apps").fadeOut(300, function(){
    $("#apps").html(data);
    jailScript();
    $("#apps").fadeIn(300, function(){
      $("#appList tbody td").mouseover(changeColor_a);
      $("#appList tbody td").mouseleave(backToOriginal);
      $("#appList th").mouseover(showNav_a);
      $("#curtain_app").mouseleave(collapseNav_a);
    });
    });
		$("#apploading").hide();
  });
}
function getappChar(chr,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  app_char = chr;
  getappPage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getappSlab(slab,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  app_slab = slab ;
  getappPage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getebookPage(id,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
	$("#ebookloading").show();
  $.post(baseDir + "ebooklist.php", {'page' : id ,
																	   'slab' : ebook_slab ,
																	   'char' : ebook_char ,
																	   'userid' :  userid ,
																	   'catid' : catid,
																	   'isTopOrNew' : isTopOrNew ,
																	   'gSearch' : gSearch,
																	   'artist' : artist,
																	   'platform': platform,
																     'author' : author,
																     'videoyear' : videoyear}, function(data)
  {
    $("#ebooks").fadeOut(300, function(){
    $("#ebooks").html(data);
    jailScript();
    $("#ebooks").fadeIn(300, function(){
      $("#ebookList tbody td").mouseover(changeColor_e);
      $("#ebookList tbody td").mouseleave(backToOriginal);
      $("#ebookList th").mouseover(showNav_e);
      $("#curtain_ebook").mouseleave(collapseNav_e);
    });
    });
		$("#ebookloading").hide();
  });
}
function getebookChar(chr,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  ebook_char = chr;
  getebookPage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function getebookSlab(slab,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear)
{
  ebook_slab = slab ;
  getebookPage(0,userid,catid,isTopOrNew,gSearch,artist,platform,author,videoyear);
}
function postComments()
{

	$.post( baseDir + "comments.php", {'mid' : $("#mid").val() , 'sid' : $("#sid").val(), 'comment' : $("#comment").val(),
	 'recaptcha_challenge_field' : $("#recaptcha_challenge_field").val(),
	  'recaptcha_response_field': $("#recaptcha_response_field").val() } , function (data){
		$("#comments").html(data);
		//Sexy.info("Thank you for posting your comments.");
	})
}
function cloneDownload()
{
  $("#uniDown").clone()
                .attr("id","")
                .find("input:text, input:password").val("")
                .end()
               .appendTo($("#downloadSection"));
}
function videoScreens()
{

  $("#uniScreen").clone()
                 .attr("id","")
                 .find("input:text").val("")
                 .end()
                 .appendTo($("#VideoScreens"));
}
function edit_profile()
{
    if($("#txtEmail").val() == "")
    {
      Sexy.error("Please fill your valid email address");
      return false;
    }
    if($("#txtQuestion").val() == "")
    {
      Sexy.error("Security question is required to recovered your password.");
      return false;

    }
    if($("#txtAnswer").val() == "")
    {
      Sexy.error("For every security question you have to remember its answer. <bR>Its required at the time of password retrival ");
      return false;
    }
  return true ;
}

function change_password()
{
	if($("#txtNpassword").val() != $("#txtRpassword").val())
	{
		Sexy.error("Password and ReTyped password need to be same");
		return false;
	}
	if($("#txtNpassword").val() == "" || $("#txtRpassword").val() == "")
	{
		Sexy.error("Password can not be kept blank");
		return false;
	}
	return true;
}
function pms()
{
  if($("#txtSubject").val() == "")
  {
    Sexy.error("Please Enter Subject");
    return false;
  }
  if($("#txtMessage").val() == "")
  {
    Sexy.error("Please Enter Message");
    return false;
  }
  return true;
}
function removeComment(commentid,mid,sid)
{
	$.post(baseDir + 'reportComment.php', {'commentid' : commentid,'mid' : mid , 'sid' : sid},
	function(data){
		Sexy.info(data);
		if(data != "Please login for reporting the comments")
		$("#comment" + commentid).fadeOut();
	});
}
function reportLink(reasonid,mid,sid)
{
  $.post(baseDir + 'reportLinks.php', {'reasonid' : reasonid , 'mid' : mid , 'sid' : sid}, function(data){
    Sexy.info(data);
  });
}
function rateThis(rating,mediaid,secid)
{
  $.post(baseDir + 'rateThis.php', {'rate' : rating , 'mid' : mediaid , 'sid' : secid}, function(data){ ;
    if(data != "")
    Sexy.info(data);
    else{ // Things worked smoothly
    $("#rated span").css('background-image','none');
    $("#rated span").html("Thank you for giving rating");
    }
  });
}
function getOtherOption(id)
{
  switch(eval(id.value))
  {
    case 1 : // Album
    case 2 : // Singles
             $("#idYear").hide();
             $("#idPlatform").hide();
             $("#idAuthor").hide();
             $("#idArtist").show();
             break;
    default:
             $("#idYear").hide();
             $("#idPlatform").hide();
             $("#idAuthor").hide();
             $("#idArtist").hide();
             break;
    case 3 : // videos
             $("#idYear").show();
             $("#idPlatform").hide();
             $("#idAuthor").hide();
             $("#idArtist").hide();
             break;
    case 4 : // Games
    case 5 : // Application
             $("#idYear").hide();
             $("#idPlatform").show();
             $("#idAuthor").hide();
             $("#idArtist").hide();
             break;
    case 6 : // ebook
             $("#idYear").hide();
             $("#idPlatform").hide();
             $("#idAuthor").show();
             $("#idArtist").hide();
             break;
  }
}
function submit_vote(likeDislike,id,block)
{
  //-------- Display the total number of votes
  var totalVoteid ;
  switch(block)
	{
		case 'album' :  totalVoteid = 'albumVote_'+id; break;
		case 'single' :  totalVoteid = 'singleVote_'+id; break;
		case 'video' :  totalVoteid = 'videoVote_'+id; break;
		case 'game' :  totalVoteid = 'gameVote_'+id; break;
		case 'app' :  totalVoteid = 'appVote_'+id; break;
		case 'ebook' :  totalVoteid = 'ebookVote_'+id; break;
	}
  //alert("like:=="+likeDislike+" id:=="+id+ " block:=="+block+" tid:=="+totalVoteid);
	//----- Ajax request to submit vote
  $.ajax({
      type:'POST',
      url: baseDir + 'submitvote.php',
      data: "likeDislike=" + likeDislike + "&id=" + id + "&block="+ block,
      success: function(response){
                if(response != '')
                Sexy.alert(response);
                else
                  if(likeDislike == 1)
                    $("#"+ totalVoteid ).html(eval($("#"+ totalVoteid).html())+1);
                  else
                    $("#"+ totalVoteid ).html(eval($("#"+ totalVoteid).html())-1);
                  //Sexy.info(response);
                }
    });
}

