$(document).ready(function(){
	//navigation efftect
	$("#nav a").click(function(){
		$("#nav a").removeClass("currentItem");
		$(this).addClass("currentItem");	
		content_switch(parseInt($(this).attr("name")));
	});

});
function gotoProduct(){
	$("#nav a").removeClass("currentItem");
	$("#nav a[name='3']").addClass("currentItem");
	content_switch(3);
}
function content_switch(sn){
	$("#nav li[name="+sn+"]").css("background-image","url(images/nav_item_bg.png)");
	switch(sn){
		case 1:
			$("#ajax_area").animate({opacity:0.0},500,function(){
				$("#ajax_area").html('<div id="indexBanner"><div id="indexLeft"><img src="images/banner/poster1.jpg" width="736" height="382"><img src="images/banner/poster2.jpg" width="736" height="382"><img src="images/banner/poster3.jpg" width="736" height="382"><img src="images/banner/poster4.jpg" width="736" height="382"></div><div id="indexRight"><img src="images/banner/new1.jpg" width="261" height="382"><a href="http://www.facebook.com/#!/pages/Chicology-Inc/110158717579" target="_blank"><img src="images/banner/new2.jpg" width="261" height="382"></a></div>');	
			});
			$("#three_cols .cols").animate({height:165},800,function(){
				$("#content").animate({height:383},1000,function(){
					$("#ajax_area").animate({opacity:1.0},300,function(){
						//home init	
						$('#indexLeft').cycle({ 
						    fx:     'scrollLeft', 
						    speed:2000,
					    	timeout:10000,
					    	delay: -5000  
						 });
						$('#indexRight').cycle({ 
						    fx:     'scrollUp', 
						    speed:2000,
					    	timeout:10000,
					    	delay: -5000  
						 });
								
					});
				});					
			});
			
		break;
		case 2:
			$.ajax({
				type: "POST",
				url: "category_library.asp",
				data: "cid="+sn,
				success: function(msg){
					$("#ajax_area").animate({opacity:0.0},500,function(){
						$("#ajax_area").html(msg);
					});
					$("#three_cols .cols").animate({height:76},800,function(){
						$("#content").animate({height:520},1000,function(){
							$("#ajax_area").animate({opacity:1.0},300,function(){
								//product init
									
							});
						});
					
					});
				}
			});
		break;
		case 3:
			$.ajax({
				type: "POST",
				url: "category_product.asp",
				data: "cid="+sn,
				success: function(msg){
					$("#ajax_area").animate({opacity:0.0},500,function(){
						$("#ajax_area").html(msg);
					});
					$("#three_cols .cols").animate({height:76},800,function(){
						$("#content").animate({height:520},1000,function(){
							$("#ajax_area").animate({opacity:1.0},300,function(){
								//product init
									$("#category_product li").click(function(){
										self.location.href =jQuery("a",this).attr("href");
									});
							});
						});
					
					});
				}
			});			
		break;
		case 4:
			$.ajax({
				type: "POST",
				url: "category_about.asp",
				data: "cid="+sn,
				success: function(msg){
					$("#ajax_area").animate({opacity:0.0},500,function(){
						$("#ajax_area").html(msg);
					});
					$("#three_cols .cols").animate({height:76},800,function(){
						$("#content").animate({height:520},1000,function(){
							$("#ajax_area").animate({opacity:1.0},300,function(){
								//about init
									
							});
						});
					
					});
				}
			});	
		break;
		case 5:
			$.ajax({
				type: "POST",
				url: "category_contact.asp",
				data: "cid="+sn,
				success: function(msg){
					$("#ajax_area").animate({opacity:0.0},500,function(){
						$("#ajax_area").html(msg);
					});
					$("#three_cols .cols").animate({height:76},800,function(){
						$("#content").animate({height:520},1000,function(){
							$("#ajax_area").animate({opacity:1.0},300,function(){
								//contact init
									
							});
						});
					
					});
				}
			});			
		break;
		case 6:
			$.ajax({
				type: "POST",
				url: "category_support.asp",
				data: "cid="+sn,
				success: function(msg){
					$("#ajax_area").animate({opacity:0.0},500,function(){
						$("#ajax_area").html(msg);
					});
					$("#three_cols .cols").animate({height:76},800,function(){
						$("#content").animate({height:520},1000,function(){
							$("#ajax_area").animate({opacity:1.0},300,function(){
								
								$(".support_items li").hover(function(){
									//alert(jQuery("img",this).attr("alt"));
									id= jQuery("img",this).attr("alt");
									jQuery("img",this).attr("src","images/support_item"+id+"_color.jpg");
								},function(){
									id= jQuery("img",this).attr("alt");
									jQuery("img",this).attr("src","images/support_item"+id+"_bw.jpg");
								});
									
							});
						});
					
					});
				}
			});
		break;
		case 7:
			
		break;

		default:
		//	alert($(this).attr("name"));
		break;
		}
}
