$(document).ready(function() {
	$("#databank").click(function () {
		  $("#databankDIV").toggle("slow");
		});
	ShowProductRow(0);
	

	  var pars = "HomeProvId="+HomeProvinceId+"&HomeClassId="+HomeClassId;
	  $.ajax({
			   type: "POST", url: "HomeAjaxFunctions.php",data: pars,			   
			   success: function(msg){
			  // alert(msg);
			   Templates = msg.split("<[TEMPLATESPLITTER]>");			   
				$("#SPEAKUPPANEL").html(Templates[0]);
				$("#SEMINARPANEL").html(Templates[1]);
			   /* $("#PHOTOALBUMPANEL").html(Templates[2]);*/
			   $("#LATESTSPEAKUPPANEL").html(Templates[3]);
			   $("#DOCUMENTPANEL").html(Templates[4]);
			   $("#RESOURCEPANEL").html(Templates[5]);
			   $("#OBITUARYPANEL").html(Templates[6]);
			   $("#CALENDARPANEL").html(Templates[7]);
			   
			   setTimeout("ShowPhotoAlbumRow(0)",500);;
			   }
			 });
	});

function ShowProductRow(ProductRow)
{
	$("#productrow"+ProductRow).css("top",0);
	$("#productrow"+ProductRow).animate({ opacity: "show"},"slow");
	var t = setTimeout("HideProductRow("+ProductRow+")", 2000); 
}
function HideProductRow(ProductRow)
{
	$("#productrow"+ProductRow).animate({ "opacity": "hide"},"slow");
	ProductRow++;
	ProductRow = ProductRow % 2;
	var t = setTimeout("ShowProductRow("+ProductRow+")", 500); 
}


function ShowPhotoAlbumRow(PhotoAlbumRow)
{
	$("#photorow"+PhotoAlbumRow).css("top",0);
	$("#photorow"+PhotoAlbumRow).animate({ opacity: "show"},"slow");
	var t = setTimeout("HidePhotoAlbumRow("+PhotoAlbumRow+")", 5000); 
}
function HidePhotoAlbumRow(PhotoAlbumRow)
{
	$("#photorow"+PhotoAlbumRow).animate({ opacity: "hide"},"slow");
	PhotoAlbumRow++;
	if(!document.getElementById("photorow"+PhotoAlbumRow))
		PhotoAlbumRow = 0 ;
	var t = setTimeout("ShowPhotoAlbumRow("+PhotoAlbumRow+")", 500); 
}
function AJAXURLCall(aObject,DIVToWrite,Sucessfn)
{
	document.getElementById(DIVToWrite).innerHTML="<div align='center'><img src='images/loading.gif' alt='loading' border=0></div>";
	var URL = aObject.href.split('?');
	if(URL[1])
		pars = URL[1];
	else
		pars = "";

	  $.ajax({
			   type: "POST", url: "AjaxCalendar.php",data: pars,
			   success: function(msg){
			   $("#"+DIVToWrite).html(msg);
			   }
			 });
			return false;

}
function selectitemcategory()	{

	if(document.frmtopsearch.resourcetype.value=="none" ){
		alert('Please Select The Category to Search For');
		frmtopsearch.resourcetype.focus();
		return false;
	}
	if(document.frmtopsearch.keyword.value=="" ){
		alert('Please Enter the  Search Keyword ');
		document.frmtopsearch.keyword.focus();
		return false;
	}
	//Reassigning certain variables for some search topics
	if(document.frmtopsearch.resourcetype.value=="E" ){
		document.frmtopsearch.ntarget.value='head';
	}
	else
		document.frmtopsearch.ntarget.value='any';

	if(document.frmtopsearch.resourcetype.value=="U" ){
		document.frmtopsearch.cmbprovince.value='0';
		document.frmtopsearch.cmbhouse.value='0';
		document.frmtopsearch.cmbtarget.value='N';
	}
	//document.frmtopsearch.action="newssearch.php";
	document.frmtopsearch.submit();
}