// JavaScript Document

//Global jQuery Functions
$(function() {
		
		//Hide the computer screen, and add a show effect for onload
		$('.comp-text').hide();
		$('.comp-text').animate({width: "0", height: "0"}, 1);
		$('.comp-text').animate({width: "436px", height: "266px", opacity: "show"}, 400);
		
		//Now some slick animation
		//1. Forward to Port-1
		$('a[href="#p-1"]').click(function(){
			$('.comp-text').hide(200);
			$('#main').animate({left: '-200em'}, 1000, 'easeInOutBack');
			$('#port-1').animate({left: '48em'}, 500).animate({left: '0em'}, 400, 'easeOutExpo');
			return false;
		});
		//1. Back AND
		//5. Home from Port-4
		$('a[href="#h-i"]').click(function(){
			$('#main').animate({left: '-5.1em'}, 1000, 'easeInOutBack');
			$('#port-1').animate({left: '48em'}, 400, 'easeInOutExpo');
			$('#port-2').animate({bottom: '40em'}, 400, 'easeInOutExpo');
			$('#port-3').animate({right: '48em'}, 400, 'easeInOutExpo');
			$('#port-4').animate({bottom: '200em'}, 400, 'easeInOutExpo');
			$('.comp-text').animate({top: '2em', left: '7.4em'}, 1000).show(200);
			return false;
		});
		
		//2. Forward to Port-2
		$('a[href="#p-2"]').click(function(){
			$('#port-2').animate({bottom: '80em'}, 400, 'easeOutExpo');
			return false;
		});
		//2. Back
		$('a[href="#p-1"]').click(function(){
			$('#port-2').animate({bottom: '40em'}, 400, 'easeInOutExpo');
			return false;
		});
		
		//3. Forward to Port-3
		$('a[href="#p-3"]').click(function(){
			$('#port-3').animate({right: '0'}, 400, 'easeOutExpo');
			return false;
		});
		//3. Back
		$('a[href="#p-2"]').click(function(){
			$('#port-3').animate({right: '48em'}, 400, 'easeInOutExpo');
			return false;
		});
		
		//4. Forward to Port-4
		$('a[href="#p-4"]').click(function(){
			$('#port-4').animate({bottom: '160em'}, 400, 'easeOutExpo');
			return false;
		});
		//4. Back
		$('a[href="#p-3"]').click(function(){
			$('#port-4').animate({bottom: '200em'}, 400, 'easeInOutExpo');
			return false;
		});
		
		//Welcome and Contact Panels
		$('a[href="#contact"]').click(function(){
			$('#contact-form').animate({left: '0'}, 400, 'easeOutExpo');
			return false;
		});
		$('a[href="#welcome-msg"]').click(function(){
			$('#contact-form').animate({left: '48em'}, 400, 'easeInOutExpo');
			return false;
		});
		$('a[href="#p-1-2"]').click(function(){
			$('.comp-text').hide(200);
			$('#main').animate({left: '-200em'}, 1000, 'easeInOutBack');
			$('#port-1').animate({left: '48em'}, 500).animate({left: '0em'}, 400, 'easeOutExpo');
			$('#port-2').animate({bottom: '40em'}, 400, 'easeInOutExpo');
			$('#port-3').animate({right: '48em'}, 400, 'easeInOutExpo');
			$('#port-4').animate({bottom: '200em'}, 400, 'easeInOutExpo');
			return false;
		});
		
		//Galllery
		$('.g1 a').lightBox();
		$('.g2 a').lightBox();
		$('.g3 a').lightBox();
		$('.g4 a').lightBox();
		
		//Hover Link
		$('#main').hover(function(){
			$('#main a.text').stop().show().fadeTo('fast', 1.0);
			},function(){
			$('#main a.text').stop().fadeTo('slow', 0.0);
		});
		$('#main .comp-text, #main a.text').click(function(){
			$('#main a.text').hide('fast');
		});
		
		//External Links
		$('A[rel="external"]').click( function() {
        	window.open( $(this).attr('href') );
        	return false;
    	});
		
    });


/* 
 * No Spam (1.3)
 * by Mike Branski (www.leftrightdesigns.com)
 * mikebranski@gmail.com
 *
 * Copyright (c) 2008 Mike Branski (www.leftrightdesigns.com)
 * Licensed under GPL (www.leftrightdesigns.com/library/jquery/nospam/gpl.txt)
 *
 * NOTE: This script requires jQuery to work.  Download jQuery at www.jquery.com
 *
 * Thanks to Bill on the jQuery mailing list for the double slash idea!
 *
 * CHANGELOG:
 * v 1.3   - Added support for e-mail addresses with multiple dots (.) both before and after the at (@) sign
 * v 1.2.1 - Included GPL license
 * v 1.2   - Finalized name as No Spam (was Protect Email)
 * v 1.1   - Changed switch() to if() statement
 * v 1.0   - Initial release
 *
 */

jQuery.fn.nospam = function(settings) {
	settings = jQuery.extend({
		replaceText: false, 	// optional, accepts true or false
		filterLevel: 'normal' 	// optional, accepts 'low' or 'normal'
	}, settings);
	
	return this.each(function(){
		e = null;
		if(settings.filterLevel == 'low') { // Can be a switch() if more levels added
			if($(this).is('a[rel]')) {
				e = $(this).attr('rel').replace('//', '@').replace(/\//g, '.');
			} else {
				e = $(this).text().replace('//', '@').replace(/\//g, '.');
			}
		} else { // 'normal'
			if($(this).is('a[rel]')) {
				e = $(this).attr('rel').split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			} else {
				e = $(this).text().split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			}
		}
		if(e) {
			if($(this).is('a[rel]')) {
				$(this).attr('href', 'mailto:' + e);
				if(settings.replaceText) {
					$(this).text(e);
				}
			} else {
				$(this).text(e);
			}
		}
	});
};

// Use this Code for the Pages
$(function() {
	$('a.email').nospam({
		  replaceText: true,    // BOOLEAN, optional default false. If set to true, replaces matched elements' text with the e-mail address
		  filterLevel: 'low' // STRING, optional accepts 'low' or 'normal', default 'normal'.
								// low: email//domain/tld
								// normal: dlt/niamod//liame (email/domain/tld reversed)
		});
});