/*  
                      __       ___       ___                  
                     /\ \__  /'___\     /\_ \    __           
 _____     ___   _ __\ \ ,_\/\ \__/  ___\//\ \  /\_\    ___   
/\ '__`\  / __`\/\`'__\ \ \/\ \ ,__\/ __`\\ \ \ \/\ \  / __`\ 
\ \ \L\ \/\ \L\ \ \ \/ \ \ \_\ \ \_/\ \L\ \\_\ \_\ \ \/\ \L\ \
 \ \ ,__/\ \____/\ \_\  \ \__\\ \_\\ \____//\____\\ \_\ \____/
  \ \ \/  \/___/  \/_/   \/__/ \/_/ \/___/ \/____/ \/_/\/___/ 
   \ \_\                                                      
    \/_/  
=================================================================================================*/

//create page array
var pageArray = new Array();

function portfolio_loading(subPage) {
	$("#port_" + subPage).addClass("portload_" + subPage);
}

function portfolio_ajax(subPage) {
	$.ajax({
		ajaxStart: portfolio_loading(subPage),
		url: "http://stinogle.com/portfolio/" + subPage + "/",
		cache: false,
		success: function(html){
			//append appropriate html to the target object
			$("#port_" + subPage).append(html).removeClass("portload_" + subPage);
			//initialize lightbox for included html
			$('a.lightbox').lightBox();
		}
	});
}

function portfolio_tabs(subPage) {
	//hide all tabs
	$("#port_sub div.portsub").hide();
	$(".portnav li a").removeClass("current_port_item");
	//show appropriate tab
	$("#port_" + subPage).show();
	$("#portbtn_" + subPage).addClass("current_port_item");
	//create array string
	var arrayString = pageArray.toString();
	//check string for subPage var
	if(arrayString.search(subPage) == -1) {
		//If empty, push to array and call ajax
		pageArray.push(subPage);
		portfolio_ajax(subPage);
	}
}

$(function() {
	$('a.lightbox').lightBox();
	portfolio_tabs("web");
});


