/*
@author: Leysam Rosario
@description: for private use only. Just contact me if you need something. 
			  You can visit our website addscrave.com or you can email me at edwardwindtalker@gmail.com
--------------
addscrave.com
--------------
*/

function toggleElemFade(target){
	$(target).fadeToggle("fast");
}

function chooseCollection(id){
	$.ajax({
		   url: "_internal.php?action=collection",
		   data: "collection_id="+id,
		   type: "POST",
		   cache:false,
		   success: function(a){
				$("#collection_area").animate({opacity:0},"1000",function(){
					$("#collection_area").html(a);
					$(this).animate({opacity:1},1000);
				});
				
		   }
	});
}

function chooseNews(date){
   $("#news_container").fadeOut(function(){
	$.ajax({
		   url: "_internal.php?action=get_news&date="+date,
		   cache:false,
		   success: function(a){
			   $("#news_container").html(a).fadeIn();
		   }
	});
	});
}

function send_newsletter(){
	$.ajax({
		   url: "newsletters_subscribe.php",
		   type: "POST",
		   data: $("#newsletter_form").serialize(),
		   cache:false,
		   success: function(a){
			   $("#newsletter").html(a);
		   }
	});
	return false;
}

/*- Menu -
@author: Leysam Rosario
@description: Menu
@notes: 
	- enjoy
	
Lets rock
----------------
*/

$(function(){
	main_menu = $("#main_menu");
	menu_item = main_menu.children();
	$.each(menu_item,function(){
		obj = $(this);
		obj.mouseenter(function(){
			ul = $(this).children()[1];
			$(ul).fadeIn("fast");
		});
		obj.mouseleave(function(){
			ul = $(this).children()[1];
			$(ul).hide();
		});
	});
});

/*- Slider -
@author: Leysam Rosario
@description: Slider for collection area
@notes: 
    - Please note that this is a basic slider. I can do better than this. LOL 
	- enjoy
	
Lets rock
----------------
*/
$(function(){
	item_holder = $('#slide_container');
	items = item_holder.children();
	
	item_holder.width(items.length*176);
	
	$("#right_arrow").click(function(){
		$("#slider").animate({
						scrollLeft:"+="+870
					},2000);
	});
	$("#left_arrow").click(function(){
		$("#slider").animate({
						scrollLeft:"-="+870
					},2000);
	});
});



