// --------------------------------------------------
//
// Author: Jonathan Guan Yu Chen
// URL: http://www.gyjchen.com
// Last edited: August, 2011
//
// welcome to my script.js
// i hope you find what you're looking for.
//
// --------------------------------------------------
$(document).ready(function(){$("#introduction").css("display","none");$("#web , #graphic").css({"bottom":"-220px","overflow":"hidden"});$(".cLoader").show();$(".cLoader").fadeOut();var j,centerGraphic,x,left,half;var k=80;var l=80;var m=0;half=$(window).width()/2;$("#web figure").each(function(){k+=$(this).outerWidth(true)});$("#web .wrap").css("width",k);j=$("#web .wrap").width()/2-half;$("#web").scrollLeft(j);$("#graphic figure").each(function(){l+=$(this).outerWidth(true)});$("#graphic .wrap").css("width",l);centerGraphic=$("#graphic .wrap").width()/2-half;$("#graphic").scrollLeft(centerGraphic);var n=$("#web"),ulW=$("#web .wrap"),divG=$("#graphic"),ulG=$("#graphic .wrap"),ulPadding=40;var o=n.width();var p=divG.width();n.css({overflow:"hidden"});divG.css({overflow:"hidden"});var q=ulW.find("figure:last-child");var r=ulG.find("figure:last-child");n.mousemove(function(e){var a=q[0].offsetLeft+q.outerWidth()+ulPadding;var b=(e.pageX-n.offset().left)*(a-o)/o;n.scrollLeft(b)});divG.mousemove(function(e){var a=r[0].offsetLeft+r.outerWidth()+ulPadding;var b=(e.pageX-divG.offset().left)*(a-p)/p;divG.scrollLeft(b)});$("#thumbnail img").tipsy({offset:9,gravity:"s"});$(".about a , em").tipsy({fade:true,gravity:"s"});$("input[type='text'] , input[type='email'] , textarea").tipsy({fade:true,gravity:"e",title:"placeholder",trigger:"focus"});$("a[href*='#']").click(function(e){e.preventDefault()});$("#slider").orbit({timer:false});$("#sendmail").click(function(){var a='';var b=' is required.';var c=$("#name").val();var d=$("#mail").val();var e=$("#subject").val();var f=$("#text").val();var g=0;var h=0;if(c.length<1){a+='<br />Name'+b}if(!d.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)){a+='<br />Valid Email'+b}if(e.length<1){a+='<br />Subject'+b}if(f.length<1){a+='<br />Message'+b}if(a!=''){$("#response").fadeIn("slow");$("#response > .content").html("<h2>The Following Error has Occured</h2><p>"+a+"</p>");setTimeout('$("#response").fadeOut()',2000)}else{var i='name='+c+'&mail='+d+'&subject='+e+'&text='+f;$("#response > .content").html("<p>Carrier Pigeon awaiting orders...</p>");$("#response").fadeIn();setTimeout("send('"+i+"')",2000)}return false})});function send(b){$.ajax({type:"POST",url:"mail.php",data:b,cache:false,success:function(a){$("#response > .content").html("<p>"+a+"</p>");$("#response").fadeIn();$( ":input" , "#contact" ).not(":submit").val("");setTimeout('$("#response").fadeOut()',2000)}})}
