var gasFolioText = {
	1: "<h3>Plum Studios</h3><p>Coded a mockup for an interview with News" + "Week&trade; Magazine. Demonstrates XHTML/CSS, web design, and jQuery animation.</p>",
	2: "<h3>Our SnapBox</h3><p>Was the central contractor who coded this event photo system. Demonstrates PHP5, MySQL, jQuery/AJAX, and PDO pagination.</p>",
	3: "<h3>Double A Body Builders</h3><p>Designed and coded a small business custom theme in WordPress with the Pods CMS Plugin. Collaborated with the client's wishes to design the theme.</p>",
	4: "<h3>AffBuzz</h3><p>Worked with Justin Barr's original work and design, revamping into a faster, more reliable, more capable system. Demonstrates PHP5, MySQL, jQuery/AJAX, SimplePie RSS API, PDO pagination, MVC, and caching techniques.</p>",
	5: "<h3>Myrtle Beach Times</h3><p>Coded a mockup for an interview with News" + "Week&trade; Magazine. Demonstrates XHTML/CSS.</p>",
	6: "<h3>&#83;&#107;illed&#46;co&#46;uk</h3><p>Collaborated with David Le" + "ppard of D" + "24Media, building upon his web design. D" + "24Media hired me to code a simple, easy-to-use UK-based job application site.</p>",
	7: "<h3>SFFMA</h3><p>Installed PHP5 ISAPI and MySQL on Windows IIS without disturbing an existing ColdFusion platform.</p>",
	8: "<h3>Ozuto</h3><p>Created a custom game rotator gadget and an admin system to manage it.</p>",
	9: "<h3>Town of Pamplico</h3><p>Coded a mockup for an interview with News" + "Week&trade; Magazine, as well as to have the intent for a custom WordPress theme for small town government offices. Demonstrates XHTML/CSS, jQuery, and web design.</p>"
}

var gasFolioURLs = {
	1: "http://volosites.com/folios/sample3/",
	2: "http://demo.oursnapbox.com",
	3: "http://doubleabody.com",
	4: "http://affbuzz.com",
	5: "http://volosites.com/folios/sample2/",
	6: "http://sk" + "illed." + "co." + "uk",
	7: "http://www.sffma.org/",
	8: "http://ozuto.com",
	9: "http://volosites.com/folios/sample1/"
}

function hiliteSelectedMenu(){
	var o = $('#anim-menu A.selected IMG');
	var sImage = o.attr('src');
	sImage = sImage.split('-sel.png').join('.png').split('.png').join('-sel.png');
	o.attr('src',sImage);
}

function unhiliteSelectedMenu(){
	var o = $('#anim-menu A.selected IMG');
	var sImage = o.attr('src');
	sImage = sImage.split('-sel.png').join('.png');
	o.attr('src',sImage);
	$('#anim-menu A.selected').removeClass('selected');
}

function pageReady(){
	hiliteSelectedMenu();
	$('#folio-text').html(gasFolioText[3]);
	$('#folio-site A').attr('href',gasFolioURLs[3]);
	$('#portfolio,#experience,#contact').animate({
		opacity:1
	},'slow');
}

function checkURL(){
	var sHref = location.href;
	if (sHref.indexOf('experience') != -1) {
		$('A[href$=experience]').click();
	}
	if (sHref.indexOf('contact') != -1) {
		$('A[href$=contact]').click();
	}
}

$(document).ready(function() {

	// Prevent anchor links and buttons and .nodrag items from being dragged
	$('A,.button,.nodrag,IMG')
		    .css('-moz-user-select','none')
			.css('-webkit-user-select','none')
		    .bind('selectstart', function(e) {
		    		e.preventDefault();
		            return false;
		    })
		    .bind('draggesture', function(e) {
		    		e.preventDefault();
		            return false;
		    })
		    .bind('draggable', function(e) {
		    		e.preventDefault();
			    	return false;
		    })
		    .bind('dragstart', function(e) {
		    		e.preventDefault();
			    	return false;
		    });

	$('#anim-menu').animate({
		marginLeft:0
	},1000,function(){
		setTimeout('pageReady();clearTimeout();',50);
	});
	
	$('#anim-menu A').click(function(e){
		var sWhich = $(this).attr('href');
		unhiliteSelectedMenu();
		$(this).addClass('selected');
		switch(sWhich) {
			case 'portfolio':
				e.preventDefault();
				$('#experience,#contact,#portfolio').animate({
					marginLeft:0
				},'fast',function(){
					hiliteSelectedMenu();
					$('#experience').css('display','none');
				});
				break;
			case 'contact':
				e.preventDefault();
				$('#experience').css('display','block');
				$('#experience,#contact').animate({
					marginLeft:0
				},'fast',function(){
					$('#experience,#portfolio').animate({
						marginLeft:-960
					},'fast');
					hiliteSelectedMenu();
					$('#experience').css('display','none');
					setTimeout("$('#fldName').focus();clearTimeout();",900);
				});
				break;
			case 'experience':
				e.preventDefault();
				$('#experience').css('display','block');
				$('#experience,#contact').animate({
					marginLeft:0
				},'fast',function(){
					$('#portfolio').animate({
						marginLeft:-960
					},'fast');
					$('#contact').animate({
						marginLeft:-1920
					},'fast');
					hiliteSelectedMenu();
				});
				break;
			case 'blog':
				return true;
				break;
		}
		return false;
	});
	
	$('.folio-box-row A').click(function(e){
		e.preventDefault();
		var o = $(this);
		var sWhich = o.find('IMG').attr('src');
		sWhich = sWhich.split('square').join('site');
		$('#folio-site IMG').attr('src',sWhich);
		var asWhich = sWhich.split('.');
		var sTemp = asWhich[0];
		var nWhich = sTemp.substr(sTemp.length-1,1);
		nWhich = parseInt(nWhich);
		$('#folio-text').html(gasFolioText[nWhich]);
		$('#folio-site A').attr('href',gasFolioURLs[nWhich]);
		$('.folio-box-row A').removeClass('selected');
		o.addClass('selected');
		return false;
	});
	
	setTimeout('checkURL();clearTimeout();',1500);

});



