
function openMenu(id){
	$(".tabs_menu").hide();
	offs=$(".mainMenu").offset();
	$(".tabs_menu#"+id).offset({ top: offs.top+30});
	$(".tabs_menu#"+id).show();
	mcancelclosetime();
	menuitem=id;
	}
function closeMenu(){
	$(".tabs_menu#"+menuitem).hide();
	}
// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(closeMenu, timeout);
}	
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

var slide=function(id){
		var slideID=$(id).attr("name");
		$(".subCat").slideUp();
		$("#"+slideID).slideToggle();
		}


var expandAlbum=function(id){
	  var data="action=expandAlbum&albumID="+id;
	  var url="actionController.php";
	  $.ajax({
		   type: "GET",
		   url: url,
		   data: data,
		   cache: false,
		   success: function(resp){
		   $(".albumImages").html("");
		   $(".albumImages").html(resp);
		   $(".albumImages").slideDown();
		   }
		 });
		}
var sendComments=function(){
 	var url="actionController.php";
	var product_id=$("#product_id").val();
	var fullname=$("#fullName").val();
	var email=$("#emailAddress").val();
	var comment=$("#comments").text();
	if(fullname.length===0){
		alert("Please enter your name to comment.");
		}else if(comment.length===0){
			alert("Please enter your comments.");
			}else{
		data="product_id="+product_id+"&fullname="+fullname+"&email="+email+"&comments="+comment+"&action=sendComments";		
			$.ajax({
			   type: "POST",
			   url: url,
			   data: data,
			   dataType:"json",
			   cache: false,
			   success: function(resp){
				if(resp.res==="true"){
			
				$(".userComments").append("<p><strong><i>"+resp.data.username+"</i></strong> &nbsp;said</p><p>"+resp.data.comments+"</p>");
				}
		   }
			});
				}
	
	}		
