this.tooltip = function(){	
		xOffset = 30;
		yOffset = 10;		
	$("div.softwares img").livequery(function(){ 
	$(this)	
	.hover(function(e){											  
		this.t = this.alt;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.css("display","block");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	}, function() { 
        // unbind the mouseover and mouseout events 
        $(this) 
            .unbind('mouseover') 
            .unbind('mouseout'); 
    }); 
	$("div.softwares img").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
// JavaScript Document
function loadCat(catId) {
	$("#cat_id").val(catId);
	$("#curr_page").val("1");
	
	loadSites();
	
	location.hash = "portfolio-" + catId + "," + 1;
		
	return false;
}

function loadPage(page) {
	$("#curr_page").val(page);
	
	location.hash = "portfolio-" + $("#cat_id").val() + "," + $("#curr_page").val();
		
	loadSites();
	
	return false;
}

function loadSites() {
	$("#portfolio").html('').append('<div id="animate"></div>').children("#animate").hide()
	.load("./loadSites.php?cat=" + $("#cat_id").val() + "&page=" + $("#curr_page").val(), {}, function() {
    	$("#animate").show(600, 'easeInExpo');
		$("#pagingLinks a").click(function(event) {
			event.preventDefault();
			loadPage($(this).attr("rel"));
		});
		
	//	reloader(); //keep this commented
	});
}

function reloader(){
$.Lightbox.construct({
	show_linkback: false,
	download_link: false,
	text: {
		image: 'Photo'
	}
});
}

$(document).ready(function() {
$("#lavaLamp").lavaLamp({fx: "easeOutExpo",speed: 700,click: function() {return true;}});
$("#lavaLamp2").lavaLamp({fx: "easeOutExpo",speed: 700,click: function() {return false;}});
$("#lavaLamp li").removeClass("hoverjs");
$("#lavaLamp2 li").removeClass("hoverjs");
$('#previewcycle').after('<div id="nav" class="nav"><span>PAGE INDEX</span>').cycle({ 
    fx: 'scrollHorz', easing: 'easeInOutExpo', speed:    900, timeout:  8000, pager:  '#nav', pause: 1});
$("#lavaLamp li a[href^=#]").click(function(event) { 
  event.preventDefault();
  $.scrollTo(  $(this).attr('href'), 2000, {easing:'easeInOutExpo'} );
});
$("ul.listing li img").fadeTo("fast", 0.5).css("cursor","pointer");
$("ul.listing li img").hover(
  function () {
	$(this).fadeTo("fast", 1);
  }, 
  function () {
	 $(this).fadeTo("fast", 0.5);
  }
);

$("#lavaLamp2 li a[@class=catlink]").click(function(event) {
	event.preventDefault();
	loadCat($(this).attr("rel"));
});

$("#pagingLinks a").click(function(event) {
	event.preventDefault();
	loadPage($(this).attr("rel"));
});

$("li.haslink a").click(function(e)
{
		var toLoad = $(this).attr('href') + '?is_ajax=1';
		location.hash = $(this).attr('href').replace(/.php/, "");
		
		//alert(toLoad);
		e.preventDefault();
		if ( $("#animate").length > 0 ) {
			$("#animate").remove();
			} else { $("div#portfolio > *").remove();}
			//$("#loadData").text("...One Moment Please...");
			$("#portfolio").append('<div id="animate"></div>')				
			.children("#animate").hide()
			.load(toLoad +" div#portfolio > *", function()
			{
				 // $("#loadData").remove();
					$("#animate").show(400, 'easeInExpo');
		});
	return true;
});

$("a.haslink").click(function(e)
{
		location.hash = $(this).attr('href').replace(/.php/, "");
	var href = $(this).attr("href");
	$("#portfolio").html('').append('<div id="animate"></div>').children("#animate").hide()
	.load($(this).attr("href") + '?is_ajax=1' + " #portfolio", {}, function() {
    	$("#animate").slideDown(600, 'easeInExpo');
	
	//	reloader();
	});
/*

		var toLoad = $(this).attr('href');
		e.preventDefault();
		if ( $("#animate").length > 0 ) {
			$("#animate").remove();
			} else { $("div#portfolio > *").remove();}
			//$("#loadData").text("...One Moment Please...");
			$("#portfolio").append('<div id="animate"></div>')				
			.children("#animate").hide()
			.load(toLoad +" div#portfolio > *", function()
			{
				 // $("#loadData").remove();
					$("#animate").slideDown(400, 'easeInExpo');
		});
	*/
	return true;

});


if ((location.hash != '') && (location.hash != '#') && (location.hash != 'undefined')) {
	var hash = location.hash.replace(/.*#/, "");
	
if (hash.indexOf("portfolio-") == -1) {
	if ($("a[@href*=" + hash + ".php]")) {
		$("a[@href*=" + hash + ".php]").click();
	}
} else {
	var hash = hash.replace(/portfolio-/, "");
	
	if (hash.indexOf(",") == -1) {
		loadCat(hash);
	} else {
		tmp = hash.split(",");
		$("#cat_id").val(tmp[0]);
		loadPage(tmp[1]);
	}
}
}
tooltip();

$('a[@rel*=external]').click(function() {
	window.open($(this).attr("href"));
	
	return false;
});

function sstatus() {
	window.status = 'Welcome to Zuzana Designs.. All Your Design Needs';
}

$("a").hover(function() {
	sstatus();
}, function() { sstatus() });
window.status = 'Welcome To Zuzana Designs.. all Your Design Needs';

//$('a.morelink').mouseover(function(){window.status='Zuzana Designs v3';return true;})
//.mouseout(function(){window.status='Done';return true;});
//reloader();
//$('a[@rel*=lightbox]').lightbox();
//loadSites();
});