/* Author:

*/

ARZ = {
	common: {
		init: function() {
			//Fonts
			Cufon.set('fontFamily','Delicious Heavy');
			Cufon.replace('.heading h1', {textShadow: '2px 2px 0 rgba(0,0,0,0.5)'});
			Cufon.replace('.content h1', {textShadow: '2px 2px 0 rgba(0,0,0,0.5)'});
			Cufon.replace('#portfolioshow h1', {textShadow: '2px 2px 0 rgba(0,0,0,0.5)'});
			Cufon.replace('#bar h1', {textShadow: '-1px -1px 0 #000'});

			Cufon.set('fontFamily','Delicious');
			Cufon.replace('.heading li a', {textShadow: '2px 2px 0 rgba(0,0,0,0.5)'});
			Cufon.replace('.content h2', {textShadow: '2px 2px 0 rgba(0,0,0,0.5)'});
			Cufon.replace('#tag');
			Cufon.replace('footer p');
			Cufon.replace('#portfolioshow p',  {textShadow: '2px 2px 0 rgba(0,0,0,0.5)'});

			//Tagline
			var robotJobs = ['write the books','draw the cartoons','make the websites','design the websites','make the apps','write the CSS'];
			$('#tag').html($('#tag').html().replace('make the apps',robotJobs[Math.floor(robotJobs.length*Math.random())]));

		}
	},
	home: {
		init: function() {
			$('#portfolioshow').after(
															$('<ul/>')
																	.attr('id','portfolio-navigation')
																	.append('<li id="previous"><a href="/work"><img src="images/previous.png" alt="previous"></a></li>')
																	.append('<li id="next"><a href="/work"><img src="images/next.png" alt="next"></a></li>')
													);
			$('#portfolioshow').cycle({
    			fx:     'scrollHorz',
    			delay:     12000
			});
			$("#previous a").click(function () {
    					$('#portfolioshow').cycle("next");
							return false;
			});
			$("#next a").click(function () {
    					$('#portfolioshow').cycle("prev");
							return false;
			});
			$("#portfolioshow").touchwipe({
	        wipeLeft: function() {
	            $("#portfolioshow").cycle("next");
	        },
	        wipeRight: function() {
	            $("#portfolioshow").cycle("prev");
	        }
	    });
		}
	}
};
UTIL = {

  fire : function(func,funcname, args){

    var namespace = ARZ;  // indicate your obj literal namespace here

    funcname = (funcname === undefined) ? 'init' : funcname;
    if (func !== '' && namespace[func] && typeof namespace[func][funcname] == 'function'){
      namespace[func][funcname](args);
    }

  },

  loadEvents : function(){

    var bodyId = document.body.id;

    // hit up common first.
    UTIL.fire('common');

    // do all the classes too.
    $.each(document.body.className.split(/\s+/),function(i,classnm){
      UTIL.fire(classnm);
      UTIL.fire(classnm,bodyId);
    });

    UTIL.fire('common','finalize');

  }

};

// kick it all off here
$(document).ready(UTIL.loadEvents);






















