var fullTech = new Array("php", "xhtml", "java", "ecommerce", "linux", "mysql", "mobile", "android", "javascript", "ajax", "cloud");
alphaList = fullTech;
function getDiffArray(list1, list2){
	thislist = list2.slice();
	for (var i in list1) {
		for (var j in list2) {
			 if (list1[i] == list2[j]) {
				thislist.splice(j, 1);
				 //alert('found ' + list1[i] + ' in both lists');
				// alert(thislist);
			 }
		}
	}
	return thislist;
}

function getSameArray(list1, list2){
	thislist = new Array();
	var show = false;
	for (var i in list1) {
		show = false;
		if(jQuery.inArray(list1[i], list2) != -1)
		{
			thislist[i] = new Array(list1[i], 1);
		}
		else
		{
			thislist[i] = new Array(list1[i], 0.1);
		}		
	}

	return thislist;
}

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$(document).ready(function(){

	var opaqueAmount = 1;

	$.preloadImages(linkroot + "/img/ajax_text2.gif", linkroot + "/img/php_text2.gif");

	


			

	
	$(".techbox").hover(
		      function () {
		    	  
			      classname = $(this).attr('id');
		    	  for (var i in alphaList) {
			    	  if(alphaList[i][0] == classname)
		    		  	opaqueAmount =alphaList[i][1] + "text";
		  		}
		    	  
			  		//test = $(this).attr('id');
			  		//alert(test);
		    	  //opaqueAmount = $(this).css('opacity');
		    	  $("."+classname+"text").attr("src",linkroot+"public/img/"+classname+"_over.gif");
		    	  $("."+classname+"text").animate( { opacity: 1}, 200, 'easeOutCubic');
		        }, 
		        function () {
		        	$("."+classname+"text").attr("src",linkroot+"public/img/"+classname+".gif");
		        	$("."+classname+"text").animate( { opacity: opaqueAmount}, 200, 'easeOutCubic');
		        }
		      );
	});



$(



function(){
	var blink = new Array("Blink Software Solutions", "Click Previous and Next for a sampling of what we have done.  Want to see info about a specific Technology we use?  Click to the right.", new Array("php", "xhtml", "java", "ecommerce", "linux", "mysql", "mobile", "cloud", "javascript", "ajax"));
	var mobile = new Array("BYU TV", "We partnered with Axis 41 and created the new iPad and iPhone apps for BYU TV. Allows you to watch streaming videos from their large array of content.", new Array("cplusplus", "mobile", "cloud"));
	var vbf = new Array("Vita Brevis Films", "Working with the Vita Brevis Fims designers we created a new site and admin backend.  Utilizing an array of javascript animations and effects to really help bring the site alive.", new Array("php", "xhtml", "linux", "mysql", "javascript", "ajax"));
	var deseret = new Array("Deseret Book", "Blink Software worked with Swivelhead Design to create this touch screen kiosk located in Deseret Book stores across the country. Easy interface allows customers to watch trailers and get info about products.", new Array("php", "xhtml", "mysql", "ajax"));
	var process = new Array("Utah's Credit Unions", "Working with Process Agency Blink helped refresh the look and feel of the Utah's League of Credit Unions site.  We also created a new vendor and services system for them.", new Array("php", "xhtml", "linux", "mysql", "javascript"));
	//var process = new Array("ProcessAgency", "We developed the back-end of the Process Agency site and integrated it with their company blog.", new Array("php", "xhtml", "linux", "mysql", "javascript"));
	//var rev = new Array("Revolution", "Blink Software Solutions developed Revolution CRM for a nationwide law firm that uses the application to manage their clients.", new Array("java", "linux", "mysql", "cloud"));
	var bastille = new Array("Bastille", "Blink Software Solutions, along with Process Agency, developed this E-Commerce store for Bastille, a clothing boutique located in the Gateway Mall in Salt Lake City, UT.", new Array("php", "xhtml", "linux", "mysql", "ecommerce"));
	var ihc = new Array("Intermountain Healthcare", "Working with Swivelhead we created a touch kiosk system for Tosh Hospital. Being displayed on two 50\" screens, it offers an easy way to view a map and information about doctors and other hospital items.", new Array("php", "xhtml", "mysql", "javascript", "ajax"));
	var xpress = new Array("XPress7", "Blink Software Solutions developed this PHP/MySQL web application that is now used to manage and bill shipping for international clients.", new Array("php", "xhtml", "linux", "mysql", "ajax", "cloud"));
	var tru = new Array("Tru Talent", "A recent example of a PHP/MySQL web application we built at Blink Software Solutions is the Talent Management piece for TruTalent Modeling Agency.", new Array("php", "xhtml", "linux", "mysql", "ajax", "cloud"));
	
	var portfolioData=new Array(blink, mobile, vbf, deseret, process, bastille, ihc);
	var selectedNum = 0;
	var location = 0;
	var timo;
	$(".title").text(portfolioData[selectedNum][0]);
	$(".maintext").text(portfolioData[selectedNum][1]);

	timo = $.timer(8000, function (timer) {
		nextItem();
		//timo = timer;
	   	//timer.stop();
	   });

	function nextItem()
	{
		if(selectedNum < portfolioData.length -1)
	    {
			
			selectedNum++;
			location -=626;
			alphaList = getSameArray(fullTech, portfolioData[selectedNum][2]);
			
			for (var i in alphaList) {
				$("."+alphaList[i][0]+"text").animate( { opacity: alphaList[i][1]}, 500, 'easeInOutCubic');
			}

			
			$("#portfolioinfo").animate( { top:"364px"}, 300, 'easeInOutCubic', function(){
			$(".title").text(portfolioData[selectedNum][0]);
			$(".maintext").text(portfolioData[selectedNum][1]);
			$(".portfolioname").animate( { left:""+location+"px"}, 500, 'easeInOutCubic');
			$("#portfoliocontent").animate( { left:location}, 500, 'easeInOutCubic', function(){$("#portfolioinfo").animate( { top:"300px"}, 300, 'easeInOutCubic' );} );} )
			
		}
	};


	
	
	$(".next").click(function() {
		if(timo)
			timo.stop();
		
		nextItem();
		//timo.stop();
   }
   );

		   


		  	
	   
	$(".prev").click(function() {
		if(timo)
			timo.stop();
		
    	if(selectedNum > 0)
    {
	selectedNum--;
	location +=626;
	
	alphaList = getSameArray(fullTech, portfolioData[selectedNum][2]);
	
	for (var i in alphaList) {
		$("."+alphaList[i][0]+"text").animate( { opacity: alphaList[i][1]}, 500, 'easeInOutCubic');
	}
	
	$("#portfolioinfo").animate( { top:"364px"}, 300, 'easeInOutCubic', function(){
	$(".title").text(portfolioData[selectedNum][0]);	
	$(".maintext").text(portfolioData[selectedNum][1]);
	$(".portfolioname").animate( { left:location+"px"}, 500, 'easeInOutCubic');
	$("#portfoliocontent").animate( { left:location+"px"}, 500, 'easeInOutCubic', function(){$("#portfolioinfo").animate( { top:"300px"}, 300, 'easeInOutCubic' );} );} )

	}
    }
    );

}
);
