// JavaScript Document
var text = "#hdp";
function bgr_color(obj, color) 
{
    obj.style.backgroundColor=color
}

$(document).ready(function() {
						   						   
	$("#mn").addClass("asrt");
	
	$(".cat").mouseover(function(){
		$(".cat").removeClass("active");
		$(this).addClass("active");
	});
	
	
	$(".search").click(function(){
		$(".search").removeClass("asrt");
		$(this).addClass("asrt");
	});
	
		//Default Action
	$("#hot").hide();
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	var webtype = document.index_service.web_type.value;
	if(webtype=='product'){
	fdtab("#hdp", 0);
	}else{
		fdtab2("#hdp");
	}
	$(".tab_content:first").show(); //Show first tab content
	
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		if(activeTab == "#lp")
		{
			text = "#lp";
			fdtab(text, 0);
		}
		else
		{
			text = "#hdp";
			fdtab(text, 0);
		}
		return false;
	});
	
	
	$("#loading").ajaxStart(function(){
		  $("#loading").css({ display: "block" });
		});
		
		$("#loading").ajaxStop(function(){
		  $("#loading").css({ display: "none" });
		});

	$("#man td").click(function() 
	{
		var page = $(this).html();
		offset = (page - 1) * 3;
		fdtab(text, offset);

	});
			
});


function fdcat(a){
		var fd = a;
		fdcat_icon(fd);

		$.post("main/main/inc/fdcat.php",
		  { fd: fd },
		  function(data) {
			$("#tr_center_pl").html(data);
		  }
		);
 }
 
 function fdcat2(a){
		var fd = a;
		fdcat_icon2(fd);
		
		$.post("main/main/inc/fdcat2.php",
		  { fd: fd },
		  function(data) {
			$("#main_center").html(data);
		  }
		);
 }

function s_prod(a){
		var fd = a;
			
		$.post("main/main/inc/s_box.php",
		  { fd: fd },
		  function(data) {
			$("#h_search_box").html(data);
		  }
		);
 }
 
 function fdshop(a){
		var fd = a;	
		$.post("main/main/inc/fdshop.php",
		  { fd: fd },
		  function(data) {
			$("#tr_center_plt").html(data).slideDown("slow");
		  }
		);
 }
 
  function fdshop2(a){
		var fd = a;	
		$.post("main/main/inc/fdshop2.php",
		  { fd: fd },
		  function(data) {
			$("#tr_center_plt").html(data).slideDown("slow");
		  }
		);
 }
 
 //fdtab(activeTab);
 
 function fdtab(a, offset)
 {	 
		var fd = a;	
		var os = offset;
		$.post("main/main/inc/fdtab.php",
		  { fd: fd, os: os },
		  function(data) {
			$("#tab1").html(data);
		  }
		);
		$("#hot").show();
 }
  function fdtab2(a){
	 
		var fd = a;	
		$.post("main/main/inc/fdtab2.php",
		  { fd: fd },
		  function(data) {
			$("#tab1").html(data);
		  }
		);
 }
 
 
 function fdcat_icon(a){
		var fd = a;
		
		$.post("main/main/inc/fdcat_icon.php",
		  { fd: fd },
		  function(data) {
			$("#tr_center_tip").html(data);
		  }
		);
 }
 
  function fdcat_icon2(a){
		var fd = a;
		
		$.post("main/main/inc/fdcat_icon2.php",
		  { fd: fd },
		  function(data) {
			$("#tr_center_tip").html(data);
		  }
		);
 }
 
 //pgshop('all', '<?php echo $i; ?>')
 
  function pgshop(a,b){
		var cat = a;
		var goto = b;
		//alert(cat);
		//alert(goto);
		
	$.post("main/main/inc/serv_pgshop.php",
		  { cat: cat, goto : goto },
		  function(data) {
			$("#tr_center_pl").html(data);
		  }
		);
 }