function getPageContent(id)
	{
		
		 $("#contentDiv").html("Please wait loading content...");
		  bodyContent = $.ajax({
		  url: "ajax/getAjaxPageContent.php",
		  global: false,
		  type: "POST",
		  data: ({id: id, date : new Date().getTime()}),
		  dataType: "html",
		  success: function(html){
		  if(html!="")
		  {
				$("#contentDiv").html(html);
		
		  }
				
		  }
	   }
		).responseText;
	}
	
	
function fadeDiv(div,effect)
{
	if(effect=="Show")
		$("#"+div).show();
	else if(effect=="Hide")
		$("#"+div).hide();
	else
		$("#"+div).toggle();
}
	
function checkLogin2()
{
	bodyContent = $.ajax({
      url: "ajax/getCheckLogin.php",
      global: false,
      type: "POST",
	  data: ({date : new Date().getTime()}),
      dataType: "html",
      success: function(html){
	  if(html!="")
	  {
			
			$("#login").html("");
			$("#signIn").html("<a href='index.php?logout=yes'>logout</a>");
			$("#loginTools").html("User: <font color='#000000'>"+html+" </font><br>Options: <a href='products.php?action=showBasket'>My Basket</a>" );
			
			$("#loginHeader").html("<font color='#000000' size='2'>Logged In</font>");
	  }
         	
      }
   }
	).responseText;
}

function Login2()
{
	$("#loginSpan").html("Please wait Logging In...");
	//$("#loginSpan").load("ajax/getAjaxLogin.php"); 
	//alert("LOGIN")
	 bodyContent = $.ajax({
      url: "ajax/getAjaxLogin.php",
      global: false,
      type: "POST",
      data: ({password : $("#password").val(), username : $("#username").val(),date : new Date().getTime()}),
      dataType: "html",
      success: function(html){
	  	//alert(html.indexOf("Welcome"))
		if(html.indexOf("Welcome")!=-1)
		{
			$("#signIn").slideToggle();
			$("#loginHeader").html("Welcome")
			$("#loginSpan").html(html);
			$("#login").slideToggle(1000);
			checkLogin();
		}
		else
			$("#loginSpan").html(html)
         	
      }
   }
	).responseText;

	
}
	
function generateRandomPic()
{
		
		  bodyContent = $.ajax({
		  url: "ajax/getAjaxRandomPic.php",
		  global: false,
		  type: "POST",
		  data: ({date : new Date().getTime()}),
		  dataType: "html",
		  success: function(html){
		  if(html!="")
		  {
			  
				$("#randomDiv").html(html);
				var randomProduct = setTimeout ( "generateRandomPic()", 10000 );
		  }
				
		  }
	   }
		).responseText;
}
	
function getProduct(id,db)
	{
		
		 $("#contentProductID").html("Please wait loading product info...");
		  bodyContent = $.ajax({
		  url: "ajax/getAjaxProductContent.php",
		  global: false,
		  type: "POST",
		  data: ({id: id, db:db, date : new Date().getTime()}),
		  dataType: "html",
		  success: function(html){
		  if(html!="")
		  {
				$("#contentProductID").html(html);
		
		  }
				
		  }
	   }
		).responseText;
	}
	
function getCatProducts(cat)
{
		 $("#contentProductID").html("Please wait loading product info...");
		  bodyContent = $.ajax({
		  url: "ajax/getAjaxProductContent.php",
		  global: false,
		  type: "POST",
		  data: ({cat:cat, date : new Date().getTime()}),
		  dataType: "html",
		  success: function(html){
		  if(html!="")
		  {
				$("#contentProductID").html(html);
		
		  }
				
		  }
	   }
		).responseText;
}

function openSection(id,closeCat)
{
	//alert(ob);
	if(closeCat==1)
		closeAllSections();
	
	$("#prod"+id).toggle(500);
	
	if($("#sub"+id).html()!=null)
		$("#sub"+id).toggle(500);
	//alert($("#symb"+id).html())
	if($("#symb"+id).html()=="[+]")
		$("#symb"+id).html("[-]");
		
	else if($("#symb"+id).html()=="[-]")
		$("#symb"+id).html("[+]");
	
	getCatProducts(id);
}

function closeAllSections()
{
	var maxCat=100;
	for(var i=1;i<maxCat;i++)
	{
		if($("#prod"+i)!=null)
		{
			
			
				$("#prod"+i).hide();
				$("#symb"+i).html("[+]");
				if($("#sub"+i).html()!=null)
					$("#sub"+i).hide();
					
				
		}
	}
	
		
}

	
function getNewsContent(id)
	{
		
		 $("#contentDiv").html("Please wait loading News...");
		  bodyContent = $.ajax({
		  url: "ajax/getAjaxNewsContent.php",
		  global: false,
		  type: "POST",
		  data: ({id: id, date : new Date().getTime()}),
		  dataType: "html",
		  success: function(html){
		  if(html!="")
		  {
				$("#contentDiv").html(html);
		
		  }
				
		  }
	   }
		).responseText;
	}
	



